Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Yummy Catering provides meals for parties and special events. In Chapter 4, you created an event class for the company. Now, make the following changes

Yummy Catering provides meals for parties and special events. In Chapter 4, you created an event class for the company. Now, make the following changes to the class:

Currently, the class contains a constant for the price per guest ($35) that is used for every guest. Replace that constant field with two constant fieldsa lower price per guest that is $32 and a higher price per guest that is $35.

Add a new method named isLargeEvent() that returns true if the number of guests is 50 or greater and otherwise returns false.

Modify the method that sets the number of guests so that a large event (more than 50 guests) uses the lower price per guest to set the field that holds the price per guest and to calculate the total event price. A small event uses the higher price.

Save the file as Event.java. 1.b.

Write a program that demonstrates using the event class as follows:

Instantiate three event objects and prompt the user for values for each object.

Display the details for all three objects.

Create a method that accepts two event objects and returns the larger one based on the number of guests. (If the events have the same number of guests, you can return either object.)

Call this method three timesonce with each pair of instantiated eventsand display the event number and number of guests for each argument as well as the event number and number of guests for the larger event.

Save the file as EventDemo.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

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

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions