Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

program to do the following.Ask user to enter time in the format of hh:mm:ss. For example, 11:07:28. Hour must be a two-digit number between 0

program to do the following.Ask user to enter time in the format of hh:mm:ss. For example, 11:07:28. Hour must be a two-digit number between 0 and 23, inclusive.Minute and second must be two-digit numbers between 0 and 59, inclusive.The program needs to check whether the time entered is valid.

(a) Check whether there are exactly two colons. Display an error message and stop if the input is invalid.

(b) Check whether hour is a two-digit number. Display an error message and stop if the input is invalid.

(c)Check whether minute is a two-digit number. Display an error message and stop if the input is invalid.

(d) Check whether second is a two-digit number. Display an error message and stop if the input is invalid.

(e) Check whether hour is between 0 and 23, inclusive. Display an error message and stop if the input is invalid.

(f)Check whether minute is between 0 and 59, inclusive. Display an error message and stop if the input is invalid.

(g) Check whether second is between 0 and 59, inclusive. Display an error message and stop if the input is invalid.

(h) If the time entered is valid, remove the colons and display the time.For example, if the input time is 11:07:28, the program should display 110728.

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

Transport Operations

Authors: Allen Stuart

2nd Edition

978-0470115398, 0470115394

Students also viewed these Programming questions

Question

Quiz words: crossword style quiz concerning IMC concepts

Answered: 1 week ago