Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ language using if else statements CS 317 Time to Time Program There are times when we need to know the current time and future

image text in transcribed
c++ language using if else statements
image text in transcribed
CS 317 "Time to Time" Program There are times when we need to know the current time and future time. For example, il the current time 3:05, what time will it be 2:33 (2 hours and 33 minutes from now), answer 5:38. Also going the other way, if at 6:15 I need something done and it take 2:23 minutes of time, what time should I start. 6:16-2:23 (2 hours and 23 minutes). It would be 3:53 start time. You are to write a program that will calculate the new clock times. We will use a 24- hour clock. That is the valid times are 00:00 to 23:59. Your input will be two time values, hours and minutes. The first time will be a wall clock time. The second values will be the number of hours and minutes to either add or subtract yielding a new wall clock time. You must enter the two inputs on one line using the following format. You cannot prompt for the individual parts hours and minutes. The format given below is the input format to follow. You will print out the inputs read in and the calculations of the new wall clock time. Example: Input: Output: 15:28 +4:45 Current Time 15:20 plus 4 hr. 45 min. - Future Time 20:12 Input: 15:28 - 4:45 Future Time 15:28 minus 4 hr. 45 min. - Start Time 10:43 Restrictions: You must enter input data all on one line as given. Keep in mind that if you go pass the time 23:59 you will roll back around to 00:00 and vice versa. Input data to test. Run program multiple times. 12:15 + 6:55 00:59 + 10:01 19:10 - 10:45 20:20 + 7:50 20:20 - 20:30 CS 317 "Time to Time" Program There are times when we need to know the current time and future time. For example, il the current time 3:05, what time will it be 2:33 (2 hours and 33 minutes from now), answer 5:38. Also going the other way, if at 6:15 I need something done and it take 2:23 minutes of time, what time should I start. 6:16-2:23 (2 hours and 23 minutes). It would be 3:53 start time. You are to write a program that will calculate the new clock times. We will use a 24- hour clock. That is the valid times are 00:00 to 23:59. Your input will be two time values, hours and minutes. The first time will be a wall clock time. The second values will be the number of hours and minutes to either add or subtract yielding a new wall clock time. You must enter the two inputs on one line using the following format. You cannot prompt for the individual parts hours and minutes. The format given below is the input format to follow. You will print out the inputs read in and the calculations of the new wall clock time. Example: Input: Output: 15:28 +4:45 Current Time 15:20 plus 4 hr. 45 min. - Future Time 20:12 Input: 15:28 - 4:45 Future Time 15:28 minus 4 hr. 45 min. - Start Time 10:43 Restrictions: You must enter input data all on one line as given. Keep in mind that if you go pass the time 23:59 you will roll back around to 00:00 and vice versa. Input data to test. Run program multiple times. 12:15 + 6:55 00:59 + 10:01 19:10 - 10:45 20:20 + 7:50 20:20 - 20:30

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