Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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

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

The Power Of Numbers In Health Care A Students Journey In Data Analysis

Authors: Kaiden

1st Edition

8119747887, 978-8119747887

More Books

Students also viewed these Databases questions

Question

What is the preferred personality?

Answered: 1 week ago

Question

What is the relationship between humans?

Answered: 1 week ago