Answer to Question #250955 in C++ for Phenominal1

Question #250955
A car completes its journey in three parts. It travels the first X km of its journey at an average
speed of x_Speed m/s and the next Y km at an average speed of y_Speed km/h. The car completes the
last part of its journey at an average speed of z_Speed km/h in z_Minutes minutes. Here X, x_Speed, Y,
y_Speed, z_Speed, and z_Minutes are all variables whose values you will have to take as an input from the
user. Find the average speed for its entire journey, giving your answer in km/h.
à ƒ ƒ °  ‘ à ƒ ƒ °  ‘ Ãƒ ƒ ƒ °  ‘ ’à ƒ ƒ °  ‘ ’à ƒ ƒ °  ‘ ‘ =à ƒ ƒ °  ‘ ‘à ƒ ƒ °  ‘ –à ƒ ƒ °  ‘ à ƒ ƒ °  ‘ ¡Ãƒ ƒ ƒ °  ‘ ŽÃƒ ƒ ƒ °  ‘ ›Ãƒ ƒ ƒ °  ‘ Ãƒ ƒ ƒ °  ‘ ’ /à ƒ ƒ °  ‘ ¡Ãƒ ƒ ƒ °  ‘ –à ƒ ƒ °  ‘ šÃƒ ƒ ƒ °  ‘ ’
1
Expert's answer
2021-10-13T20:36:10-0400
#include <iostream>
using namespace std;
int main(){
    float X, x_Speed, Y, y_Speed, z_Speed, z_Minutes;
    cout<<"Input X (km): ";
    cin>>X;
    cout<<"Input x_Speed (m/s): ";
    cin>>x_Speed;
    cout<<"Input Y (km): ";
    cin>>Y;
    cout<<"Input y_Speed (km/h): ";
    cin>>y_Speed;
    cout<<"Input z_Speed (km/h): ";
    cin>>z_Speed;
    cout<<"Input z_Minutes: ";
    cin>>z_Minutes;


    float total_distance = X + Y + z_Speed * z_Minutes/60;
    float total_time = X / (x_Speed * 3600/1000) + Y / y_Speed + z_Minutes/60;
    cout<<"Average speed in km/h = "<< total_distance/total_time<<endl;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS