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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!