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. In Australia, the coin denominations are 50 cents, 20 cents, 10 cents, and 5 cents. All these instance variables should be declared as private. Think of a way such that the client program can use the same class name and public methods for other countries with different coin denominations without changing their client program. Explain how your class can satisfy this in your external documentation. Your class will need to have at least a default constructor, and a constructor

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 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. In Australia, the coin denominations
are 50 cents, 20 cents, 10 cents, and 5 cents. All these instance
variables should be declared as private. Think of a way such that the client program can use the
same class name and public methods for other countries with different coin denominations without
changing their client program. Explain how your class can satisfy this in your external
documentation.
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 (including helper) may be provided as needed.
However, make sure they are necessary for good class design; you must provide legitimate justification for their usage in the internal and external documentation. 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. 
The client program should read the input data from the user and use the Change class to store the data entered. You will need a data structure to store the Change class objects according to the number of persons entered. Thus, you are to utilize an array of Change objects.
Getting Input (put this input method in the client class):
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 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 10 such data – this can be conveyed to the user using a message before entering the loop.
NOTE: for the purpose of testing the program by your tutor, you should provide a method in the client class that hardcodes data into at least 10 Change objects and stores these objects into the array provided by your program. In this case, your tutor would not need to manually key in the data to test the program when assessing your work. Thus, you should provide a call to this method (commented out) in the main function; this can be uncommented by your tutor as needed.
Example of inputs as follows:
Please enter the name of the person:
Jane
Please enter the coin value for the person (multiple of 5):
30
Do you have more person to enter (Y/N):
Y
Please enter the name of the person:
John
Please enter the coin value for the person (multiple of 5):
50
Do you have more person to enter (Y/N):
Y
Please enter the name of the person:
Fred
Please enter the coin value for the person (multiple of 5):
94

Incorrect coin value. Must be multiple of 5.
Please enter the name of the person:
Jane
Please enter the coin value for the person (multiple of 5):
35
Do you have more person to enter (Y/N):
Y
… (assuming this is repeated at least 10 times)
Do you have more person to enter (Y/N):
N
… (go out of the loop)
It should be noted that it is possible to have the same name entered numerous times, but the coin values for such repetitions could be different. When the name is the same, it would mean the same individual, and your program should add up the coin amounts to obtain a total amount for that individual; this should be performed before computing the change to be given.
Processing would involve determining repeated names and accumulating the total for those repeated names. You must ensure that there are no objects with repeated names in the array. Then methods would need to be called to calculate the required output corresponding to the coin amounts stored in the array of objects. Output change values must consist of the following denominations: 50 cents, 20 cents, 10 cents and 5 cents coins.
Once the data input has been completed, your program should then display a menu screen as illustrated below. The program will continue to show the menu and execute the menu options until "Exit" is selected by entering the value 5 at the menu prompt.
1. Enter a name and display change to be given for each denomination
2. Find the name with the smallest amount and display change to be given for each denomination
3. Find the name with the largest amount and display change to be given for each denomination
4. Calculate and display the total number of coins for each denomination, and the sum of these totals
5. Exit. 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
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