1. Enter a name and display change to be given for each denomination 2. Find the name with the largest amount and display change to be given for each denomination 3. Find the name with the smallest amount and display change to be given for each denomination 4. Calculate and display the total number of coins for each denomination 5. Calculate and display the total amount (i.e. NOT the total number of coins) for the sum of all denominations 6. Exit

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

O-O design implemented in Java. You will need to use a user-defined class, as an array of such class objects will be required.

address the following O-O concepts by highlight where in the code you are implementing these concepts; Modularity including low coupling rules, Single Responsibility Rule, Open/Closed Principle, Information hiding, Encapsulation, Pre-conditions and Post-conditions, Constructors, Assessors and Mutators, Helper.

design and implement your own data class. 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. the coin denominations are $1, 50 cents, 25 cents, 10 cents, and 5 cents. can use 5 instance variables to represent each coin denominations. 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. The key point here is to work on a design such that there is no need for the client class to make any change when the Change class needs to upgrade to accommodate the different coin denominations for different countries. Explain how your class can satisfy this in your external documentation and what concepts are used to implement this design.
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. Do not use ArrayList. 

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.

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. provide a call to this method (commented out) in the main function; this can be uncommented When needed. 

program should check that no same name should be entered. If the same name has been
entered, the program should inform the user that the name has existed in the system.

Methods would need to be called to calculate required output corresponding to coin amounts stored in the array of objects. Output change values must consist of: $1, 50 cents, 25 cents, 10 cents and 5 cents coins. The program should aim to give as much of the higher valued coins as possible. 
If the coin amounts entered are not multiple of 5, you need to use a method to change the amount to the nearest of 5 before storing them in the array of objects. E.g. coin amount 94, should be changed to 95 and store 95 in the array of objects. coin amount is 92, should be changed to 90


Once the data input has been completed, your program should display a menu screen as illustrated in picture one.

When the user enters the value 1 at the menu prompt, your program will ask for a name. E.g. Jane, program will output:
Customer:
Jane 65 cents
Change:
50 cents: 1
10 cents: 1
5 cents:  1
N.B. change values of 0 are not shown for screen output.
If user enters a non-existent name at menu option 1, your program will print: Name: Donald NOT FOUND
The menu is re-displayed.

enters 2 at the menu prompt, program will search all objects in array to find object with largest coin amount. Then output name, and denomination breakdown change. the menu is re-displayed.

enters 3 at the menu prompt, program will search all objects in array to find object with the smallest coin amount. program will output name and denomination breakdown. the menu is re-displayed.

 enters 4 at the menu prompt, program will access all objects in the array to calculate and display total number of coins for each denomination. displays the number of coins and NOT amount of each denomination. the menu is re-displayed.

enters 5 at the menu prompt, program will access all objects in array to calculate the sum of the amounts from all denominations. this option displays the amount and NOT the number of coins.The menu is re-displayed.

1. Enter a name and display change to be given for each denomination
2. Find the name with the largest amount and display change to be
given for each denomination.
3.
Find the name with the smallest amount and display change to be
given for each denomination
4. Calculate and display the total number of coins for each
denomination
5. Calculate and display the total amount (i.e. NOT the total number
of coins) for the sum of all denominations
6. Exit
Transcribed Image Text:1. Enter a name and display change to be given for each denomination 2. Find the name with the largest amount and display change to be given for each denomination. 3. Find the name with the smallest amount and display change to be given for each denomination 4. Calculate and display the total number of coins for each denomination 5. Calculate and display the total amount (i.e. NOT the total number of coins) for the sum of all denominations 6. Exit
moodleprod.murdoch.edu.au
Recommendation: Please enter at least 10 records to test the program.
Please enter the name of the person:
Jane
Please enter the coin value for the person:
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:
50
Do you have more person to enter (Y/N):
Y
Transcribed Image Text:moodleprod.murdoch.edu.au Recommendation: Please enter at least 10 records to test the program. Please enter the name of the person: Jane Please enter the coin value for the person: 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: 50 Do you have more person to enter (Y/N): Y
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY