MonthlyCalendar

MonthlyCalendar - public class MonthlyCalendar cfw_ public...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
public class MonthlyCalendar { public static void main(String[] args) { final int[] daysPerMonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; final String noAppt = "no appointment"; System.out.print("For which month would you like to keep a calendar (1- 12)? "); int month = IO.readInt(); if (month < 1 || month > 12) { System.out.println("That is not a valid month."); IO.reportBadInput(); return; } int daysThisMonth = daysPerMonth[month-1]; String[] apptDescription = new String[daysThisMonth+1]; System.out.print("On what day of the week does the month start (0-6)? "); int firstDayOfWeek = IO.readInt(); if (firstDayOfWeek < 0 || firstDayOfWeek > 6) { System.out.println("That is not a valid day of week."); IO.reportBadInput(); return; } while (true) { System.out.println(); System.out.println("Menu:"); System.out.println("1. Make appointment on a specific date"); System.out.println("2. Make repeating appointment"); System.out.println("3. Make appointment on next available weekday"); System.out.println("4. Look up appointment on a specific date"); System.out.println("5. Look up date of an appointment"); System.out.println("6. Cancel appointment on a specific date");
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

MonthlyCalendar - public class MonthlyCalendar cfw_ public...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online