Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Programming. Please help with this problem. None of the answers posted already are answering the question. There is a belief that if at any

C++ Programming.

Please help with this problem. None of the answers posted already are answering the question.

There is a belief that if at any time a person takes a look at a digital clock (with standard time), and if the digits of the hours and minutes add up equally for the two parts, it is a good time, or actually a lucky time that will predict or is a forecast that whatever you were thinking/ wishing at that instant, might come true. (Note: In that belief, all other times should be viewed as normal time.)

For example, 12:03, 12:30, 4:04, 4:13, or 4:31 are considered as lucky times.

Besides that, there are three other special times that also carry specific meanings:

If all digits are the same, like 4:44, or 5:55. It predicts you might win a lottery.

If all digits are in ascending order, like 3:45, or 4:56. It predicts all dreams will come true.

If all digits are in descending order, like 3:21, or 6:54. It predicts challenging road is ahead.

Write a C++ program that asks the user to enter a time in the format HH:MM, then the program will tell if the time is a lucky time or just a normal time. And then, in addition, if the time carries a specific meaning, as described above, the corresponding meaning will be displayed along.

Allow your program continuously run as long as the user wishes to test it with other times.

Finally, your name as the programmer must be displayed on the screen as well at the end of the program (that meant ONE time only at the termination of execution of the program).

Note: Youre not allowed to hardcode exactly the entered time and its corresponding meaning.

Input validation:

Dont accept unreasonable time, or junk values, which must be rejected, with an error message, and asked for another one.

See sample run in the attachment (Digital Clock.zip - extract it before running).

Required Input/Output: (bold character(s) for Input)

Enter a time (HH:MM): 12:56

12:56 is a normal time.

Run again (y/n)? y

Enter a time (HH:MM): 3:21

3:21 is a lucky time. -> DOWN! Challenging road is ahead.

Run again (y/n)? y

Enter a time (HH:MM): 4:56

4:56 is a normal time. -> UP! All dreams will come true.

Run again (y/n)? y

Enter a time (HH:MM): 5:55

5:55 is a normal time. -> BINGO! Go to buy a lottery ticket.

Run again (y/n)? n

Programmer: Your Full Name

Good bye! Press key to end the program...

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

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Sham Navathe

4th Edition

0321122267, 978-0321122261

More Books

Students also viewed these Databases questions

Question

8. Describe the steps in the development planning process.

Answered: 1 week ago