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.
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...
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....
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...
C++ Create a program that use the linkedbag 3. Develop a program to maintain a list...
C++ Create a program that use the linkedbag 3. Develop a program to maintain a list of homework assignments. When an assignment is assigned, add it to the list, and when it is completed, remove it. You should keep track of the due date. Your program should provide the following services: • Add a new assignment. • Remove an assignment. • Provide a list of the assignments in the order they were assigned. • Find the assignment(s) with the earliest...
You will create a program with 3 methods. For the previous homework with three problems, you...
You will create a program with 3 methods. For the previous homework with three problems, you will create a method for each problem. In the main method, you will declare the three arrays and create the memory space for each of them. The first method will receive a one dimension array and then it will assign the values ( e.g., a[4] = 4*4*4*4;). The second method receives a 2 dimensional array and creates the calendar. The third method receives a...
Create a C++ program that follows the specifications below: *Define a struct with 4 or more...
Create a C++ program that follows the specifications below: *Define a struct with 4 or more members. *Application must have at least one user-defined function *Declare an array of your struct using a size of 10 or more *Load the date for each element in your array from a text file *Display the data in your array in the terminal *provide brief comments for each line of code
C++ Vectors. Create a program do the following in the program: 1. declare an vector without...
C++ Vectors. Create a program do the following in the program: 1. declare an vector without specifying the size 2. use push_back to add random integers between 100 and 999 to the vector 3. write a function that returns the smallest, largest, and average of the numbers in the vector display the smallest, largest, and average of the numbers in the vector
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT