Question: Please help me finish this with these requirements. Below is the text of assignment 5 that you need to completed as well. import java.io.*; //to

 Please help me finish this with these requirements. Below is thetext of assignment 5 that you need to completed as well. importjava.io.*; //to use InputStreamReader and BufferedReader import java.util.*; //to use ArrayList publicclass Assignment5 { public static void main (String[] args) { char input1;String inputInfo = new String(); String line = new String(); boolean operation;// ArrayList object is used to store lamp objects ArrayList lampList =new ArrayList(); try { printMenu(); // print out menu // create aBufferedReader object to read input from a keyboard InputStreamReader isr = newInputStreamReader (System.in); BufferedReader stdin = new BufferedReader (isr); do { System.out.println("What actionwould you like to perform?"); line = stdin.readLine().trim(); input1 = line.charAt(0); input1= Character.toUpperCase(input1); if (line.length() == 1) { switch (input1) { case 'A'://Add Lamp System.out.print("Please enter a lamp information to add: "); inputInfo =stdin.readLine().trim(); /*********************************************************************************** *** ADD your code here to create an object ofPlease help me finish this with these requirements. Below is the text of assignment 5 that you need to completed as well.

import java.io.*; //to use InputStreamReader and BufferedReader import java.util.*; //to use ArrayList

public class Assignment5 { public static void main (String[] args) { char input1; String inputInfo = new String(); String line = new String(); boolean operation;

// ArrayList object is used to store lamp objects ArrayList lampList = new ArrayList();

try { printMenu(); // print out menu

// create a BufferedReader object to read input from a keyboard InputStreamReader isr = new InputStreamReader (System.in); BufferedReader stdin = new BufferedReader (isr);

do { System.out.println("What action would you like to perform?"); line = stdin.readLine().trim(); input1 = line.charAt(0); input1 = Character.toUpperCase(input1);

if (line.length() == 1) { switch (input1) { case 'A': //Add Lamp System.out.print("Please enter a lamp information to add: "); inputInfo = stdin.readLine().trim(); /*********************************************************************************** *** ADD your code here to create an object of one of child classes of Lamp class *** and add it to the lampList ***********************************************************************************/ Lamp lamp = LampParser.parseStringToLamp(inputInfo); lampList.add(lamp); break; case 'C': //Compute Total Prices /*********************************************************************************** *** ADD your code here to compute the total price for each lamp in the lampList. ***********************************************************************************/ for(int i =0; i

} if (operation == true) System.out.print("lamp found "); else System.out.print("lamp not found "); break; case 'L': //List Lamps /*********************************************************************************** *** ADD your code here to print out all lamp objects. If there is no lamp, *** print "no lamp " ***********************************************************************************/ for(int i = 0; i

} if(lampList.size()==0) System.out.print("no lamp "); break; case 'Q': //Quit break; case '?': //Display Menu printMenu(); break; default: System.out.print("Unknown action "); break; } } else { System.out.print("Unknown action "); } } while (input1 != 'Q'); // stop the loop when Q is read } catch (IOException exception) { System.out.println("IO Exception"); } }

/** The method printMenu displays the menu to a use **/ public static void printMenu() { System.out.print("Choice\t\tAction " + "------\t\t------ " + "A\t\tAdd Lamp " + "C\t\tCompute Total Prices " + "D\t\tSearch for Lamp " + "L\t\tList Lamps " + "Q\t\tQuit " + "?\t\tDisplay Help "); } }

Minimal Submitted Files You are required, but not limited, to turn in the following source files: Assignment5.java (Download this file and use it as your driver program for this assignment. You need to add more codes to complete it.) Lamp.java FluorescentLamp.java LEDLamp.java LampParser.java

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!