Create a main program as MyStore Prompt the user to enter the following details via keyboard Enter a Product Name : ________ Enter Unit Price : ________ Enter Quantity : ________ Instantiate an object of Product class and pass the variables as the parameters for the new Produ
Create a main
Prompt the user to enter the following details via keyboard
Enter a Product Name : ________
Enter Unit Price : ________
Enter Quantity : ________
Instantiate an object of Product class and pass the variables as the parameters for the new Product.
------------------------------------------------------------
Create a Product class
Declare the following as private properties:
prodName and prodPrice
Create a constructor of the Product class
* copy the values of the parameters in the constructor to the properties.
* Display the following:
Product entered : <prodName>
Price entered : <prodPrice>
Amount : ?
Discount : ?
Net Amount : ?
--------------------------------------------------------------
Enter a Product Name : Noodles
Enter Unit Price : 8.50
Enter Quantity : 10
Product entered: Noodles
Price entered : 8.500000
Amount : 85.00000
Discount : 0.0000
Net Amount : 85.00000
--------------------------------------------------------------
NOTE:
Amount is equal to Quantity x Unit Price
Discount is given as 8% of Amount whenever the Amount exceeds 120.000
Net Amount is the difference between Amount and Discount.
Step by step
Solved in 3 steps with 1 images