Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN JAVA CODe (PART 1 SSHOULD BE THE FIRST, PART 2, PART 3, PART4) Part #2 (20 points) LocalProduct (a Product) (2 points) supplierName: a

IN JAVA CODe (PART 1 SSHOULD BE THE FIRST, PART 2, PART 3, PART4)image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Part #2 (20 points) LocalProduct (a Product) (2 points) supplierName: a String of characters (1 point) Attributes type: an integer value that can be set to 1 or 2 only (1 point) Default Constructor (2 points) Constructor (4 points) set and get methods (4 points) Methods toString: returns information about a LocalProduct (3 points) calculate Price: returns the price of a LocalProduct by adding to the basic price: (3 points) 5% if type is equal to 1 8% if type is equal to 2 Part #3 (20 points). Imported Product (a Product) (2 points) countryOfOrigin: a String of characters (1 point) Attributes tariff: a double value (1 point) Default Constructor (2 points) Constructor (4 points) set and get methods (4 points) Methods toString: returns information about an Imported Product (3 points) calculate Price: returns the price of an Imported Product by adding to the basic price: (3 points) 5% of basic price if country of origin is "USA" Amount of tariff Part #4_(20 points) 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 ImportedProduct), and input the corresponding values using a Scanner object to initialize the objects. (8 points) Then the program should output the following information (using JOptionPane methods): Total price of all products (3 points) Names of suppliers of all type 1 local products (3 points) Country of origin of all imported products (3 points) Information about all products imported from France (3 points) 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 (20 points). Product (an abstract class) (1 point) code: a String of characters (1 point) name: a String of characters (1 point) Attributes basicPrice: a double value (1 point) count: to count the number of all products (1 point) Default Constructor (2 points) Constructor (3 points) Methods set and get methods (7 points) toString: returns information about a Product (2 points) calculatePrice: an abstract method (1 point)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

13-4 What are alternative methods for building information systems?

Answered: 1 week ago