Question
Overview: In this lab you are to write a Java program to prompt the user for an integer indicating a year and then print the
Overview:
In this lab you are to write a Java program to prompt the user for an integer indicating a year
and then print the calendar for that year.
Objective:
This lab's objective is to exercise you with the use of Javas control statements. You are
required to use exactly one while statement, one for statement and one switch statement.
You will also practice on how to use some basic input methods of the Scanner class and some
formatting techniques of method printf().
Activities:
1. The JulianDate class is used to determine the day of the week for the 1st day
of January.
JulianDate JD = new JulianDate();
int date = JD.toJulian(yr,1,1);
int dayOfWeek = (date+1)%7; // 0 means Sunday, 1 means Monday, etc.
2. Notes:
1. No arrays are allowed in this lab.
2. Your output should be closely similar to the output of the instructors sample program.
3. To determine whether a year is a leap year or not:
a. If the year is a century year, the year must be divisible by 400.
b. If the year is not a century year, the year only needs to be divisible by 4.
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