Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this project, you are going to write a Java program that generates a calendar and show it in the console. Program Input Your program
In this project, you are going to write a Java program that generates a calendar and show it in the console. Program Input Your program asks the user to enter 3 input values (see below) via keyboard. - Year. The user should enter a 4-digit year (e.g 1997, 2022), which should be stored as an int. - Month. The user should enter a 1-or 2-digit month (between 1 and 12). For example, "5" means May and "11" means November. - Day-of-week of the first day of the month. The user should enter the day-of-week of the first day of "that year" (input year) "that month" (input month). The user should enter a 3-character string as a day-of-week. For example, "Mon" means Monday and "Thu" means Thursday. This input value is not ease-sensitive, which means that "Mon", "MON", and "mon" are all valid. In this project, you can assume that the user will always enter the correct day-of-week of the first day of the input year and month. You do not need to worry about incerfect input values. The output of the program is the calendar of the user input year and month. Please see the examples below to better understand the expected output format. - If we take "October 2019" as example, the expected output format in the console should be: - The calendar should be printed in an exact 27-character wide window. - First row contains the full month name, a space, and the 4-digit year. This row should be center-aligned. You need to figure out how many space characters need to be printed at the beginning of the line to make sure it is center aligned. - Second row is fixed, which includes the 3-character days-of-week separated by space. - Each column is 3-character wide and right-aligned. Therefore, you need to add spaces when necessary. Also, columns are separated by space. If the user input month is February, then your program needs to consider the leap year issue, in order to determine whether the February has 28 days or 29 days. The pseudocode algorithm to determine whether a year is a leap year is given below. if year is not divisible by 4 then (it is a common year) else if year is not divisible by 100 then (it is a leap year) else if year is not divisible by 400 then (it is a common year) else (it is a leap year) Other Development Notes - You must use loops to print the dates in the calendar. You cannot use exhaustive methed to list all the possibilities in your code. - Please note that program users cannot see or understand your code. Therefore, you need to give sufficient screen prompts to let the users clearly know what to input in each step
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started