Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions

Question

=+Where does the focus of labor relations lie? Is it collective

Answered: 1 week ago

Question

=+With whom does the firm have to negotiate?

Answered: 1 week ago