The client needs a program to store data on sandwiches, including bread name, filling name, and calories (cal)   Testing values for get and set methods are bread name: “whole-wheat”, filling: “tuna”, and calories 250.50 Testing values for overloaded constructor are bread name: “rye”, filling: “chicken”, and calories 300.25   Using the word problem above, design a class with the needed fields, a no parameter constructor, an overloaded constructor with three parameters, and needed methods (gets sets). Document your design using a detailed UML Class diagram.   Part 2 Write the Java code for the class Follow your UML class diagram and code the class you designed. Use Java coding conventions for identifiers: class, constructor, field, variable, and method names Mark fields private, constructor and methods public. Select and use appropriate data types for the fields as well as method parameters as needed. Comment your code as requested and demonstrated in the course. Part 3 Test the class you created, using a main method in a separate class. Create a second class with an identifier that follows these instructions: FullNameLabExam1SectionNumber For example, a student with first name “Abc” and last name “Xyz” in section 123 would name the class as: AbcXyzLabExam1Section123, with resulting file name AbcXyzLabExam1Section123.java Using this class with a method main, write some simple program tests to verify your designed class. Instantiate one object based on your designed class using the default constructor and output the field values using the get methods. Set a value into each field of the object, get a value from each field printing the field value(s) on screen Instantiate a new object based on your designed class using the overloaded constructor and output the field values using the get methods.   There is no need for user input to the program, use literal values in the source code of your test program (within method main). Ensure that your full name is written out on screen after the tests above are run.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
  • The client needs a program to store data on sandwiches, including bread name, filling name, and calories (cal)

 

  • Testing values for get and set methods are bread name: “whole-wheat”, filling: “tuna”, and calories 250.50
  • Testing values for overloaded constructor are bread name: “rye”, filling: “chicken”, and calories 300.25

 

  • Using the word problem above, design a class with the needed fields, a no parameter constructor, an overloaded constructor with three parameters, and needed methods (gets sets). Document your design using a detailed UML Class diagram.

 

Part 2 Write the Java code for the class

  • Follow your UML class diagram and code the class you designed.
  • Use Java coding conventions for identifiers: class, constructor, field, variable, and method names
  • Mark fields private, constructor and methods public.
  • Select and use appropriate data types for the fields as well as method parameters as needed.
  • Comment your code as requested and demonstrated in the course.

Part 3 Test the class you created, using a main method in a separate class.

  • Create a second class with an identifier that follows these instructions:
    • FullNameLabExam1SectionNumber
    • For example, a student with first name “Abc” and last name “Xyz” in section 123 would name the class as:

AbcXyzLabExam1Section123, with resulting file name AbcXyzLabExam1Section123.java

  • Using this class with a method main, write some simple program tests to verify your designed class.
    • Instantiate one object based on your designed class using the default constructor and output the field values using the get methods.
    • Set a value into each field of the object, get a value from each field printing the field value(s) on screen
    • Instantiate a new object based on your designed class using the overloaded constructor and output the field values using the get methods.

 

  • There is no need for user input to the program, use literal values in the source code of your test program (within method main). Ensure that your full name is written out on screen after the tests above are run.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
void method
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education