Create a Java program with a data class. The class will store data that has been read as user input from the keyboard and provide necessary operations. As the data stored relates to monetary change, the class should be named Change. The class requires at least 2 instance variables for the name of a person and the coin change amount to be given to that person. You may also wish to use 4 instance variables to represent amounts for each of the 4 coin denominations (see Client Class below). There should be no need for more than these instance variables. Your class will need to have at least a default constructor, and a constructor with two parameters: one parameter being a name and the other a coin amount. Your class should also provide appropriate get and set methods for client usage. Other methods may be provided as needed. However, make sure they are necessary for good class design. In particular, your class should NOT include Input and Output methods. The only way to get data out of a data class object to the client program is to use an appropriate get method. The data class methods must not write data out. Data should be entered into a data class object via a constructor or an appropriate set method. When designing your Change class, use an UML class diagram to help understand what the class design needs. Input for the client program will come from keyboard (entered by the user). The input should consist of: the name of a person, and a coin value (as an integer). The program should validate the input coin value to ensure that it is in the range 5 to 95, and is evenly divisible by 5. Names are one-word strings. You should ask the user to enter the required information using a loop with a question after each loop iteration to check if the user wants to end the input of data. It is recommended for the user to input at least 12 such data – this can be conveyed to the user using a message before entering the loop.
Create a Java program with a data class. The class will store data that has been read as user input from the keyboard and provide necessary operations. As the data stored relates to monetary change, the class should be named Change. The class requires at least 2 instance variables for the name of a person and the coin change amount to be given to that
person. You may also wish to use 4 instance variables to represent amounts for each of the 4 coin denominations (see Client Class below). There should be no need for more than these instance variables. Your class will need to have at least a default constructor, and a constructor with two parameters:
one parameter being a name and the other a coin amount. Your class should also provide appropriate get and set methods for client usage. Other methods may be provided as needed. However, make
sure they are necessary for good class design. In particular, your class should NOT include Input and Output methods. The only way to get data out of a data class object to the client program is to use an appropriate get method. The data class methods must not write data out. Data should be
entered into a data class object via a constructor or an appropriate set method. When designing your Change class, use an UML class diagram to help understand what the class design needs.
Input for the client program will come from keyboard (entered by the user). The input should consist of: the name of a person, and a coin value (as an integer). The program should validate the input coin value to ensure that it is in the range 5 to 95, and is evenly divisible by 5. Names are one-word
strings. You should ask the user to enter the required information using a loop with a question after each loop iteration to check if the user wants to end the input of data. It is recommended for the user to input at least 12 such data – this can be conveyed to the user using a message before entering the loop.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images