Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

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

The Power Of Numbers In Health Care A Students Journey In Data Analysis

Authors: Kaiden

1st Edition

8119747887, 978-8119747887

More Books

Students also viewed these Databases questions