Create a class BeautyProduct with name, color, brand. Provide Constructors, getters, setters and also write toString method. Now create a class Lipstick which extends the class BeautyProduct as...


Create a class BeautyProduct with name, color, brand.


Provide Constructors, getters, setters and also write toString method.


Now create a class Lipstick which extends the class BeautyProduct as Lipstick is-a Beauty Product it has totalVolume, remainingVolume, price, texture (gloss, matt) as private data members.


Provide Constructors, getters, setters and an apply() method whenever this method is called a beauty item is applied and its volume decreases by 10.This should also check that volume must not be zero if it then u have to throw exception. Also write toString method which prints all details like name, color, brand, price, texture and volume.


Create another class foundation having totalVolume, remainingVolume, price, texture (liquid, cake) and lastingTime (number of hours foundation remain intact on face and does not crease) as private data members. This also extends the base class i.e. BeautyProduct.


Provide Constructors, getters, setters and an apply() method whenever this method is called a beauty item is applied and its volume decreases by 20.This should also check that volume must not be zero if it then u have to throw exception. Also write toString method which prints all details like name, color, brand, price, texture, lastingTime and volume.



Write a main program and create objects of both child classes, initializes values.. After that ask the user that which BeautyProduct she wants to apply



  1. Foundation

  2. Lipstick


Get Choice and then call the appropriate apply method and print the values on screen.

Jun 02, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here