CSC 335 Wilmington Wk 8 Carly Catering & Rental and Rental Demo Classes Java Program

User Generated

Ohggl

Programming

CSC 335

Wilmington University

CSC

Description

Unformatted Attachment Preview

Week 8 a) In previous chapters, you developed classes that work with catering event information for Carly's • • • Catering. Now modify the Event and EventDemo classes as follows: Modify the Event class to include an integer field that holds an event type. Add a final String array that holds names of the types of events that Carly's caters—wedding, baptism, birthday, corporate, and other. Include get and set methods for the integer event type field. If the argument passed to the method that sets the event type is larger than the size of the array of String event types, then set the integer to the element number occupied by other. Include a get method that returns an event's String event type based on the numeric event type. To keep the EventDemo class simple, remove all the statements that compare event sizes and that display the invitation Strings. Modify the EventDemo class so that instead of creating three single Event objects, it uses an array of three Event objects. Get data for each of the objects, and then display all the details for each object. Save the files as Event.java and EventDemo.java. B) In previous chapters, you developed classes that hold rental contract information for Sammy's • • • Seashore Supplies. Now modify the Rental and RentalDemo classes as follows: Modify the Rental class to include an integer field that holds an equipment type. Add a final String array that holds names of the types of equipment that Sammy's rents—personal watercraft, pontoon boat, rowboat, canoe, kayak, beach chair, umbrella, and other. Include get and set methods for the integer equipment type field. If the argument passed to the method that sets the equipment type is larger than the size of the array of String equipment types, then set the integer to the element number occupied by other. Include a get method that returns a rental's String equipment type based on the numeric equipment type. To keep the RentalDemo class simple, remove all the statements that compare rental times and that display the coupon Strings. Modify the RentalDemo class so that instead of creating three single Rental objects, it uses an array of three Rental objects. Get data for each of the objects, and then display all the details for each object. Save the files as Rental.java and RentalDemo.java. Create a zip file of the .java file(s) and submit the assignment. Week 9 a) In Chapter 8, you modified the EventDemo program for Carly's Catering to accept and display data for an array of three Event objects. Now, modify the program to use an array of eight Event objects. Prompt the user to choose an option to sort Events in ascending order by event number, number of guests, or event type. Display the sorted list, and continue to prompt the user for sorting options until the user enters a sentinel value. Save the file as EventDemo.java. Create a zip file of the .java file(s) and submit the assignment. b) In Chapter 8, you modified the RentalDemo program for Sammy's Seashore Supplies to accept and display data for an array of three Rental objects. Now, modify the program to use an array of eight Rental objects. Prompt the user to choose an option to sort Rentals in ascending order by contract number, price, or equipment type. Display the sorted list, and continue to prompt the user for sorting options until the user enters a sentinel value. Save the file as RentalDemo.java. Create a zip file of the .java file(s) and submit the assignment. Week 10 i) a In Chapter 8, you created an Event class for Carly's Catering. Now extend the class to create a DinnerEvent class. In the extended class, include four new integer fields that represent numeric choices for an entrée, two side dishes, and a dessert for each DinnerEvent object. Also include three final arrays that contain String menu options for entrées, side dishes, and desserts, and store at least three choices in each array. Create a DinnerEvent constructor that requires arguments for an event number and number of guests, and integer menu choices for one entrée, two side dishes, and one dessert. Pass the first two parameters to the Event constructor, and assign the last four parameters to the appropriate local fields. Also include a getMenu() method that builds and returns a String including the Strings for the four menu choices. Save the file as DinnerEvent.java. b. In Chapter 9, you created an EventDemo program for Carly's Catering. The program uses an array of Event objects and allows the user to sort Events in ascending order by event number, number of guests, or event type. Now modify the program to use an array of four DinnerEvent objects. Prompt the user for all values for each object, and then allow the user to continuously sort the DinnerEvent descriptions by event number, number of guests, or event type. Save the file as DinnerEventDemo.java. Create a zip file of the .java file(s) and submit the assignment. ii) a. In Chapter 8, you created a Rental class for Sammy's Seashore Supplies. Now extend the class to create a LessonWithRental class. In the extended class, include a new Boolean field that indicates whether a lesson is required or optional for the type of equipment rented. Also include a final array that contains Strings representing the names of the instructors for each of the eight equipment types, and store names that you choose in the array. Create a LessonWithRental constructor that requires arguments for an event number, minutes for the rental, and an integer equipment type. Pass the first two parameters to the Rental constructor, and assign the last parameter to the equipment type. For the first two equipment types (personal watercraft and pontoon boat), set the Boolean lesson required field to true; otherwise, set it to false. Also include a getInstructor() method that builds and returns a String including the String for the equipment type, a message that indicates whether a lesson is required, and the instructor's name. Save the file as LessonWithRental.java. b. In Chapter 9, you created a RentalDemo program for Sammy's Seashore Supplies. The program uses an array of Rental objects and allows the user to sort Rentals in ascending order by contract number, equipment type, or price. Now modify the program to use an array of four LessonWithRental objects. Prompt the user for all values for each object, and then allow the user to continuously sort the LessonWithRental descriptions by contract number, equipment type, or price. Save the file as LessonWithRentalDemo.java. week 11 i) a. In previous chapters, you have created several classes for Carly's Catering. Now, create a new abstract class named Employee. The class contains data fields for an employee's ID number, last name, first name, pay rate, and job title. The class contains get and set methods for each field; the set methods for pay rate and job title are abstract. Save the file as Employee.java. b. Create three classes that extend Emp1oyee named Waitstaff, Bartender, and Coordinator. The method that sets the pay rate in each class accepts a parameter and assigns it to the pay rate, but no Waitstaff employee can have a rate higher than 10.00, no Bartender can have a rate higher than 14.00, and no Coordinator can have a rate higher than 20.00. The method that sets the job title accepts no parameters—it simply assigns the string waitstaff, bartender, or coordinator to the object appropriately. Save the files as Waitstaff.java, Bartender.java, and Coordinator.java. c. In Chapter 10, you created a DinnerEvent class that holds event information, including menu choices. Modify the class to include an array of 15 Employee objects representing employees who might be assigned to work at a DinnerEvent. Include a method that accepts an Employee array parameter and assigns it to the Employee array field, and include a method that returns the Employee array. The filename is DinnerEvent.java. d. Write an application that declares a DinnerEvent object, prompts the user for an event number, number of guests, menu options, and contact phone number, and then assigns them to the object. Also prompt the user to enter data for as many Employees as needed based on the number of guests. A DinnerEvent needs one Waitstaff Employee for every event, two if an event has 10 guests or more, three if an event has 20 guests or more, and so on. A DinnerEvent also needs one Bartender for every 25 guests and one Coordinator no matter how many guests attend. All of these Employees should be stored in the Employee array in the DinnerEvent object. (For many events, you will have empty Employee array positions.) After all the data values are entered, pass the DinnerEvent object to a method that displays all of the details for the event, including all the details about the Emp1oyees assigned to work. Save the program as StaffDinnerEvent.java. Create a zip file of the .java file(s) and submit the assignment. ii) a. In previous chapters, you have created several classes for Sammy's Seashore Supplies. Now, Sammy has decided to restructure his rates to include different fees for equipment types in addition to the fees based on rental length, and to charge for required lessons for using certain equipment. Create an abstract class named Equipment that holds fields for a numeric equipment type, a String equipment name, and a fee for renting the equipment. Include a final array that holds the equipment names—personal watercraftski, pontoon boat, rowboat, canoe, kayak, beach chair, umbrella, and other. Also include a final array that includes the surcharges for each equipment type— $50, $40, $15, $12, $10, $2, $1, and $0, respectively. Include a constructor that requires an equipment type and sets the field to the type unless it is out of range, in which case the type is set to the other code. Include get and set methods for each field and include an abstract method that returns a String explaining the lesson policy for the type of equipment. Save the file as Equipment.java. b. Create two classes that extend Equipment—EquipmentWithoutLesson and EquipmentWithLesson. The constructor for each class requires that the equipment type be in range—that is, personal watercraft, pontoon boats, rowboats, canoes, and kayaks are EquipmentWithLesson objects, but other equipment types are not. In both subclasses, the constructors set the equipment type to other if it is not in range. The constructors also set the equipment fee, as described in part 2a. Each subclass also includes a method that returns a message indicating whether a lesson is required, and the cost ($27) if it is. Save the files as EquipmentWithoutLesson.java and EquipmentWithLesson.java. c. In Chapter 8, you created a Rental class. Now, modify it to contain an Equipment data field and an additional price field that holds a base price before equipment fees are added. Remove the array of equipment Strings from the Renta1 class as well as the method that returns an equipment string. Modify the Renta1 constructor so that it requires three parameters: contract number, minutes for the rental, and an equipment type. The method that sets the hours and minutes now sets a base price before equipment fees are included. Within the constructor, set the contract number and time as before, but add statements to create either an EquipmentWithLesson object or an EquipmentWithoutLesson object, and assign it to the Equipment data field. Assign the sum of the base price (based on time) and the equipment fee (based on the type of equipment) to the price field. Save the file as Rental.java. d. In Chapter 8, you created a Renta1Demo class that displays details for four Rental objects. Modify the class as necessary to use the revised Rental class that contains an Equipment field. Be sure to modify the method that displays details for the Renta1 to include all the pertinent data for the equipment. Save the file as RentalDemo.java. Create a zip file of the .java file(s) and submit the assignment. Week 12 I) In Chapter 11, you created an interactive StaffDinnerEvent class that obtains all the data for a dinner event for Carly's Catering, including details about the staff members required to work at the event. Now, modify the class so that it becomes immune to user data entry errors by handling exceptions for each numeric entry. Each time the program requires numeric data—for example, for the number of guests, selected menu options, and staff members' salaries—continuously prompt the user until the data entered is the correct type. Save the revised program as guests, selected menu options, and staff members' salaries—continuously prompt the user until the data entered is the correct type. Save the revised program as StaffDinnerEvent.java. Create a zip file of the .java file(s) and submit the assignment. ii) In Chapter 11, you created an interactive RentalDemo class that obtains all the data for four rentals from Sammy's Seashore Rentals, including details about the contract number, length of the rental, and equipment type. Now, modify the class so that it becomes immune to user data entry errors by handling exceptions for each numeric entry. Each time the program requires numeric data—for example, for the rental period—continuously prompt the user until the data entered is the correct type. Save the revised program as RentalDemo.java. Create a zip file of the .java file(s) and submit the assignment. In Chapter 11, you created an interactive RentalDemo class that obtains all the data for four rentals from Sammy's Seashore Rentals, including details about the contract number, length of the rental, and equipment type. Now, modify the class so that it becomes immune to user data entry errors by handling exceptions for each numeric entry. Each time the program requires numeric data—for example, for the rental period—continuously prompt the user until the data entered is the correct type. Save the revised program as RentalDemo.java. Create a zip file of the .java file(s) and submit the assignment. Week 13 i) In Chapter 11, you created an interactive RentalDemo class that obtains all the data for four rentals from Sammy's Seashore Rentals, including details about the contract number, length of the rental, and equipment type. Now, modify the class so that it becomes immune to user data entry errors by handling exceptions for each numeric entry. Each time the program requires numeric data—for example, for the rental period—continuously prompt the user until the data entered is the correct type. Save the revised program as RentalDemo.java. Create a zip file of the .java file(s) and submit the assignment. ii) a. In Chapter 12, you created an interactive RentalDemo class that obtains all the data for four rentals from Sammy's Seashore Rentals, including details about the contract number, length of the rental, and equipment type. Now, modify the program to create a data file that contains each contract number, rental time in hours and minutes, equipment type code and name, and price. Save the program as RentalDemoAndCreateFile.java. b. Write a program that displays the data saved in the file created in part 2a. Save the program as DisplayRentalFile.java. Create a zip file of the .java file(s) and submit the assignment. Week 14 i) In previous chapters, you have created a number of programs for Carly's Catering. Now, create an interactive GUI program that allows the user to enter the number of guests for an event into a text field; if the value entered is not numeric, set the event price to 0. Also allow the user to choose one entree from a group of at least four choices, up to two side dishes from a group of at least four choices, and one dessert from a group of at least three choices. Display the cost of the event as $35 per person; as the user continues to make selection changes, display a list of the current items chosen. If a user attempts to choose more than two side dishes, remove all the current side dish selections so that the user can start over. Save the program as JCarlysCatering.java. Create a zip file of the .java file(s) and submit the assignment. ii) . In previous chapters, you have created a number of programs for Sammy's Seashore Rentals. Now, create an interactive GUI program that allows the user to enter a rental time in hours into a text field; if the value entered is not numeric, set the rental price to 0. Also allow the user to choose one equipment type to rent from a group of seven choices. The rental fee is $40 per hour for a personal watercraft or pontoon boat; $20 per hour for a rowboat, canoe, or kayak; and $7 per hour for a beach chair or umbrella. Let the user add an equipment lesson for an extra $5. Display a message that indicates all the details for the rental, including the total price. Save the program as JSammysSeashore.java. Create a zip file of the .java file(s) and submit the assignment.
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

hello check t...


Anonymous
Really helped me to better understand my coursework. Super recommended.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags