Question: Problem # 1 : Create a class called polynomial for defining a one variable polynomial equation and perform some simple algebraic operations on it. Polynomial

 Problem # 1 : Create a class called polynomial for defining

Problem # 1 : Create a class called polynomial for defining a one variable polynomial equation and perform some simple algebraic operations on it. Polynomial equation is on the form: Where n is a positive integer and it represents the highest power of the polynomial equation. And c is the coefficient of each term. Write a program to test your class. Provide a constructor that enables an object of this class to be initialized when it's declared Provide a no-argument constructor with default values in case no initializes re provided. Provide public methods that a) Add to the equation a term. It takes as an argument the coefficient of the term and power of the variable x. b) Multiply a term to the equation. It takes as an argument e coefficient of the term and power of the variable x. e) Substitute x with a constant value and calculate the polynomial equation. It l take the value of x as a d) Method toString that is used to print any polynomial perform the following operations The result is stored in a new polynomial equation. th The result is stored in a new polynomial equation. double number and calculate the result. equation in the form: Note that x so it is dropped, also if coefficient is equal to zero it should be dropped as well. And when the coefficient is a negative number the+sign should Sample Run: Enter the polynomial power:3 Enter coefficient of x 3: 4 Enter coefficient of x 2: 0 Enter coefficient of x 1:2 Enter coefficient of x 0: 1 The equation is: 4x 32x1 What would you like to do? 1. Add, 2. Multiply.3. Substitute: 1

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!