Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

here the starting code import java.io.*; //to use InputStreamReader and BufferedReader import java.util.*; //to use ArrayList public class Assignment5 { public static void main (String[]

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
here the starting code
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 SummerCamp objects ArrayList summerCampList = 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 SummerCamp System.out.print("Please enter some summer camp information to add: "); inputInfo = stdin.readLine().trim(); /*********************************************************************************** *** ADD your code here to create an object of one of child classes of SummerCamp class *** and add it to the summerCampList ***********************************************************************************/ break; case 'C': //Compute Total Costs for all camps /*********************************************************************************** *** ADD your code here to compute the total costs for each camp in the summerCampList. ***********************************************************************************/ System.out.print("total costs computed "); break; case 'D': //Search for SummerCamp System.out.print("Please enter a summer camp title to search: "); inputInfo = stdin.readLine().trim(); operation = false; /*********************************************************************************** *** ADD your code here to search a summer camp with the entered title and set operation *** to true or false based on its result ***********************************************************************************/ if (operation == true) System.out.print("SummerCamp found "); else System.out.print("SummerCamp not found "); break; case 'L': //List SummerCamps /*********************************************************************************** *** ADD your code here to print out all camp objects. If there is no camp, *** print "no summer camp " ***********************************************************************************/ 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 user **/ public static void printMenu() { System.out.print("Choice\t\tAction " + "------\t\t------ " + "A\t\tAdd SummerCamp " + "C\t\tCompute Total Costs " + "D\t\tSearch for SummerCamp " + "L\t\tList SummerCamps " + "Q\t\tQuit " + "?\t\tDisplay Help "); } } 

+ Get more studenog.com SE26 D roomt 20 ct-rated Programa 20 Sorg 23-1270002 . -a-car . co2 -es The following methods should be implemented: public void compute TotalCosta) This method should update its totalCost as follows. Its basic total cost is computed as weekly Rate numberor Weeks. If op Discount is true, then it should get a 10% discount, ie, weekly Rae numberor Weeks should be multiplied by (0-9). Then at last, the materiale should be added to it. Also, the following method should be implemented public String toString) The toString method inherited from Summer Campclass should be wed to create a wiring and display a Debate Camp's information in the following format(note that if group Discount is true, it should show yes for Group Discount and is should show no otherwise Wany Tisle: Dell Location.PSIS Wendy 25.29 The Car Material For VS/2.00 Grup D Ver This toString method should make use of the toering method of its parent class Robot Camp class RoboticsCampis a sus of Summer Camp class. It has the following attributes in addition to the inheritedenes Attribute r te type faciliter le fot competitione dorable for the The Sw e et publie RoboticsCampString title, String locatie, deable rate, int weeks, double facility Fee, double compFee) Theng public void completa The patient. They were willing time puble String tering) The toString() method inherited from Summer Camp class should be used to create a new string, and display a savings account's information using the following format Wanyiwa 00 WWW TO -63423 + Home Cro Studi One.com SE25Asiento 20: -Cred Programa 22 Song 720-22 2. car -cuniani.com In Assignments, you will need to make use of inheritance by creating a class beachy for summer camp Summer Camp is an abstract class, which represents the basic attributes of any warmer camp. It is used as the root of the summer camp hierarchy. It has the following attributes (should be protected): Attribute ame Antribute type Description Newly Recap The Blowing constructie methodsho be provided initialize the isst variables. Plerer to the UML class diagram for their parameter types and return type. Note: the following constructor does not include the totalCost, it will be initialized to its default value 0 automatically public Summer Camp String some Title String some location double some Weekly Rate, int some NumberorWerks) The instance variables title, location, weekly Rate, and amber OrWeeks e initialized to the value of the first parameter, the second parameter, the third parameter, and the forth parameter respectively The following mutator method should be provided for instance variable the camp title String Camp Title) The Summer Camp also has abstract methods (which should be implemented overridden by its chil classes vold compute TotalCosts() The following toString method should be provided public String totring toString method returns a string of the following format: Wary The L C172 Wkly R 150.00 WWW The Cour.250.00 DebateCamp class Debate Campisaw s of Summer Camp class. It has the following attributes in addition to the inherited ones: Attribute name but type Description materiale double some material fee for the chalet groupscort boolean whow it has a group The following constructe method should be provided puble DebateCamp (String title, String location, deable rate, int weeks, double material Fee, String discount) The constructor of the parent class should be called using the first second third forth a meters to initialize its title, location, weekly Rate, numberOfWeeks, and the remaining parameters are used to initialize materiale and group Discount. If the parameter discount is yes, the instance variable group Discount should be settore, and if it is no, groupDiscount should be set to fole The following methods should be implemented public void compute TotalCest) This methodshow update its totalCost follows. Its basie total cost is compared as weekly R u mberorWecks. Il group Discount is in, then it should get a 10% discount, le weekly Rae number or Weeks should be multiplied by (0.9). The last the materialFee should be added to it. Also, the following method should be implemented puble String to String The toring method inherited from Sar a na clau should be used to create a new string, and display a Dchalecame's information in the towing format note that if Discount is true should show ww for Co re Study ICC 206 CHE r wad regem Song Ni - cu -caini.com /236-6852423. + Cat Homeverk Her WW wamewa Location Coor172 Werky . Wenke The Car Facility Fer253750 Con Fee $17.30 This toString method should make use of the toString method of the parent class MathCompass Machamp is a subclass of Summer Camp class. It has the following attribute in addition to the inheritedes: Attribute name Artribute type Description Taking bean whether taking a lot or not The following constructor method should be provided: pable MathCampString title, String location, double rute, int weeks, String testTaking) thin, and the n we wewe umer The constructor of the parents should be called using thes e fismo, staking should be to s . If the parter leaking is yes, the instance bele taking should be set to rw, and public void compute TotalCosta) This page is both wodo w a 33 puble String String What Camp way Team Law Weekly W3657 WWW CarW30 Table Www This toString method should make use of the toString method of the parent class The Summer Camparer class is a wility class that will be used to create an object of a chi claws of Summer Camp throm a parable string forg i - es-ca.com 20- 23 + Get Home Cres Studenec CE206 SE -Grid Programme Sempre The Summer Camp Parser class is a wility class that will be used to create an object of a child class of Summer Camp from a parable string The Summer Camp Parser class object will never be instantiated. It must have the following static method: public static Summer Camp parseStringToSummer Camp String line To Parse) The parti e r d e will be string in the following format For a debate camp with its type "DebateCamp ee Fara o carp with its type "Robot Camp pescuro w er. For a math camp s with type 'Matamp" type title weekly R o wecksestaking Anal ls in Drawy. GMLM2050 6980. RoboCampobri.Cor72:2003:37 30:17.30 Marca Alqal COOR/2003.75 This method will parse this string by using delimites, pull out the token information, create a new object of its corresponding child class of the Summer Camp class with attributes of the object, and return it to the calling method. The type will always be present and always be either Debat Camp. RoboticsCampor Mat Camp It can be lower case or uppercase) You may add other methods to the child classes in order to make your life easier In this assignment, download Assiemenis java file by clicking the link and use it for your assignment. You need to add code to this fille. The parts you need to add me written in the Assignments ava file, amely for the four Cases Add Summer Camp","Compute Total Costs Search for Summer Camp, and List Summer Camps All input and output should be handled here. The main method should start by displaying this updated in this exact format: Chow Action A dd summercamp C ompute Total Cente D eutch for Summer Campin L ist SummerCampin Quin Display Help What would you like to perform Alp Get Home Create One.com 2016 . E r werb Bering i - cu -caini.com 736-4 2 + Add Summer Camp Ye r ing Compete Total Costs Yarr ow for all m y wing for of the temple. The active thiyo wale wote A ng play the was made Search for Camp Yep the Sur Sumar List Summer Camp A wanya w ewe Location PSIS Wely W452 Car M 370 G D Mas Can Write law Lawr WW WWW TT WWW If there camp in the camp lib i sempty the display following + Get more studenog.com SE26 D roomt 20 ct-rated Programa 20 Sorg 23-1270002 . -a-car . co2 -es The following methods should be implemented: public void compute TotalCosta) This method should update its totalCost as follows. Its basic total cost is computed as weekly Rate numberor Weeks. If op Discount is true, then it should get a 10% discount, ie, weekly Rae numberor Weeks should be multiplied by (0-9). Then at last, the materiale should be added to it. Also, the following method should be implemented public String toString) The toString method inherited from Summer Campclass should be wed to create a wiring and display a Debate Camp's information in the following format(note that if group Discount is true, it should show yes for Group Discount and is should show no otherwise Wany Tisle: Dell Location.PSIS Wendy 25.29 The Car Material For VS/2.00 Grup D Ver This toString method should make use of the toering method of its parent class Robot Camp class RoboticsCampis a sus of Summer Camp class. It has the following attributes in addition to the inheritedenes Attribute r te type faciliter le fot competitione dorable for the The Sw e et publie RoboticsCampString title, String locatie, deable rate, int weeks, double facility Fee, double compFee) Theng public void completa The patient. They were willing time puble String tering) The toString() method inherited from Summer Camp class should be used to create a new string, and display a savings account's information using the following format Wanyiwa 00 WWW TO -63423 + Home Cro Studi One.com SE25Asiento 20: -Cred Programa 22 Song 720-22 2. car -cuniani.com In Assignments, you will need to make use of inheritance by creating a class beachy for summer camp Summer Camp is an abstract class, which represents the basic attributes of any warmer camp. It is used as the root of the summer camp hierarchy. It has the following attributes (should be protected): Attribute ame Antribute type Description Newly Recap The Blowing constructie methodsho be provided initialize the isst variables. Plerer to the UML class diagram for their parameter types and return type. Note: the following constructor does not include the totalCost, it will be initialized to its default value 0 automatically public Summer Camp String some Title String some location double some Weekly Rate, int some NumberorWerks) The instance variables title, location, weekly Rate, and amber OrWeeks e initialized to the value of the first parameter, the second parameter, the third parameter, and the forth parameter respectively The following mutator method should be provided for instance variable the camp title String Camp Title) The Summer Camp also has abstract methods (which should be implemented overridden by its chil classes vold compute TotalCosts() The following toString method should be provided public String totring toString method returns a string of the following format: Wary The L C172 Wkly R 150.00 WWW The Cour.250.00 DebateCamp class Debate Campisaw s of Summer Camp class. It has the following attributes in addition to the inherited ones: Attribute name but type Description materiale double some material fee for the chalet groupscort boolean whow it has a group The following constructe method should be provided puble DebateCamp (String title, String location, deable rate, int weeks, double material Fee, String discount) The constructor of the parent class should be called using the first second third forth a meters to initialize its title, location, weekly Rate, numberOfWeeks, and the remaining parameters are used to initialize materiale and group Discount. If the parameter discount is yes, the instance variable group Discount should be settore, and if it is no, groupDiscount should be set to fole The following methods should be implemented public void compute TotalCest) This methodshow update its totalCost follows. Its basie total cost is compared as weekly R u mberorWecks. Il group Discount is in, then it should get a 10% discount, le weekly Rae number or Weeks should be multiplied by (0.9). The last the materialFee should be added to it. Also, the following method should be implemented puble String to String The toring method inherited from Sar a na clau should be used to create a new string, and display a Dchalecame's information in the towing format note that if Discount is true should show ww for Co re Study ICC 206 CHE r wad regem Song Ni - cu -caini.com /236-6852423. + Cat Homeverk Her WW wamewa Location Coor172 Werky . Wenke The Car Facility Fer253750 Con Fee $17.30 This toString method should make use of the toString method of the parent class MathCompass Machamp is a subclass of Summer Camp class. It has the following attribute in addition to the inheritedes: Attribute name Artribute type Description Taking bean whether taking a lot or not The following constructor method should be provided: pable MathCampString title, String location, double rute, int weeks, String testTaking) thin, and the n we wewe umer The constructor of the parents should be called using thes e fismo, staking should be to s . If the parter leaking is yes, the instance bele taking should be set to rw, and public void compute TotalCosta) This page is both wodo w a 33 puble String String What Camp way Team Law Weekly W3657 WWW CarW30 Table Www This toString method should make use of the toString method of the parent class The Summer Camparer class is a wility class that will be used to create an object of a chi claws of Summer Camp throm a parable string forg i - es-ca.com 20- 23 + Get Home Cres Studenec CE206 SE -Grid Programme Sempre The Summer Camp Parser class is a wility class that will be used to create an object of a child class of Summer Camp from a parable string The Summer Camp Parser class object will never be instantiated. It must have the following static method: public static Summer Camp parseStringToSummer Camp String line To Parse) The parti e r d e will be string in the following format For a debate camp with its type "DebateCamp ee Fara o carp with its type "Robot Camp pescuro w er. For a math camp s with type 'Matamp" type title weekly R o wecksestaking Anal ls in Drawy. GMLM2050 6980. RoboCampobri.Cor72:2003:37 30:17.30 Marca Alqal COOR/2003.75 This method will parse this string by using delimites, pull out the token information, create a new object of its corresponding child class of the Summer Camp class with attributes of the object, and return it to the calling method. The type will always be present and always be either Debat Camp. RoboticsCampor Mat Camp It can be lower case or uppercase) You may add other methods to the child classes in order to make your life easier In this assignment, download Assiemenis java file by clicking the link and use it for your assignment. You need to add code to this fille. The parts you need to add me written in the Assignments ava file, amely for the four Cases Add Summer Camp","Compute Total Costs Search for Summer Camp, and List Summer Camps All input and output should be handled here. The main method should start by displaying this updated in this exact format: Chow Action A dd summercamp C ompute Total Cente D eutch for Summer Campin L ist SummerCampin Quin Display Help What would you like to perform Alp Get Home Create One.com 2016 . E r werb Bering i - cu -caini.com 736-4 2 + Add Summer Camp Ye r ing Compete Total Costs Yarr ow for all m y wing for of the temple. The active thiyo wale wote A ng play the was made Search for Camp Yep the Sur Sumar List Summer Camp A wanya w ewe Location PSIS Wely W452 Car M 370 G D Mas Can Write law Lawr WW WWW TT WWW If there camp in the camp lib i sempty the display following

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+What Is Technical Communication? 3

Answered: 1 week ago

Question

Solve the integral:

Answered: 1 week ago

Question

What is meant by Non-programmed decision?

Answered: 1 week ago

Question

What are the different techniques used in decision making?

Answered: 1 week ago