Question: 1-Create a class called Product which has the following: Four attributes Product Name (string). Product Code (integer). Price (double, not be negative or zero). Storge
1-Create a class called "Product which has the following: Four attributes Product Name (string). Product Code (integer). Price (double, not be negative or zero). Storge Quantity (integer). [1 point) Full-argument constructor to set the previous attributes. 1 point) Setter and getter methods. 1 point) Apply the encapsulation concept in your class (5 point) .toString method which returns a String representation of the class. (.5 point A method called modify_inventory which takes a new quantity amount as argument and if it is positive, will add this amount to the Storge_Quantity, otherwise print out an error message. (1 point) 2-Create a class called "Discount Product which extends the "Product and has following: {-5 point) One attribute :Discont (double should not be negative). {.5 point) Full-argument constructor to set the inherited attributes and to set the pr- attributes. 1 point) Setter and getter methods. 1 point) Apply the encapsulation concept in your class. {.5 point) toString method which returns a String representation of the class. [.5 3-Create a class called "Shopping Cart" which has the following: Three attributes: ProductInCart(Arry List of type Product class), Total_Price shared attribute), internalDiscount (double). {1.5 point) Constructor to initialize ArryList, ProductInCart-0.0, internalDiscu point) Setter and getter methods. {1 point) Apply the encapsulation concept in your class. {.5 point} toString method which returns a String representation of the cla- A method called add_to_cart() which takes "Product object" as will add product to the ProductInCart, update the Total_Price a type Discount_Product, add the discount into internalDiscoun A method called Checkout_Total which return the total afte discount. {1 point)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
