Question: please help me fill the code of assignment5. import java.io.*; //to use InputStreamReader and BufferedReader import java.util.*; //to use ArrayList public class Assignment5 { public


![{ public static void main (String[] args) { char input1; String inputInfo](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3c96688632_83866f3c9660827a.jpg)





please help me fill the code of assignment5.
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
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 /** 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 "); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
