. Carly's Catering provides meals for parties and special events. In Chapters 3 and 4, you created an Event class for the company. Now, make the following changes to the class: Currently, the class contains a field that holds the price for an Event. Now add another field that holds the price per guest, and add a public method to return its value. Currently, the class contains a constant for the price per guest. Replace that field with two fields—a 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 new pricePerGuest field and calculate the total Event price. A small Event uses the higher price.   Save the file as Event.java. b. In Chapter 4, you modified the EventDemo class to demonstrate two Event objects. Now, modify that class again as follows: Instantiate three Event objects, and prompt the user for values for each object. Change the method that displays Event details to use the new isLargeEvent() method and the new price per guest value. Use the display method with all three objects. Create a method that accepts two Event objects and returns the larger one based on number of guests. (If the Events have the same number of guests, you can return either object.) Call this method three times—once with each pair of instantiated Events—and 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. Create a zip file of the .java file(s) and submit t

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

a. Carly's Catering provides meals for parties and special events. In Chapters 3 and 4, you created an Event class for the company. Now, make the following changes to the class:

  • Currently, the class contains a field that holds the price for an Event. Now add another field that holds the price per guest, and add a public method to return its value.
  • Currently, the class contains a constant for the price per guest. Replace that field with two fields—a 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 new pricePerGuest field and calculate the total Event price. A small Event uses the higher price.

 

Save the file as Event.java.

b. In Chapter 4, you modified the EventDemo class to demonstrate two Event objects. Now, modify that class again as follows:

  • Instantiate three Event objects, and prompt the user for values for each object.
  • Change the method that displays Event details to use the new isLargeEvent() method and the new price per guest value. Use the display method with all three objects.
  • Create a method that accepts two Event objects and returns the larger one based on number of guests. (If the Events have the same number of guests, you can return either object.) Call this method three times—once with each pair of instantiated Events—and 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.

Create a zip file of the .java file(s) and submit the assignment.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
void method
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education