Assignment10 - Assignment 10 Name Steven Carr StudentID Lab Lecture MWF 11:50 Description The Assignment 10 class displays a menu of choices to a user

Assignment10 - Assignment 10 Name Steven Carr StudentID Lab...

This preview shows page 1 - 2 out of 2 pages.

// Assignment #: 10 // Name: Steven Carr // StudentID: // Lab Lecture: MWF 11:50 // Description: The Assignment 10 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 java.io.*; public class Assignment10 { public static void main(String[] args) { char input1; String inputInfo = new String(); int operation2; String line = new String(); //create a linked list to be used in this method. LinkedList list1 = new LinkedList(); try { // print out the menu printMenu(); // create a BufferedReader object to read input from a keyboard InputStreamReader isr = new InputStreamReader (System.in); BufferedReader stdin = new BufferedReader (isr); do { System.out.print("What action would you like to perform?\n"); line = stdin.readLine().trim(); //read a line input1 = line.charAt(0); input1 = Character.toUpperCase(input1); if (line.length() == 1) //check if a user entered only one character { switch (input1) { case 'A': //Add String System.out.print("Please enter a string to add:\n"); String str1 = stdin.readLine().trim();

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture