Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Specification la) Jenny's Catering provides meals for parties and special events. In Appendix A, we have an application that prompts the user for the number

image text in transcribed
Specification la) Jenny's Catering provides meals for parties and special events. In Appendix A, we have an application that prompts the user for the number of guests attending an event, displays the company motto with a border, and then displays the price of the event and whether the event is a large one. Now modify the program so that the main() method contains only three executable statements that each call a method as follows: The first executable statement calls a public static int method that prompts the user for the number of guests and returns the value to the main() method. The second executable statement calls a public static void method that displays the company motto with the border. The last executable statement passes the number of guests to a public static void method that computes the price of the event, displays the price, and displays whether the event is a large event. Save the file as JennyCateringWithMethods.java. Ib) Create a class to hold Event data for Jenny's Catering. The class contains: Two public final static fields that hold the price per guest (S35) and the event (50 guests) Three private fields that hold an event number, number of guests for the event, and the price, The event number is stored as a String because Jenny plans to assign event numbers such as M312 Two public set methods that set the event number (set Event Number()) and the number of guests (set Guests()). The price does not have a set method because the setGuests() method will calculate the price as the number of guests multiplied by the price per guest every time the number of guests is set. Three public get methods that return the values in the three nonstatic fields CMPT 166 / Spring 2020/OH. H. Tsang Save the file as Event.java. le) Use the JennyCateringWithMethods class you created in Step la as a starting point for a program that demonstrates the Event class you created in Step 1b, but make the following changes: You already have a method that gets a number of guests from a user, now add a method that gets an event number. The main() method should declare an Event object, call the two data entry methods, and use their returned values to set the fields in the Event object. Call the method from the JennyCateringwithMethods class that displays the company motto with the border. The method is accessible because it is public, but you must fully qualify the name because it is in another class. Revise the method that displays the event details so that it accepts the newly created Event object. The method should display the event number, and it should still display the number of guests, the price per guest, the total price, and whether the event is a large event. Save the program as Event Demo.java. Specification la) Jenny's Catering provides meals for parties and special events. In Appendix A, we have an application that prompts the user for the number of guests attending an event, displays the company motto with a border, and then displays the price of the event and whether the event is a large one. Now modify the program so that the main() method contains only three executable statements that each call a method as follows: The first executable statement calls a public static int method that prompts the user for the number of guests and returns the value to the main() method. The second executable statement calls a public static void method that displays the company motto with the border. The last executable statement passes the number of guests to a public static void method that computes the price of the event, displays the price, and displays whether the event is a large event. Save the file as JennyCateringWithMethods.java. Ib) Create a class to hold Event data for Jenny's Catering. The class contains: Two public final static fields that hold the price per guest (S35) and the event (50 guests) Three private fields that hold an event number, number of guests for the event, and the price, The event number is stored as a String because Jenny plans to assign event numbers such as M312 Two public set methods that set the event number (set Event Number()) and the number of guests (set Guests()). The price does not have a set method because the setGuests() method will calculate the price as the number of guests multiplied by the price per guest every time the number of guests is set. Three public get methods that return the values in the three nonstatic fields CMPT 166 / Spring 2020/OH. H. Tsang Save the file as Event.java. le) Use the JennyCateringWithMethods class you created in Step la as a starting point for a program that demonstrates the Event class you created in Step 1b, but make the following changes: You already have a method that gets a number of guests from a user, now add a method that gets an event number. The main() method should declare an Event object, call the two data entry methods, and use their returned values to set the fields in the Event object. Call the method from the JennyCateringwithMethods class that displays the company motto with the border. The method is accessible because it is public, but you must fully qualify the name because it is in another class. Revise the method that displays the event details so that it accepts the newly created Event object. The method should display the event number, and it should still display the number of guests, the price per guest, the total price, and whether the event is a large event. Save the program as Event Demo.java

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_2

Step: 3

blur-text-image_3

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

Beginning Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

More Books

Students also viewed these Databases questions

Question

Give details of the use of ICT in workforce planning

Answered: 1 week ago