QuestionQuestion

Homework # 4

For Question 1, submit a zip file with Event.java, Seat.java, EventManager.java (not modified) and the text document.

For Question 2, submit a .java file.

Q1) Imagine you own a Ticketing agency and you handle all the ticketing requirements for different events happening.

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<Seat> for the “List of Seats”.

It should be immediately clear that we need a “Seat” class to work with the ArrayList.

i) 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 <your code goes here> in the class to add your code; look for the comments to see what purpose would the method serve.)

ii) Once you’re done with the Seat class, you would now complete all the methods inside the Event class.

(Look for <your code goes here> in the class to add your code; look for the comments to see what purpose would the method serve.)

iii) 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 may need it in future assignments.

Q2) Create an enum type “Month” that contains all the months in a year (JanuaryDecember).

Now in a class (Hw4), create a “Month” type variable ‘MyBirthdayMonth’ and assign a “Month” entry to it (e.g. Month.January or Month.December) depending on which month you were born.

Now simply display this ‘MyBirthdayMonth’ using a System.out.println()

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

import java.util.ArrayList;

public class Event {

//we are using a String to represent a date.
private String Date;

private String venue; //The area in Las Cruces where the event is being held.

private ArrayList<Seat> 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)
{
    this.Date = dte;
    this.venue = venu;
    this.seatlist = new ArrayList<Seat>();
}

/*
   Returns the value of the variable Date
   Delete 'return "";' statement and replace it with your own code
   */
public String getDate()
{
    return this.Date;
}

/*
   Returns the value of the variable venue
   Delete 'return "";' statement and replace it with your own code
   */
public String getVenue()
{
    return this.venue;
}

/*
   In this method you would simply add a "Seat" instance (object) to the "seatlist"
   */
public void addSeat(Seat object)
{
    this.seatlist.add(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 b...

By purchasing this solution you'll be able to access the following files:
Seat.java, Event.java, EventManager.java, EventManagerOUTPUT.txt, Hw4.java and OUTPUT.png.

$50.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats