Question

In: Computer Science

Problems create a C++ program that will do the followings - define 3 double variables x,...

 

Problems
create a C++ program that will do the followings

- define 3 double variables x, y, z

- calculate the value of y as the following formula: y = 2*x*x+4*x+5 and print x and y;

- assign a new value to x: x=5.6

- calculate the value of z as the following formula

z = (y*y)/4 + (x*x)/5

- print x, y,x

Solutions

Expert Solution

CODE:

#include <iostream>
using namespace std;
int main()
{
double x;
double y;
double z;
cout<<"Enter a floating point value: ";
cin>>x;
cout<<x<<" is stored into x\n";
//y=2*x*x+4*x+5
y = (2.0*x*x)+(4.0*x)+5.0;
cout<<"Y is calculated as per this formula <y=2*x*x+4*x+5>\n";
cout<<"And the value of Y is = "<<y<<"\n";
//z=(y*y)/4+(x*x)/5
cout<<"The value of x is changed to x=5.6\n";
x=5.6;
cout<<"Now Z is calculated as per this formula <z=(y*y)/4+(x*x)/5>\n";
z=(y*y)/4+(x*x)/5;
cout<<"And the value of z is = "<<z;;
return 0;
}

OUTPUT:


Related Solutions

1. Create a console program in C#, * Create a class: "Student.cs" * Add 3 variables:...
1. Create a console program in C#, * Create a class: "Student.cs" * Add 3 variables: StudentName (string), SchoolYear (int), YearsUntilGraduation(int) * Method YTK() = 12 - SchoolYear; 2. Main *Enter name *Enter age *You will attend school:____ years before graduating.
Write a program that prompts the user to enter a 3 x 3 matrix of double...
Write a program that prompts the user to enter a 3 x 3 matrix of double values and tests whether it is a positive Markov matrix. There will be two methods which will be called from the main method: public static double [] [] createArray() 1. Creates a 3 by 3 two dimensional array of doubles 2. Prompts the user for values as shown in the sample run 3. Stores the numbers in the array in the order entered 4....
Write a program that prompts the user to enter a 3 x 3 matrix of double...
Write a program that prompts the user to enter a 3 x 3 matrix of double values and tests whether it is a positive Markov matrix. There will be two methods which will be called from the main method: public static double [] [] createArray() 1. Creates a 3 by 3 two dimensional array of doubles 2. Prompts the user for values as shown in the sample run 3. Stores the numbers in the array in the order entered 4....
Write a program that prompts the user to enter a 3 x 3 matrix of double...
Write a program that prompts the user to enter a 3 x 3 matrix of double values and tests whether it is a positive Markov matrix. There will be two methods which will be called from the main method: public static double [] [] createArray() 1. Creates a 3 by 3 two dimensional array of doubles 2. Prompts the user for values as shown in the sample run 3. Stores the numbers in the array in the order entered 4....
Write a program that prompts the user to enter a 3 x 3 matrix of double...
Write a program that prompts the user to enter a 3 x 3 matrix of double values and tests whether it is a positive Markov matrix. There will be two methods which will be called from the main method: public static double [] [] createArray() 1. Creates a 3 by 3 two dimensional array of doubles 2. Prompts the user for values as shown in the sample run 3. Stores the numbers in the array in the order entered 4....
Create a C++ program that consists of the following: In maincreate the following three variables:...
Create a C++ program that consists of the following: In main create the following three variables: A char named theChar A double named theDouble An int named theInt Fill each of these variables with data taken as input from the keyboard using a single cin statement. Perform the following task on each variable: Increment theChar by one Decrement theDouble by two Square theInt This should be done on separate lines. Output the value of each variable to the screen on...
C++ Create a program which randomly generates 3 sets of x and y Integers and one...
C++ Create a program which randomly generates 3 sets of x and y Integers and one randomly generated Integer. Two of the sets of Integers will represent the end points of a line segment. The other set of Integers and the other Integer will represent the midpoint of a circle and its radius. The coordinates should be randomly generated using a user defined function that returns an Integer value based on from and to parameters; see the function declaration in...
Using C++ language, create a program that uses a struct with array variables that will loop...
Using C++ language, create a program that uses a struct with array variables that will loop at least 3 times and get the below information: First Name Last Name Job Title Employee Number Hours Worked Hourly Wage Number of Deductions Claimed Then, determine if the person is entitled to overtime and gross pay. Afterwards, determine the tax and net pay. Output everything to the screen. Use functions wherever possible. Bonus Points: Use an input file to read in an unknown...
Write the program in Java. Demonstrate that you know how to define variables, create conditional statements,...
Write the program in Java. Demonstrate that you know how to define variables, create conditional statements, write a loop, use arrays, obtain input from the user, display output, test and create a JavaDoc. Create project PaystubTest2 that is a Paystub calculator with program Paystub##.java (where ## is your initials) based on user input. (10 points) You must use the ReadStringFromUser and ReadFloatFromUser methods in the program to obtain user input. (20 points) This program will calculate the Gross Earnings, FICA...
In C++, Create a program that can try out every possible logical combination of the variables...
In C++, Create a program that can try out every possible logical combination of the variables A, B, and C, and determine which combinations will yield a true statement. Take note that there are eight different possible combinations of the three variables. Make certain you test all eight of the combinations. (1) (A and B) or (A and C) (2) (A and C) and (B and !C) (3) (A or B) and !(B or C) (4) (A or (!A and...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT