So i have an assignment. I would like it it someone could write code for the criteria of each question, shits got me so confused right now.
A. The kinetic energy of a moving object is found using the following equation: K=(1/2)(MV2)
Where: K is the kinetic energy in kgm/s
M is the mass in kilograms
V is the velocity, in meters per second
Write a complete program that accepts inputs of mass and velocity of an object from the user and determines the kinetic energy. Display the mass, velocity, and kinetic energy at the end of the program. To test your program, execute the program using m=200kg, v=3.7 m/s and then execute it again using m=925kg, v=8m/s.
B. Write a complete program that will calculate the equivalent resistance from two parallel resistances entered by the user. Use the following formula to calculate the equivalent resistance. Output the two parallel resistances and the equivalent resistance at the end of the program. Test your program by executing it using R1=67.27, R2=64.5.
Requiv = (R1 * R2)/(R1 + R2)
C. Write a program that lets the user enter the magnitude of the Resultant force (R) and the angle this force makes with the x axis (Θ). The program should then calculate the rectangular x and y components of this force using:
X component = RcosΘ and Ycomponent=RsinΘ
Test your program using these values;
a. R=2000N Angle=35 degrees
b. R=500N Angle=120 degrees
D. Write a program to ask the user to enter 6 values for X. Then evaluate the following equation for each value of X. Output each X value and its corresponding Y value. Here’s the equation: Y=(9/5)X2 – (1/2)X + 2
For the first run, use X values of 11,12,13,14,15,16
For the second run, use X values of -3.6, -3.1, -2.9, -2.4, -1.8, -1.7
#include <iostream>
usingnamespace std;
int main()
{
//Question A
double mass; //declare the variable for mass
double velocity; //declare the variable for velocity
cout << "Enter the Mass(kg): "; //Output message for the user
cin >> mass; //Get input from user
cout << "Enter the Velocity(m/s): ";//Output message for the user
cin >> velocity; //Get input from user
cout << "=============" << endl; //Output message for the user
cout << "Mass: " << mass << endl;//Output message for the user, and display the mass input by the user
cout << "Velocity: " << velocity << endl;//Output message for the user, and display the velocity input by the user
cout << "Kinetic Energy: " << mass*velocity*velocity*0.5 << endl;//Output message for the user, and display the calculation
system("pause");
return 0;
}
cout<<"Enter a number for A";
cin>>A;
cout<<"Enter a number for B";
cin>>B;
cout<<"Enter a number for C";
cin>>C;
cout<<"Enter a number for D";
cin>>D;
cout<<"When your numbers are applied to the formula you get ";
cout<< A*(B+C)-pow(D,3)<<" ";
//spaces are to pretty it up
system("pause");
}
when i enter 7.3 for A it gives me an error