Question
Write a program called hw2_2.cpp (or hw2_2.java) that reads two timestamps of two events from a user and displays the difference between the two timestamps.
Write a program called hw2_2.cpp (or hw2_2.java) that reads two timestamps of two events from a user and displays the difference between the two timestamps. For the program, you can assume that each timestamp is composed of the hour (0 ~ 23), minute (0 ~ 59), and second (0 ~ 59) format. Your program should present the difference from the second event (= second timestamp) to the first event (= first timestamp). Note that the second event always happens after the first event and your program should display the time difference of the events.
Sample Run 0: Assume that the user typed the following two lines.
18:45:30
20:50:59
This is the correct output of your program.
02:05:29
Sample Run 1: Assume that the user typed the following two lines.
20:18:59
04:25:17
This is the correct output of your program.
08:06:18
Sample Run 2: Assume that the user typed the following two lines.
02:00:25
15:30:00
This is the correct output of your program.
13:29:35
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