Question: Attendee.java: Write a class called Attendee to represent one person who might attend the reunion. Your constructor should take the person s name and a

Attendee.java: Write a class called Attendee to represent one person who might attend the reunion. Your constructor should take the persons name and a Boolean if they have RSVPd to the reunion as parameters. Store these values in instance variables. Provide getters and setters for each. Also add a toString method so when an object of type Attendee is printed, it outputs the persons name.
Graduate.java: Create a subclass of Attendee called Graduate to represent one Dartmouth graduate who may attend the reunion. Graduates are attendees and in addition to the parameters stored by Attendee, each graduate should also have a numeric graduation year (e.g.,24) and a department (e.g., Computer Science). Provide the needed parameters in a constructor, saving them in instance variables. If a Graduate is printed it, should have the same output the same as an Attendee but should append the year and department. For example: Elvis '23 Computer Science.
Reunion.java: Complete a class called Reunion to track people who may attend. The constructor should accept and store the maximum number of attendees, and should have one array (note: use an array, not an ArrayList!) that can hold up to the max parameter number of Attendee or Graduate objects. Additionally,
Provide one method (e.g., not two overloaded methods) called addAttendee for your Reunion class that takes an object of either type Attendee or Graduate as a parameter and adds it to the array at the next open spot in your array. This method should print an error message and return if attempting to add more than the maximum number of attendees (including those people rvsp'ed false). If a person is successfully added to the array, print "Added , rsvp: " where is a String representation of the person (examples below, especially Alice and Charlie) and is their rsvp status.
Provide a method called rsvp for your Reunion class that takes a persons name as a String and a Boolean indicating if they have RSVPd as parameters. Search the array of Attendees and update the persons RSVP status if an attendees name matches the name parameter (assume no duplicate names). Print not found if no attendees names match, where is the name parameter. Otherwise, print the attendee's name and new rsvp status.
Finally, provide a toString method that will produce a String representation of a Reunion object in the format shown below. Make sure to be efficient! (e.g., loop through the array one time)
Starting with this scaffold code, your code should produce the following output
Added Alice, rsvp: true
Added Bob, rsvp: false
Added Charlie '22 Government, rsvp: true
Added Denise '21 Econ, rsvp: false
Added Elvis '23 Computer Science, rsvp: true
Unable to accommodate Falcon '26 Biology, max attendees is 5
Reunion attendees that have RSVP:
Alice
Charlie '22 Government
Elvis '23 Computer Science
Reunion attendees that have NOT RSVP:
Bob
Denise '21 Econ
Update rsvp status
George not found
Set RSVP to true for Bob
Reunion attendees that have RSVP:
Alice
Bob
Charlie '22 Government
Elvis '23 Computer Science
Reunion attendees that have NOT RSVP:
Denise '21 Econ
Submission Instructions
Turn in your completed Java code for Attendee, Graduate, and Reunion in one zip file. Make sure your output matches the output above.
public class Reunion {
//TODO: your code here
public static void main(String[] args){
Reunion r = new Reunion(5);
r.addAttendee(new Attendee("Alice", true));
r.addAttendee(new Attendee("Bob", false));
r.addAttendee(new Graduate("Charlie", true, 22, "Government"));
r.addAttendee(new Graduate("Denise", false, 21, "Econ"));
r.addAttendee(new Graduate("Elvis", true, 23, "Computer Science"));
r.addAttendee(new Graduate("Falcon", false, 26, "Biology"));
System.out.println(r);
System.out.println();
System.out.println("Update rsvp status");
r.rsvp("George", false); //print not found
r.rsvp("Bob", true); //update
System.out.println(r);
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!