a. Create a class to hold Event data for Yummy Catering. The class contains the following: Two

Question:

a. Create a class to hold Event data for Yummy Catering. The class contains the following:
❯❯Two public final static fields that hold the price per guest ($35) and the cutoff value for a large 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 the company plans to assign event numbers such as M312.

❯❯Two public set methods that set the event number (setEventNumber()) and the number of guests (setGuests()). 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.
❯❯A constructor that 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.
❯❯Another constructor that is a default constructor that passes A000 and 0 to the two-parameter constructor. Save the file as Event.java.

b. Create an application that declares two Event objects.
❯❯One Event object uses the default constructor.
❯❯The other Event object is constructed from values input by a user. Display the details of each object by passing them, in turn, to a method named displayDetails(). Save the file as EventDemo.java.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  answer-question

Java Programming

ISBN: 9780357673423

10th Edition

Authors: Joyce Farrell

Question Posted: