Question: I need help with the Post Calculator. This is for java. Stacks Queues Linked List Programming Problems Stack - Implementation. You will be able to

I need help with the Post Calculator. This is for java.

Stacks

Queues

Linked List

Programming Problems

Stack - Implementation. You will be able to use the push, pop and peek of Stack concept.

Post-Fix calculator - When an arithmetic expression is presented in the postfix form, you can use a stack to evaluate the expression to get the final value. For example: the expression 3 + 5 * 9 (which is in the usual infix form) can be written as 3 5 9 * + in the postfix. More interestingly, post form removes all parentheses and thus all implicit precedence rules.

Program Implementation Requirements

Use the stack concept to create a post-fix calculator. I will be using a test-harnessI need help with the Post Calculator. This is for java. Stacks to run your program. Please make sure it meets the requirements to be run by the test harness.

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().

Click here for the test-harnessQueues Linked List Programming Problems Stack - Implementation. You will be able.

Test Harness: Post Calculator

public class StackCalcTest {

public static void main(String[] args) {

StackCalc stackCalc = new StackCalc();

String[] values = {"3", "5", "9", "*", "+"};

for(int i = 0; i

stackCalc.stack.push(values[i]);

}

System.out.println(stackCalc.stack);

System.out.println(stackCalc.answer());

}

}

Test Harness: ConcertTickets

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());

}

}

Im having a hard time with the post calculator. Here what I did for the Second half of the requirement:

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());

}

Here what I did:

import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; class ConcertTickets { LinkedList originalLine; Queue waitList; public ConcertTickets(ArrayList listOfPeople) { originalLine = new LinkedList(); waitList = new LinkedList(); int size = listOfPeople.size(); for (int i = 0; i  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()); } }

Transcribed image text

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!