Question: Learning Objectives: 1. Construct a hierarchical inheritance project a. Parent class should contain all the instance variables b. Parent class should also consist of a

Learning Objectives:

1. Construct a hierarchical inheritance project

a. Parent class should contain all the instance variables

b. Parent class should also consist of a default constructor

2. Child classes should contain one setter and one getter

3. Main class should contain the main function

a. Create 5 objects, each object should contain its respective co-efficient or exponent value

4. Get the user input

5. Write a display function.

Project Description: In this project you will display a quadratic equation by taking coefficient and exponent value from the user. The code should contain 1 parent class named Polynomial and 2 derived class coeffTerm and expoTerm.

Your code should also contain a main class where all the objects are created to store the respective value from the user. This can be named as project6.

Follow the below UML for designing the code:

Learning Objectives: 1. Construct a hierarchical inheritance project a. Parent class should

The display method takes coefficient and exponents as its input. Call the display method from the main function using the respective object. Make user to handle cases where co-efficient is zero, in this case you should not be displaying the term. If the exponent is zero, then the term is a constant.

Example Output

Please enter the coefficient for quadratic term

7

Please enter the exponent for quadratic term

2

Please enter the coefficient for linear term

10

Please enter the exponent for linear term

1

Please enter the coefficient for constant term

9

The polynomial is 7x^2 + 10x^1 + 9

Second Example:

Please enter the coefficient for quadratic term

5

Please enter the exponent for quadratic term

2

Please enter the coefficient for ones term

0

Please enter the exponent for ones term

1

Please enter the coefficient for constant term

10

The polynomial is 5x^2 + 10

Submission Requirements Please make sure you submit a single file named project6.java

Polynomial + coefficient : int + exponent : int + displayint, int) : void coeffTerm expo Term + setCoeff(int): void + setExpo(int): void +getExpo(): int + getCoeff(): int

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!