Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java Problem Create a class to hold Event data for Carly’s Catering. The class c

ID: 3672945 • Letter: J

Question

Java Problem

Create a class to hold Event data for Carly’s Catering. The class contains:

Two public final static fields that hold the price per guest ($38.00) and the cutoff value for a large event (45 guests).

Three private fields that hold an event number, number of guests for the event and the price. The event number should be stored as a String.

Two public set methods that set the event number and the number of guests. The price does not have a set method, however, whenever the number of guests is set, the price should be set by multiplying the number of guests times the price per guest.

Three public get methods should return the values of the three private fields.

Explanation / Answer

public class Event
{
public static double pricePerGuestHigh = 38.00;
public static double pricePerGuestLow = 32.00;
public static final int LARGE_EVENT_MAX = 50;
private String eventNumber;
private int guests;
private double pricePerEvent;
public void setEventNumber()
{
Scanner enter = new Scanner(System.in);
System.out.println("Enter the event number: ");
eventNumber = enter.nextLine();
}
public void setGuests()
{
Scanner enter = new Scanner(System.in);
System.out.println("Enter the number of guest attending ");
guests = enter.nextInt();
}
public boolean isLargeEvent()
{
if (guests >= LARGE_EVENT_MAX)
{
return true;
}
else if (guests < LARGE_EVENT_MAX)
{
return false;
}
return isLargeEvent();
}
public String getEventNumber(int guests)
{
return eventNumber;
}
public int getGuests(boolean largeEvent)
{
return guests;
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote