Using object oriented programming approach, Cash Register program. – Define a class Product (Product.java) o Three private data members:

1.     Using object oriented programming approach, Cash Register program.

–       Define a class Product (Product.java)

o  Three private data members: product name, unit price, units to purchase

o  One static constant: sales tax rate = 0.0675

o  Two overloaded constructors

§ Ensure that both unit price and units to purchase are valid ( > = 0 )

o  Get and set methods for each private data member

§ Ensure that both unit price and units to purchase are valid ( > = 0 ) in setters

o  A method to calculate and return the purchase price before tax

§ price before tax = unit price * units to purchase

o  A method to calculate and return the purchase price after tax

§ price after tax = price before tax * ( 1 + sales tax rate )

o  toString() method

–       (CashRegister.java) menu-driven client program that can simulate the sale at a retail store.

o  1 – Purchase

Product object based on the user input and calculate its purchase prices before and after tax

o  2 – Check Out

Print the receipt (the receipt should include all the purchases)

–       Incorporate “this” reference in the Product class

Sample run

——————————————