Product has some information id (string), name (string), price (double) and quantity (int).
Student will implement some constructors and getters, setters to solve some requirments
1. Display method will show information as format [id-name-price-quantity status], if quantity <= 0
then “out of stock”, otherwise quantity value.
2. Buying method which has number of product buying (integer) as parameter
a. If number of product buying is more than quantity or less than (or equal) zero, then
return 0
b. When buying products suceessfully then descreasing quantity value and return total
cost = price*number of buying item
Cement product (CementProduct) is a product and adding insurance property as integer.
Cement product constructors (full paramenters) should be public CementProduct(int insurance, String id,
String name, double price, int quantity)
The display method will show information as format [id-name-price-quantity status-insurance], if
quantity <= 0 then “out of stock”, otherwise quantity value. The buying method has parameter as
number of items bought, however if number of items is more than 20 then discount 10% on total cost.
===== TEST CASE ====
Input product id:
p001
Input product name:
pepsi
Input product price:
12
Input product quantity:
100
Show product information
[p001,pepsi,12.00,100]
Input number of item for buying:
1000
Total cost is: 0.00
Show product information after buying
[p001,pepsi,12.00,100]
Input number of item for buying:
50
Total cost is: 600.00
Show product information after buying
[p001,pepsi,12.00,50]
Input cement product id:
cp001
Input cement product name:
villaracy
Input cement product price:
10
Input cement product quantity:
200
Input cement product insurance:
36
Show product information
[cp001,villaracy,10.00,200,36]
Input number of cement item for buying:
250
Total cost is: 0.00
Show cement product information after buying
[cp001,villaracy,10.00,200,36]
Input number of cement item for buying:
100
Total cost is: 900.00
Show cement product information after buying
[cp001,villaracy,10.00,100,36]