Assignment11 - if (line.length() == 1) { // matches one of...

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

View Full Document Right Arrow Icon
// Assignment #: 11 // Name: Your McCabe // StudentID: 1200214441 // Lecture: 10AM // Description: Assignment 11 class displays a menu of choices to a user // and performs the chosen task. It will keep asking a user to // enter the next choice until the choice of 'Q' (Quit) is entered. / import*; public class Assignment11 { public static void main (String[] args) throws IOException { char input1; String inputInfo; String line = new String(); printMenu(); InputStreamReader isr = new InputStreamReader(; BufferedReader stdin = new BufferedReader(isr); do // will ask for user input { System.out.println("What action would you like to perform?"); line = stdin.readLine(); input1 = line.charAt(0); input1 = Character.toUpperCase(input1);
Background image of page 1

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

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

Unformatted text preview: if (line.length() == 1) { // matches one of the case statements switch (input1) { case 'E': //Enter String System.out.print("Please enter a string.\n"); inputInfo = stdin.readLine().trim(); System.out.println(PostfixConversion.convertToPostfix(inputInfo)); break; case 'Q': //Quit break; case '?': //Display Menu printMenu(); break; default: System.out.print("Unknown action\n"); break; } } else { System.out.print("Unknown action\n"); } } while (input1 != 'Q' || line.length() != 1); } /** The method printMenu displays the menu to a user**/ public static void printMenu() { System.out.print("Choice\t\tAction\n" + "------\t\t------\n" + "E\t\tEnter String\n" + "Q\t\tQuit\n" + "?\t\tDisplay Help\n\n"); } }...
View Full Document

This note was uploaded on 09/20/2009 for the course CSE 205 taught by Professor Matasu during the Spring '08 term at ASU.

Page1 / 2

Assignment11 - if (line.length() == 1) { // matches one of...

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