Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program using if-else statements, switch statements, and/or loops (for, while, do- while) that prints a months calendar after prompting the user inputs.

Write a C++ program using if-else statements, switch statements, and/or loops (for, while, do- while) that prints a months calendar after prompting the user inputs. Your program must validate all the user inputs (or keep prompting the user inputs until the user enters valid inputs), display a formatted calendar, ask the user if they want to print another calendar (y), repeat the program until the user enters 'n', and then exit with the final message.
Note:
You can use setw() function in the library
Program Inputs
Enter a month (1 to 12):
- If user enters an invalid option, keep displaying this prompt until a valid input is entered Enter days in the month (28, 29, 30, or 31):
- If user enters an invalid option, keep displaying this prompt until a valid input is entered Enter start day (0 to 6):
- If user enters an invalid option, keep displaying this prompt until a valid input is entered
Program Outputs
A formatted calendar is displayed according to the valid user inputs (see the sample output
below).
Would you like to print another month (y)?
- A Question for repeating (y)
- User will always enter y or n.
- If user enters y, display the initial prompt Enter a month (1 to 12): again.
- If user enters n, display the final message Thank you for using this program. Goodbye!
and terminate the program
image text in transcribed
the right track. To guarantee full credit, your program's ou below. Test Cases: Welcome to Calendar Printer! Enter a month (1 to 12): 13 Enter a month (1 to 12): 0 Enter a month (1 to 12): 1 Enter days in the month (28, 29, 30, or 31): 25 Enter days in the month (28, 29, 3e, or 31): 33 Enter days in the month (28, 29, 30, or 31): 31 Enter start day (@to 6): 6 JANUARY Sun Mon Tue Wed Thr Fri Sat 1 2 3 4 5 6 7 B 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Would you like to print another month? (y) y Enter a month (1 to 12): 2 Enter days in the month (28, 29, 30, or 31): 28 Enter start day (@to 6): 2 FEBRUARY Sun Mon Tue Wed Thr Fri Sat 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Would you like to print another month? (y) y NGON Enter a month (1 to 12): 9 Enter days in the month (28, 29, 30, or 31): 38 Enter start day (e to 6): 4 SEPTEMBER Sun Mon Tue Wed Thr Fri Sat 4 11 18 25 5 12 19 26 6 13 20 27 7 14 21 28 1 2 8 9 10 15 16 17 22 23 24 29 3e Would you like to print another month? (y) n Thank you for using this program. Goodbye

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

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

More Books

Students also viewed these Databases questions

Question

9. System creates a large, diverse talent pool.

Answered: 1 week ago