Question: java Write an inheritance hierarchy that enables polymorphism for the classes defined in parts 1, 2 and 3. Then implement the driver program defined in

java

java Write an inheritance hierarchy that enables polymorphism for the classes defined

in parts 1, 2 and 3. Then implement the driver program defined

Write an inheritance hierarchy that enables polymorphism for the classes defined in parts 1, 2 and 3. Then implement the driver program defined in part 4. Part #1 Product (an abstract class) code: a String of characters name: a String of characters Attributes basicPrice: a double value count: to count the number of all products Default Constructor Constructor Methods set and get methods toString: returns information about a Product calculatePrice: an abstract method Part #2 LocalProduct (a Product) supplierName: a String of characters Attributes type: an integer value that can be set to 1 or 2 only Default Constructor Constructor set and get methods Methods toString: returns information about a LocalProduct calculate Price: returns the price of a LocalProduct by adding to the basic price: 5% if type is equal to 1 8% if type is equal to 2 Part #3 Imported Product (a Product) countryOfOrigin: a String of characters Attributes tariff: a double value Default Constructor Constructor set and get methods Methods toString: returns information about an Imported Product calculate Price: returns the price of an Imported Product by adding to the basic price: 5% of basic price if country of origin is USA Amount of tariff Part #4 Write a java application to store information about N Product objects; N is the first input by the user. The user should specify the type of each Product object (1- for LocalProduct and 2- for Imported Product), and input the corresponding values using a Scanner object to initialize the objects. Then the program should output the following information (using JOptionPane methods): . Total price of all products Names of suppliers of all type 1 local products Country of origin of all imported products Information about all products imported from "France

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!