Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Requirements/PROMPT: /*********************************************** * Your Header Goes Here **********************************************/ import java.util.Scanner; public class PrintCalendar { /*The main method has only one line of code and it

image text in transcribed

Requirements/PROMPT:

/***********************************************

* Your Header Goes Here

**********************************************/

import java.util.Scanner;

public class PrintCalendar

{

/*The main method has only one line of code and it calls the process

method

You do not need to change anything in this method*/

public static void main(String[] args)

{

process();

}

/*This method ask the required info and calls the appropriate methods

based on the user's input to either print

the calendar for the month or for the year. You can declare your

Scanner object in this method since it

will only be used here */

public static void process()

{

}

//this method prints the body of the calender for the given month by

calling the the methods printMonthTable and printMonthBody

public static void printMonth(int year, int month)

{

printMonthTitle(year, month);

printMonthBody(year, month);

}

//this method prints the title of the days in each week(sunday Mon Tues

Wed Thur Fir Sat)

/*This method prints the following

month name year

----------------------------

Sun Mon Tue Wed Thu Fri Sat

this method gets the month as an integer and you need to call the

appropriate method to get the name of the month*/

public static void printMonthTitle(int year, int month)

{

}

/*this method calls the method getStartday to find out the first day of

the month(sunday, monday, tuesday, wednesday, thursday or friday

then it calls the method print by passing the startday, year and

month*/

public static void printMonthBody(int year, int month)

{

}

/*This method prints the days in the month, you will need to call the

getNumberOfDaysInMonth method

to get the appropriate number of days and you will also need to print

out the day that Thanksgiving

is on if the month is November (using the thanks method)*/

public static void print(int startDay, int year, int month)

{

}

/*This method finds out the day of thanksgiving

you must use switch statements . Thanksgiving is the last Thursday of

November therefore we need to add a value to 21.

for example if the first of the month is sunday then from sunday to

thurday is 5 days, then we add 5 to 21 and that would be the thanksgiving

day.

The first day of November 2018 is Thursday and so thanksgiving will be

on 1 + 3 * 7 = 22*/

public static int thanks(int startDay)

{

return 0;

***********************************************************************************************************************************************************

SAMPLE OUTPUT:

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Problem Write a program that prints the calendar for a given year or a given month. The user will be given the option of printing the calendar for the whole year or just a month. If the calendar for the whole year is being printed then the data for thanksgiving must be specified. You are required to create multiple methods. Also you need to consider if the year is a leap year or not. Sample Output: output.txt Shell: PrintCalendar.java How to proceed to solving this problem 1. You need to find out how many days has passed since Jan 1800 up to the given year. You must check if the year is a leap year or not to know the number of the days in February 2. You need to find out the first day of the month for each given month which is going to be Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday 3. You need to find out the Thanksgiving Day for the given year 4. Now you are ready to print the calendar. 5. Refer to the provided shell for more details Requirements: 1. Must implement all the provided methods in the shell 2. Your program must work for a leap year as well 3. Your program must output a description indicating what the program does 4. Naming conventions 5. Indentation 6. Proper way of calling methods 7. Use of conditional statements 8. You are allowed to be creative by adding more functionality to your program 9. You can deviate from the provided shell and create your own solution. However you must use ample number of methods

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_2

Step: 3

blur-text-image_3

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

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

Students also viewed these Databases questions

Question

what is secure code

Answered: 1 week ago