Question
Using C++. and using if statements, if else statements, nested if statements, or if/ else if statements. In late March I am taking part in
Using C++. and using if statements, if else statements, nested if statements, or if/ else if statements.
In late March I am taking part in the Vibe 5K Color Run. Write a program that asks for the names of three runners on my team, Team 12:11. The program also needs to ask if the runner that is entered has ran this race before, if the runner has then the program should ask for the time it took them to finish the race the previous time, and this time. If the runner has not ran the race before the program should only ask for the current time that it took them to finish the race. The program should display who came in first, second, and third place (this will be a long set of if/else statements with possible nesting). If a runner ran the race last year the program should also display if that runner improved their time or not and what their average time is.
Time should be entered in the form of seconds. Your program should display their time in the end based on the following (hint: refer to problem 1, except this time you must consider the remaining seconds):
There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes in that many seconds, and any remaining seconds.
Example: User enters 95 seconds. The program will display 1 minutes and 35 seconds.
There are 3,600 seconds in an hour. If the number of seconds entered by the user is greater than or equal to 3,600, the program should display the number of hours, minutes and seconds.
Example: User enters 3,661 seconds. The program will display 1 hour 1 minute and 1 second.
Hint: There will be some repetition to writing this program. You are not allowed to use loops! Figure out how to get the program to work properly for one runner and then figure out the other two. Suggestion is to leave the display of first, second, and third as the last thing that you do.
Input Validation: Only accept positive numbers for the times.
You should have a minimum of two screen shots, you should have the following:
1. an input of a negative time to show that your program ends due to invalid input
2. have at least one of your runners to have ran the race last year and this year
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started