Question
Objective: Use Java 7 or 8 (JDK 1.7 or 1.8) and stacks to take an input file, read and process the data in a specific
Objective: Use Java 7 or 8 (JDK 1.7 or 1.8) and stacks to take an input file, read and process the data in a specific way (outlined in the prompt) and put results in an output file. Use of standard libraries is restricted to standard I/O calls and standard math functions, etc. In other words, you can't use the library stack code. Use named files to handle I/O. No hardcoded file names. Enter file names as command line prompts. Do NOT use GUI/console input of data. Output files must: Echo the input as well as contain answers to the required input. Be user friendly with additional labels, lines, and white space. Have statistical information as needed. Prompt:
You have been hired to evaluate the current use of the elevators so they can make an appropriate decision. You decide a computer simulation would be the best strategy to evaluate the use of the elevator, so you go to the office building to collect some actual data on the use of the elevator. You record actual usage (see input file) and observe the following facts:
- There are two elevators which each hold five people. One elevator is very small, so the limit is closely followed. The second elevator seems to be permanently broken.
- The elevator is very narrow so people have to get off to let out anyone that is behind them.
- The building has 5 floors serviced by the elevator.
- People always get on the elevator if there is room, even if it is going in the wrong direction, i.e. they may get on to go down even if they really want to go up.
You decide to use stacks. In the simulation, at each floor, you do the following:
- Remove people scheduled to get off on that floor
- Print the name of people exiting; along with the number of times each person had to exit temporarily during their trip.
- Restore people who got off temporarily.
- Load people waiting to get on.
- If the elevator is full or empty, print that out. Identify people who are waiting to get on but are unable to do so, if the elevator is full. Assume that people unable to get on the elevator will take the stairs.
- Print the name of each person getting on along with their destination floor.
- Proceed to the next floor, which is the next floor selected by a current passenger or the next floor selected by a person waiting to get on, whichever is sooner.
- After your simulation is finished, print out the total number of people who rode, the number of time someone could not ride because it was full, the number of empty occasions, etc.
-All printed output should go into a .txt file.
input.txt:
//Name floor entered elevator floor exited.
Eli 1 5
Babs 1 3
Fred 1 2
Tom 1 4
Ian 2 3
Tip 2 4
Barb 3 5
Tina 5 2
Joe 5 1
Hal 4 2
Ted 3 1
Deb 2 1
Ann 1 3
Jim 1 3
Sal 1 3
Vic 1 4
Flo 1 5
Ada 1 5
Dina 2 3
Bob 2 5
Lee 5 3
Wil 4 3
Gia 4 1
Isa 3 1
Abe 1 3
Lou 1 3
Yul 1 4
Al 1 4
Lew 2 5
Nan 2 3
Ina 3 4
Bif 3 5
Moe 3 5
Jan 5 1
Mia 1 3
Lisa 1 4
Cal 2 5
Pat 4 5
Tess 4 2
Nora 3 1
Don 2 1
Sam 1 5
Liv 5 4
Nina 1 3
Mary 5 2
Ed 1 2
Tad 2 3
Ali 3 4
Sue 4 5
elevator input data(1) - Notepad File Edit Format View Help //elevator input data-collected by a GO Pro Camera you mount on the elevator ceiling //Name floor entered elevator floor exited Babs Fred Tom Tan 4 4 Barb Tina oe Hal Ted Deb Ann Jim Sal vic FlO Ada Dina Bob Lee Wil Gia Isa Abe Lou Yul 4 4 4 4 4 4 Lew Nan Ina Bif Moe an Mia Lisa cal Pat Tess Nora Don sam Liv Nina 4 4 Mary5 Ed Tad A1i sueStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started