Question: Write a Ct+program in main.cpp that input distance travelled by a car (int) in kilometers and total time in minutes (int). the program then calculates

Write a Ct+program in main.cpp that input distance travelled by a car (int) in kilometers and total time in minutes (int). the program then calculates and prints the speed (measured in kilometers per hour (km/h)) using the following formula: Speed = distance/time. You need to convert the time into hours (floating point) ( 1 hour =60 minutes). Display the correct message as shown in the sample output, if the speed is greater than 120 , it prints a traffic speed violation". otherwise, it prints "no traffic speed violation". Test the program with the input as shown below in the sample input / output. When you are done: Download your code. It wili save the file main..pp and rename the flle to Lab4. Ex2.cpp. This is very important so that you can always access the code later. How to Subbit: Select al1 the code using ctr1 + A I Cind + A. Copy the code using Ctrl + Cl Cand + C. Paste the code in the answer box using Ctr1 +v C Cand +v on the blackboard. Ignore if the fonnatting of the code is different. Move to the next question or press the Save and submit button. Sample Input / output: Ignore if the formatting of the code is different. Move to the next question or press the Save and Submit button. Sample: Input / output: Enter distance in kilometers: 80 Enter time in minutes: 40 time in hours 1s0.666667 speed is 120km/h no traffic speed violation Enter distance in kilometers: 80 Enter time in minutes: 38 time in hours is 0.633333 speed is 126km/h traffic speed violation Enter distance in kilometers: 100 Enter time in minutes: 80 time in hours is 1.33333 speed is 75km/h no traffic speed violation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
