Question: Create a new program, add_hms12.c, that will extend your existing program to work with a 12 hour clock rather than a 24 hour clock. The

Create a new program, add_hms12.c, that will extend your existing program to work with a 12 hour clock rather than a 24 hour clock. The program will accept the initial times using a 24 hour clock, as before, but will print out the results using a 12 hour clock that appends "AM" or "PM" to the times. Execution and Output Example (Multiple runs of the program): Enter an initial 24-hour time as hours minutes and seconds: 7 30 50 Enter the time to add as hours minutes and seconds: 1 29 50 Total is 9:00:40 AM Enter an initial 24-hour time as hours minutes and seconds 7 30 O Enter the time to add as hours minutes and seconds: 500 Total is 12:30:00 PM Enter an initial 24-hour time as hours minutes and seconds: 7 30 Enter the time to add as hours minutes and seconds: 25 30 Total is 9:00:00 AM tomorrow Enter an initial 24-hour time as hours minutes and seconds 7 30 Enter the time to add as hours minutes and seconds: 49 30 Total is 9:00:00 AM in 2 days AT-HOME REFLECTION (30%) In a text file named reflect.txt, answer the following Explain how modulus is used in your calculations. Describe one other technique for performing the calculations and compare it to the use of modulus. Does modulus simplify the calculations? Adding times is similar to adding two 3 digit numbers. You add them digit by digit and, when the sum exceeds 9, you do a carry. Explain how adding number is similar to adding times and where the two techniques differ and why. Assume that, instead of adding hours, minutes and seconds, you need to add years, months and days. What new problems would you encounter solving this problem that you did not have to worry about in the addition of times? Describe how you would solve these problems. Create a new program, add_hms12.c, that will extend your existing program to work with a 12 hour clock rather than a 24 hour clock. The program will accept the initial times using a 24 hour clock, as before, but will print out the results using a 12 hour clock that appends "AM" or "PM" to the times. Execution and Output Example (Multiple runs of the program): Enter an initial 24-hour time as hours minutes and seconds: 7 30 50 Enter the time to add as hours minutes and seconds: 1 29 50 Total is 9:00:40 AM Enter an initial 24-hour time as hours minutes and seconds 7 30 O Enter the time to add as hours minutes and seconds: 500 Total is 12:30:00 PM Enter an initial 24-hour time as hours minutes and seconds: 7 30 Enter the time to add as hours minutes and seconds: 25 30 Total is 9:00:00 AM tomorrow Enter an initial 24-hour time as hours minutes and seconds 7 30 Enter the time to add as hours minutes and seconds: 49 30 Total is 9:00:00 AM in 2 days AT-HOME REFLECTION (30%) In a text file named reflect.txt, answer the following Explain how modulus is used in your calculations. Describe one other technique for performing the calculations and compare it to the use of modulus. Does modulus simplify the calculations? Adding times is similar to adding two 3 digit numbers. You add them digit by digit and, when the sum exceeds 9, you do a carry. Explain how adding number is similar to adding times and where the two techniques differ and why. Assume that, instead of adding hours, minutes and seconds, you need to add years, months and days. What new problems would you encounter solving this problem that you did not have to worry about in the addition of times? Describe how you would solve these problems
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
