Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with a simple Java program: LinkedList/Queue - Implementation. New concert tickets are available. You have to enter the names of the people in

Need help with a simple Java program:

LinkedList/Queue - Implementation. New concert tickets are available. You have to enter the names of the people in order to form a line. However, you will later find out that a few people are not eligible to buy tickets because they represent scalpers instead of actual concert goers. You will have to remove those people from the line. A special raffle will be done and the result of the raffle will insert a person to the front of the line. You will have to issue tickets to the first 10 people in line, but there are 15 people total in line. The others will have to put into a waitlist queue for the next available ticket.

Program Implementation Requirements: Use the Linked List (Original Line) and a Queue (waitlist) concept to create this program. The class name will be ConcertTickets. You will have the following methods: insertIntoLine(Person p), removeFromLine(Person p), addToWaitList(Person p), assignedTicket().

Test harness:

import java.util.ArrayList;

public class ConcertTicketsTest {

public static void main(String[] args) {

ArrayList listOfPeople = new ArrayList();

listOfPeople.add("Monica");

listOfPeople.add("Chandler");

listOfPeople.add("Rachel");

listOfPeople.add("Phobe");

listOfPeople.add("Joey");

listOfPeople.add("Ross");

listOfPeople.add("John");

listOfPeople.add("Daenerys");

listOfPeople.add("Arya");

listOfPeople.add("Sansa");

listOfPeople.add("Rob");

listOfPeople.add("Ned");

ConcertTickets concertTickets = new ConcertTickets(listOfPeople);

concertTickets.removeFromLine("Ned");

concertTickets.removeFromLine("Ross");

concertTickets.insertInFront("Cersei");

System.out.println(concertTickets.printWaitlist());

System.out.println(concertTickets.listOfTicketHolders());

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions

Question

Solve the inequality. |6-5x|+1>6

Answered: 1 week ago

Question

5. Understand how cultural values influence conflict behavior.

Answered: 1 week ago

Question

e. What do you know about your ethnic background?

Answered: 1 week ago