Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C programming PART 1: Write a program, raceTimes.c, that starts by asking the user to enter the time a race starts. Print the following message:

C programming

PART 1: Write a program, raceTimes.c, that starts by asking the user to enter the time a race starts. Print the following message: Enter the start time (hr:min): Assume the user enters 1:12, this is what the screen should look like: ( means hitting the enter key) Enter the start time (hr:min): 1:12 Read the time as an integer for the hour and an integer for the minute and store it in fractional hours as a double . You can combine the two numbers using the formula: time = hour + (minute / 60.0) You will then read the finish time and print out the elapsed time for the race by subtracting the times and converting the fractional time back to hours and minutes.

Execution and Output Example: Enter the start time (hr:min): 1:12 Enter the finish time (hr:min): 2:20 start at 1:12, finish at 2:20, elapsed = 1:08

PART 2: Edit and upgrade raceTimes.c so that it can handle a race with 3 laps, where it prints the times for each lap and finally, the times for the entire race. Execution and Output Example: Enter the start time (hr:min): 1:10 Enter the time for lap 1 (hr:min): 1:42 Enter the time for lap 2 (hr:min): 2:12 Enter the time for lap 3 (hr:min): 2:50 Lap Start Finish Elapsed 1 1:10 1:42 0:32 2 1:42 2:12 0:30 3 2:12 2:50 0:38 ALL 1:10 2:50 1:40

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

More Books

Students also viewed these Databases questions