

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Problem Description Write a program that will prompt the user to enter the number of a month (1=jan, 2=feb โฆ 12=dec) and a year (4 digits from 1000 to 9999, ex: 2008 not 08). If both inputs are valid the program will compute and output the number of days in the given month, the name of month, and the year. Make sure to account for the month of February in leap years. See sample output format (with proper month used) on next page Code Requirements: It is expected that your program will use a switch expression (based on user input month number) to determine how many days there are in the given month and the month name. The 2-case (February) will require you to determine if the input year is a leap year and assign the number of days accordingly. The code to do this can be found in chapter 3 (pg 72). Error Checking: If the user inputs a year that is outside of the range 1000-9999, the program should output an error message and terminate. If the user inputs a month outside of the range 1-12, the program should output an error message and terminate. You can use the default case of the switch expression to handle errors in input for the month number. You are not expected to handle error cases of non-int String input. Problem Analysis Input: Month (number 1-12) and year (4 digit). Process: Determine how many days there are in that month and the name of the month. Output: Number of days, name of the month, year. Pseudocode
Variable Name Type Usage Test Design (To be completed by hand before program implementation. Use this to verify program output) Test Case month number year number of days name of month 1 2