Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a program that will allow the user to input a date value to three variabl

ID: 673485 • Letter: D

Question

Design a program that will allow the user to input a date value to three variables for month, day and a 4 digit calendar year. Validate the data so that month is 1-12 and so that the day is not less than 1 and not greater than the number of days for the corresponding month. Call a function that returns a value of true if the year is a leap year and false otherwise if the month is February in order to validate the day. Display a message to the user that confirms the validity of the date or the error that occured.

A leap year is one that can be evenly divided by 4 unless it is also divisible by 100 OR it is evenly divisible by 400.

This is should to be written in pseudocode

Explanation / Answer

1. Start.

2. Read month.

3. If month < 1 or month > 12 go to step 20.

4. Read day.

5. If month == 1 and (day < 1 or day > 31) goto step 20.

6. If month == 2 goto step 17.

7. If month == 3 and (day <1 or day > 31) goto step 20.

8. If month == 4 and (day < 1 or day > 30) goto step 20.

9. If month == 5 and (day < 1 or day > 31) goto step 20.

10. If month == 6 and (day < 1 or day > 30) goto step 20.

11. If month == 7 and (day < 1 or day > 31) goto step 20.

12. If month == 8 and (day < 1 or day > 31) goto step 20.

13. If month == 9 and (day < 1 or day > 30) goto step 20.

14. If month == 10 and (day < 1 or day > 31) goto step 20.

15. If month == 11 and (day < 1 or day > 30) goto step 20.

16. If month == 12 and (day < 1 or day > 31) goto step 20.

17. Read year.

18. Display "The entered date is valid."

19. Goto step 21.

20. Display "The entered date is INVALID."

21. Stop.

22. If year % 4 == 0 and (day < 1 or day >29 ) goto step 20.

23. If (day < 1 or day >28) goto step 20.

24. Goto step 18.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote