Question
Design a blueprint class that records the payment and purchase made in a CashRegister. (Write the code for CashRegister - JAVA) The requirements are as
Design a blueprint class that records the payment and purchase made in a CashRegister. (Write the code for CashRegister - JAVA) The requirements are as follows:
A) The class/object model will keep track of payments and purchases, both of which can be of type double. To do this, have the two instance variables called payment and purchase.
B) The class/object model will provide the values of the payments and purchases to the client program. To do this, have proper getters for the instance variables
C) The class/object model has method, recordPayment, that will record payments. To do this the method will receive the amount as a parameter and add this amount to the payments. Write a method in the class that will take in an input parameter called amount to add to payment. This method has a void return.
D) The class/object model has method, recordPurchases, that will record purchases. To do this the method will receive the amount as a parameter, and add this amount to the purchases. Write a method in the class that will take in an input parameter called amount, to add to purchase. This method has a void return.
E) The class/object model has a method called printBalance that will print the balance. The value of balance is given by the difference between payments and purchases. The printBalance method takes in no input parameters and has a void return. Format the print output and show the purchase and payment amounts as well.
F) The class/ object model has constructors that will allow default and full-argument overloaded constructors in the client class. Write appropriate default and overloaded constructors . Default values of payment and purchases are set to zero.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started