Java programming Assignment

computer science

Description

You've been hired by Biggy’s Popcorn to write a Java console application that

handles popcorn orders at their store. The application has the following two

classes:

Order.java

This class represents a customer in line who wants to buy popcorn and includes:

  •  Fields

static total order amount – count of all popcorn bags sold.

order amount – the number of popcorn bags the customer wants.

next – a pointer to the next Order in the queue.

 A constructor with no parameters that set the fields, respectively, to these

values:

order amount = -1

next = null

  •  A constructor with two parameters that sets the fields, respectively, to

these values:

total order amount = total order amount + orderAmount

order amount – set from parameter

next – set from parameter

  •  Getter methods for each field (declare the getter for total order amount

static).

  • Setter methods for each non-static field (declare the setter for

total order amount static).

  •  equals method that compares order amounts for equality.
  •  toString method for returning the order amount only.

HW7.java

This class contains the main method and maintains a queue of Orders. Create text

file Events.txt, paste the following data into it, and place the file in your project

folder. It has the following columns:

1) Event type – this will be either:

CQ means a customer entered the back of the line.

CH means the order was handled for the customer at the front of the

line.

2) Order amount – the number of popcorn bags the customer wants.

Events.txt

CQ 4

CQ 3

CH 0

CQ 7

CH 0

CQ 5

CQ 2

CQ 8

CH 0

CM 6

CH 0

CQ 4

CH 0

CH 0

CH 0

Read the data from file Events.txt. For each event, print an event number, event

type, amount ordered, line length (number of customers in line), and the result of

the processed event. Represent the customers in line with a queue (yes, the data

structure). Use a linked list, not an array or array list. Create the following

methods:

  •  insertCustomerOrder adds an Order node to the queue.
  •  removeCustomerOrder removes an Order node from the queue.


Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.