Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions

Question

Discuss the history of human resource management (HRM).

Answered: 1 week ago