Question: EventManager.java /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates *
EventManager.java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package eventmanager; /** * * @author Tiep Le */ public class EventManager { public static void main(String args[]) { Event event1=new Event("07/20/2018", "Downtown"); Event event2=new Event("07/12/2018", "University Ave"); Seat seat1ForEvent1 = new Seat(false,1,"",50); Seat seat2ForEvent1 = new Seat(true,2,"Tiep",50); Seat seat3ForEvent1 = new Seat(true,3,"Van",50); Seat seat4ForEvent1 = new Seat(false,4,"",50); Seat seat1ForEvent2 = new Seat(true,1,"Tu",100); Seat seat2ForEvent2 = new Seat(false,2,"",100); Seat seat3ForEvent2 = new Seat(false,3,"",100); Seat seat4ForEvent2 = new Seat(true,4,"Quan",100); Seat seat5ForEvent2 = new Seat(true,5,"Nhat",100); event1.addSeat(seat1ForEvent1); event1.addSeat(seat2ForEvent1); event1.addSeat(seat3ForEvent1); event1.addSeat(seat4ForEvent1); event2.addSeat(seat1ForEvent2); event2.addSeat(seat2ForEvent2); event2.addSeat(seat3ForEvent2); event2.addSeat(seat4ForEvent2); event2.addSeat(seat5ForEvent2); System.out.println("Event 1: Info"); System.out.println("Date: "+event1.getDate()); System.out.println("Venue: "+event1.getVenue()); System.out.println("Total Number of Seats: "+event1.getTotalSeats()); System.out.println("Total Number of Sold Seats: "+event1.getNumberOfSoldSeats()); System.out.println("Total Number of Unsold Seats: "+event1.getNumberOfUnsoldSeats()); System.out.println("Total Sale: "+event1.getTotalSale()); System.out.println("Guest List: "+event1.getGuestsList()); System.out.println("Event 2: Info"); System.out.println("Date: "+event2.getDate()); System.out.println("Venue: "+event2.getVenue()); System.out.println("Total Number of Seats: "+event2.getTotalSeats()); System.out.println("Total Number of Sold Seats: "+event2.getNumberOfSoldSeats()); System.out.println("Total Number of Unsold Seats: "+event2.getNumberOfUnsoldSeats()); System.out.println("Total Sale: "+event2.getTotalSale()); System.out.println("Guest List: "+event2.getGuestsList()); } }
Event.java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package eventmanager; import java.util.ArrayList; /** * * @author Tiep Le */ public class Event { //we could have used the Date class to represent this but we use string for simplicity private String date; private String venue; //The area in Las Cruces where the event is being held. private ArrayList seatList; //An arraylist of seats /* Complete the parameterized constructor for the Event class Inputs: dte = Date of the event venu = venue of the event You are supposed to assign all the above inputs to their respective global variables */ public Event(String dte, String venu) { // } /* Returns the value of the variable Date Delete 'return "";' statement and replace it with your own code */ public String getDate() { // return ""; } /* Returns the value of the variable venue Delete 'return "";' statement and replace it with your own code */ public String getVenue() { // return ""; } /* In this method you would simply add a "Seat" instance (object) to the "seatlist" */ public void addSeat(Seat object) { // } /* In this method, you will go over the "seatlist" using a for loop and then count all the 'sold' seats. You can use "getMarketStatus()" method of the Seat class to know which seats should be accounted for (Hint: Refer to a similar function in "CarAccountant" class provided for week 3) Delete 'return 0;' statement and replace it with your own code. ATTENTION CS 452 STUDENTS: It's compulsory for you to check for empty "seatlist" and change the return value if that's the case. */ public int getNumberOfSoldSeats() { // return 0; } /* In this method, you could either go over the "seatlist" using a for loop and then count all the 'unsold' seats by using the "getMarketStatus()" method of the Seat class or you could simply subtract the sold seats (obtained from getNumberOfSoldSeats()) from the total number of seats (size of "seatlist") (Hint: Refer to a similar function in "CarAccountant" class provided for week 3) Delete 'return 0;' statement and replace it with your own code. ATTENTION CS 452 STUDENTS: It's compulsory for you to check for empty "seatlist" and change the return value if that's the case. */ public int getNumberOfUnsoldSeats() { // return 0; } /* In this method, you would simply return the size of the "seatlist" Delete 'return 0;' statement and replace it with your own code. */ public int getTotalSeats() { // return 0; } /* In this method you would go over the "seatlist" using a for loop and add the last names on all "sold" Seats using "getCustomersLastName()". You could use the method "getMarketStatus()" to see which all seats are sold so that you only add the last names on the "sold" seats. An empty "guestlist" variable has been created for you, you are supposed to fill this list. (Hint: Refer to a similar function in "CarAccountant" class provided for week 3) ATTENTION CS 452 STUDENTS: It's compulsory for you to check for empty "seatlist" and change the return value if that's the case. */ public ArrayList getGuestsList() { ArrayList guestlist=new ArrayList(); // return guestlist; } /* In this method you would go over the "seatlist" using a for loop and gather the total sale by adding the "cost" of all "sold" seats. You can use the method "getMarketStatus()" to see which all seats are sold and then use "getCost()" method to get an access to their "cost". (Hint: Refer to a similar function in "CarAccountant" class provided for week 3) Delete 'return 0;' statement and replace it with your own code. ATTENTION CS 452 STUDENTS: It's compulsory for you to check for empty "seatlist" and change the return value if that's the case. */ public int getTotalSale() { // return 0; } } You will need to use EventManager.zip to start this assignment text document or You will submit 3 programs Event.java, seatjava and Hw4.javo, and snapshot containing the output for Q1iii) Q1) (80 Points) Imagine you own a Ticketing agency and you handle all the ticketing requirements for different events happening in and around Las Cruces. You have been given an incomplete 'Event class whose states are "Date of the event", "Venue of the event" and "a list of all the seats available for that event". We have used the String data type for "Date" and Venue", and an ArrayList
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
