Question: Create an abstract class named Product which has a String field for the name of the product and a double field for the price of

 Create an abstract class named Product which has a String field

Create an abstract class named Product which has a String field for the name of the product and a double field for the price of the product. Within this class create a constructor that requires the product name and add two (2) get) methods to return the product name and the price of the product. Include an abstract method named setPrice(). Create two (2) child classes of Product called Perishable and NonPerishable. Each must include the setPrice() method that will set the price for a Perishable product to R11.99 and R19.99 for a NonPerishable product. Write a constructor for each child class and include a call to the setPrice) method within each. Create a class named UseProduct to demonstrate using an object of each child class and print out the following: UseProduct-NetBeans IDE 7 21 File Edit View Navigate Source Refactor Run Debug Profile Team Too

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!