PrintCalendar - /*Trinity Martin *IT 218 *week 04 *Lab...

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

View Full Document Right Arrow Icon
/**Trinity Martin *IT 218 *week 04 *Lab *This program prints a calender after prompting the user with a dialog box *to enter the year and number for month,it displays the result in a dialog box*/ * import javax.swing.JOptionPane; i public class printCalender { static String output = ""; public static void main(String[] args) { // Prompt the user to enter year String yearString = JOptionPane.showInputDialog(null, "Enter full year (i.e. 2001):", "Example 4.6 Input", JOptionPane.QUESTION_MESSAGE); int year = Integer.parseInt(yearString); // Prompt the user to enter month String monthString = JOptionPane.showInputDialog(null, "Enter month in number between 1 and 12:", "Example 4.6 Input", JOptionPane.QUESTION_MESSAGE); int month = Integer.parseInt(monthString); printMonth(year, month); JOptionPane.showMessageDialog(null, output); } static void printMonth(int year, int month) { // Get start day of the week for the first date in the month int startDay = getStartDay(year, month); // Get number of days in the month
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 / 3

PrintCalendar - /*Trinity Martin *IT 218 *week 04 *Lab...

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