Write a program that asks the user to enter the initial velocity (u) in miles/ho
ID: 669718 • Letter: W
Question
Write a program that asks the user to enter the initial velocity (u) in miles/hour, final velocity (v) in miles/hour and the time taken to achieve final velocity (t) in hours when he/she is travelling in their car. Calculate the acceleration (a) of their car in miles/hours2 and display the result. Confine your output to 1 decimal place. Use the following equation to calculate the acceleration a = v-u/t Next, using the fact that one mile is about 1609.34 meters and one hour is 3600 seconds, it should convert the miles/hours2 value to a meters/sec2, and display the result, showing 5 decimal places. Use symbolic constants (using const or #define) for the two conversion factors in your program. Example output (user input is bold) Please enter the initial velocity in miles/hour: 35.0 Please enter the final velocity in miles/hour: 45.0 Please enter the total time to achieve final velocity in hours: 0.2 Your acceleration in miles/hourA2 is 50.0 miles-per-square hour. Your acceleration in meters/secA2 is 0.00620 meters-per-square second. Don't forget to submit the c/*.cpp file which contains your source code!Explanation / Answer
#include <iostream>
#include <queue>
using namespace std;
int main ()
{
float v,u,a,t;
cout << "Please enter the initial velocity in miles/hour ";
cin >> u;
cout << "Please enter the final velocity in miles/hour ";
cin >> v;
cout << "Please enter the total time to achieve final velocity in hour ";
cin >> t;
a = (v-u)/t;
cout <<"Your acceleration in miles/hour^2 is " << a << " miles-per-square hour ";
a = (a*1609.34)/(3600*3600);
cout <<"Your acceleration in metres/seconds^2 is " << a << " meters-per-square second ";
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.