Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions

Question

d. Who are important leaders and heroes of the group?

Answered: 1 week ago