WeekDay - if (weekIf == 4)...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import javax.swing.JOptionPane; public class WeekDay { public static void main(String[] args) { String dayNumber; dayNumber = JOptionPane.showInputDialog("Enter a Number for the Day of the Week, 1,2,3,4,5,6,or 7."); int weekIf; weekIf = Integer.parseInt(dayNumber); if (weekIf == 1) JOptionPane.showMessageDialog(null,"Today is Sunday!"); if (weekIf == 2) JOptionPane.showMessageDialog(null,"Today is Monday!"); if (weekIf == 3) JOptionPane.showMessageDialog(null,"Today is Tuesday!");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if (weekIf == 4) JOptionPane.showMessageDialog(null,"Today is Wednesday!"); if (weekIf == 5) JOptionPane.showMessageDialog(null,"Today is Thursday!"); if (weekIf == 6) JOptionPane.showMessageDialog(null,"Today is Friday!"); if (weekIf == 7) JOptionPane.showMessageDialog(null,"Today is Saturday!"); else if (weekIf>7) JOptionPane.showMessageDialog(null, "Sorry, the number you entered is invalid"); System.exit(0); }}...
View Full Document

Ask a homework question - tutors are online