a. Carlys Catering provides meals for parties and special events. You created an Event class for the

Question:

a. Carly’s Catering provides meals for parties and special events. You created an Event class for the company. The Event class contains two public final static fields that hold the price per guest ($35) and the cutoff value for a large event (50 guests), and three private fields that hold an event number, number of guests for the event, and the price. It also contains two public set methods and three public get methods. Now, modify the Event class to contain two overloaded constructors. 

  • One constructor accepts an event number and number of guests as parameters. Pass these values to the setEventNumber() and setGuests() methods, respectively. The setGuests() method will automatically calculate the event price.
  • The other constructor is a default constructor that passes “A000” and 0 to the two-parameter constructor. Save the file as Event.java.

b. You also created an EventDemo class to demonstrate using two Event objects. Now, modify that class to instantiate two Event objects, and include the following new methods in the class:

  • Instantiate one object to retain the constructor default values.
  • Accept user data for the event number and guests fields, and use this data set to instantiate the second object. Display all the details for both objects. Save the file as EventDemo.java.
Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java Programming

ISBN: 978-1337397070

9th edition

Authors: Joyce Farrell

Question Posted: