Letters - if (num == 5)...

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 Letters { public static void main(String[] args) { String letter; letter = JOptionPane.showInputDialog("Enter a Number, 1,2,3,4,5,6,or 7,8"); int num; num = Integer.parseInt(letter); if (num == 1) JOptionPane.showMessageDialog(null,"1-A"); if (num == 2) JOptionPane.showMessageDialog(null,"2-B"); if (num == 3) JOptionPane.showMessageDialog(null,"3-C"); if (num == 4) JOptionPane.showMessageDialog(null,"4-D");
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 (num == 5) JOptionPane.showMessageDialog(null,"5-E"); if (num == 6) JOptionPane.showMessageDialog(null,"6-F"); if (num == 7) JOptionPane.showMessageDialog(null,"7-G"); if (num == 8) JOptionPane.showMessageDialog(null,"8-H"); else if (num>8&&num<0) JOptionPane.showMessageDialog(null, "Sorry, the number you entered is invalid"); System.exit(0); }}...
View Full Document

This note was uploaded on 10/04/2010 for the course COMPUTER S 106 taught by Professor Moore during the Spring '08 term at Clark Atlanta.

Ask a homework question - tutors are online