Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

a. Write a program that uses a Do Whileloop to evaluate the following polynomial

ID: 3615056 • Letter: A

Question

a. Write a program that uses a Do Whileloop to evaluate the following polynomial. Yourprogram should allow the user to enter the starting value for X,the stopping value for X, and the increment value forX.

              Y=X3-2X+10

Output a table that lists the X value and corresponding Yvalue. Include X and Y as titles for your table. Run thisprogram using the following data:

Run 1: Start at X=0, Stop at X=20, increment by2.

Run 2: Start at X=-4, Stop at X=1, increment by0.3

#include<iostream>

using namespace std;

#include<math.h>

int main()

{

//variables defined here

double x,y,start,stop,increment;

//data INPUT

cout<<"enter start value for x:";

cin>>start;

cout<<"enter ending value for x:";

cin>>stop;

cout<<"enter the increment value forx: ";

cin>>increment;

cout<<endl;

x=start;

//data output

do

{

y=pow(x,3)-2*x+10;

cout<<x<<""<<y<<" ";

x=x+increment;

}

while (x<=stop);

cout<<endl;

system("pause");

Explanation / Answer

Please rate lifesaver The reason why your program stops at 0.8 is because 0.8 + 0.3 = 1.1 which is bigger than 1 You program is right. If you were to put in: start: -4 stop: 1 increment: 1 it would stop at 1

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote