Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

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_2

Step: 3

blur-text-image_3

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

1. Let a, b R, a Answered: 1 week ago

Answered: 1 week ago

Question

Enhance the basic quality of your voice.

Answered: 1 week ago

Question

Describe the features of and process used by a writing team.

Answered: 1 week ago