Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
Train Route Simulation Program - Queue Implementation and Application
Answered

Queue Implementation

1.Queue Implementation

Use a circular array, as described in paragraphs 8.10 – 8.16, to implement a queue, based on an array with one unused location and no counter. Test all methods before you proceed to use your class in  the application.

2.Queue Application

All words in bold are meant to be classes: Route, Train, Station, Passenger.

Write a program to simulate a Train route.

A train route consists of an array of Stations, starting and ending with a terminal station. The time that a Train needs to travel between a pair of two consecutive stations on the route is given.

Each station has a Queue of Passengers (use the Queue class that you developed in Problem 1)

You may assume that every 10 minutes (or any other appropriate interval) a random number of Passengers (different for different station) arrive at each station and join the queue.

Trains leave a terminal at regular intervals and stop at all the stations on the route.

When a train stops at a station, all passengers for that station are removed from the train and then all the passengers waiting in the queue at the station board the train until either the queue is empty, or the train is full.

After a train reaches the last station, it goes back on the route, so the passengers enter the train only if their destination is past their origination station.

When the train stops at a station, print out the list of exiting passengers and the list of entering passengers.

The total output is expected to be quite long, so print it in a text file.

Bonus: let the route have two trains starting from the opposite ends of the route.

The simulation continues for the user-specified amount of time.

Good programming practices

For all classes

Make your instance variables private
Include constructors to initialize your instance variables.
Derived class constructors should leave initialization of super class instance variables to the super classes’ constructors:
Remember the call to the super classes constructor is:   super( , ,..)

Include Accessor and Mutator methods for all instance variables (please ask if you’re not sure what these are)

Include a main method for testing (unless it’s an abstract class) and test before you proceed…

Add comments to your code, not just so it’s easier for other readers, but also so it’s easier for you to remember your logic.

1. In general, how useful is the Queue data structure? Can you think of other uses aside from those discussed in the applications chapter?

2. If we didn’t have the Queue data structure can you think of another way to implement the LIFO (last in first out) concept?

1.If you worked in groups:
a.How did you “divide up” the work so that each student still met the objectives for the assignment (i.e., learned, understood and applied the concepts).
b.What was your contribution?
c.How did you coordinate code changes/testing?
d.Other observations about working with a partner?

2.Where did you have trouble with this assignment? How did you move forward? What topics still confuse you?

3.What did you learn from this assignment? (Please be specific)

4.How could this assignment be improved in the future?

Submitting your work:

Queue Application

1.Make sure that your name(s) are in all of your project files. 

2.If you have more than one file for your solution, make a .zip file for your project

3.In Blackboard, attach your solution file to the submission for this assignment.

guidelines on plaigarism in computer science

Clear Plagiarism

A clear case of plagiarism exists if a student passes off someone else's work as his or her own. Examples of such behavior include (but are not limited to) the following:
A student making cosmetic alterations to another's work and then handing it in as his or her own.
A student having another person complete an assignment and then handing it in as his or her own.
A student handing in (as his or her own) a solution to an assignment performed by someone else from a previous offering of the course.

These are all cases of indisputable plagiarism and are characterized by the submission of work, performed by another, under one's own name. 

Permitted Collaboration

Collaboration and research, where they do not constitute plagiarism, should be generally encouraged. These efforts constitute honest attempts at obtaining a deeper understanding of the problem at hand. They can also serve as a validation of a student's approach to a problem. Some examples are as follows:

A student researching existing, general public approaches (but not source code solutions) to a problem presented as an assignment.
A group of students discussing existing, public approaches to a problem presented as an assignment.
A group of students discussing the requirements of an assignment.
A student discussing the merits of his or her proposed solution to an assignment with the instructor or teaching assistant.
Provided that no plagiarism is committed, these are all valid (and encouraged) activities.

The Gray Area

The differences between the examples of plagiarism and encouraged collaboration above are those of originality and acknowledgment. In general, any work submitted without acknowledgment which is not the original work of the indicated author constitutes plagiarism. Some examples which illustrate this point follow. It should be noted that while some of the examples do not constitute academic misconduct, they may be of questionable academic value. It should also be noted that anyone (knowingly or through negligence) contributing to someone else's academic misconduct is also guilty of the same.

It is acceptable to use solution proposals presented by the instructor or teaching assistant. The acknowledgment is implicit. Explicit acknowledgment is not usually required.
It is not acceptable to use publicly available work without acknowledgment.
It is not acceptable to use a full or partial solution obtained from or by another through any means (verbal, written, electronic, etc.), without that person's permission.
It is not acceptable to collaborate on a single solution without acknowledgment.
It is not acceptable to discuss solutions or partial solutions to a problem and then incorporate them without acknowledgment.
It is acceptable to implement a standard solution to a problem without acknowledgment, but it is not acceptable to incorporate someone else's implementation without acknowledgment. Here standard solution means a commonly used data structure or algorithm.
It is not acceptable to re-submit an assignment from another course or a previous offering of the same course without acknowledgment, regardless of authorship.
It is not acceptable to make a solution available as an aid to others.
This set of examples helps define the bounds between encouraged behavior and misconduct, but does not constitute an exhaustive set.

support
close