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

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 for the "List of Seats. It should be immediately clear that we need a "Seat class to work with the ArrayList. i) (20 Points) So first of all we are going to work with the Seat class. You have been given an incomplete Seat class and your job is to complete all the get (accessors) and set (mutators) methods, and the parameterized constructor within it. (Look for syour code goes here> in the class to add your code:; look for the comments to see what purpose would the method serve.) ii) (50 Points) Once you're done with the Seat class, you would now complete all the methods inside the Event class. (Look for syour code goes here> in the class to add your code; look for the comments to see what purpose would the method serve.) (Hint: Refer to the CarAccountont class provided for Week 3 to get an idea on how you could use the ArrayList and the Seat class to complete all methods in the Event class.) il) (10 Points) Finally, run the program EventManager.java and report the output (you can either copy and paste the output to a text document or attach a snapshot) Note: Make sure to keep your source code as you'll need it on the next homework Q2) (20 Points) Create an enum type Month" that contains all the months in a year (January- December). Now in a class (Hw4), create a "Month type variable MyBirthdayMonth and assign a "Month" entry to it (eg. Month.January or Month.December) depending on which month you were born. Now simply display this "MyBirthdayMonth using a System.out.println() (Hint: We have a similar example in the notes provided for week3)

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 Databases Questions!