public class Elevator
{
private final int MIN_FLOOR = 1;
private final int MAX_FLOOR = 6;
private int currentFloor = 1;
PersonStackElevator ePersonStack;
Stack lPersonStack;
Person[] personList;
private void moveUp()
{
if (currentFloor < MAX_FLOOR)
{
currentFloor++;
}
}
private void moveDown()
{
if (currentFloor > MIN_FLOOR)
{
currentFloor--;
}
}
public void move(Person nextPerson, PersonStackElevator ePersonStack)
{
System.out.println("Current floor: " + currentFloor);
if (nextPerson.getFloorEntered() > currentFloor) {
moveUp();
}
else {
moveDown();
}
}
public void load(Person[] personList, int MAX_PERSONS, PersonStackElevator ePersonStack, Stack lPersonStack)
{
for (int j = 0; j < MAX_PERSONS; j++)
{
if (personList[j].getFloorEntered() == currentFloor && !ePersonStack.isFull())
{
ePersonStack.push(personList[j]);
}
else if (personList[j].getFloorEntered() == currentFloor && ePersonStack.isFull())
{
System.out.println(personList[j].getName() + " took the stairs.");
stairsCounter++;
}
else
{
System.out.println("Next to load: " + personList[j].getName());
move(personList[j], ePersonStack);
unload(ePersonStack, lPersonStack);
j--;
}
}
}
...
}
Solve it for java Question Remember: You will need to read this assignment many times to...
This is a repost of my question from before. I am having trouble writting the code for this project. Below is the project description with various methods and classes the code in C++ should implement. Project Description The goal of this project is to design and develop C++ code and algorithms to control a bank of elevators, which services many floors and transports people “efficiently ", that is, as per the given specifications. A second goal is to effectively employ...
Needs Help with Java programming language For this assignment, you need to write a simulation program to determine the average waiting time at a grocery store checkout while varying the number of customers and the number of checkout lanes. Classes needed: SortedLinked List: Implement a generic sorted singly-linked list which contains all of the elements included in the unsorted linked list developed in class, but modifies it in the following way: • delete the addfirst, addlast, and add(index) methods and...
need help with java In this program you will use a Stack to implement backtracking to solve Sudoku puzzles. Part I. Implement the stack class. Created a generic, singly-linked implementation of a Stack with a topPtr as the only instance variable. Implement the following methods only: public MyStack() //the constructor should simply set the topPtr to null public void push(E e) public E pop() Test your class thoroughly before using it within the soduku program Part II. Create...
Java Project For this assignment, you will write a simulation program to determine the average waiting time at a grocery store checkout while varying the number of customers and the number of checkout lanes. Classes needed: SortedLinked List: Implement a generic sorted singly-linked list which contains all of the elements included in the unsorted linked list developed in class, but modifies it in the following way: delete the addfirst, addlast, and add(index) methods and instead include a single add method...
Homework #5 - Elevator Simulation - Doubly Linked List The program needs to use a doubly linked list. Homework #5 - Extra Credit Elevator Simulation Algorithm We are going to develop an algorithm and implement in C++ to simulate a single elevator in a 10-story building. There will be some simplifying assumptions that will make this a bit less complex than a real-world implementation. The number of floors is not important, nor is the number of people getting on or...
In Java The fancy new French restaurant La Food is very popular for its authentic cuisine and high prices. This restaurant does not take reservations. To help improve the efficiency of their operations, the Maitre De has hired you to write a program that simulates people waiting for tables. The goal is to determine the average amount of time people spend waiting for tables. Your program will read in a list of event descriptions from a text file, one description...
5. You work on the 13th floor of a 15-floor building. The only elevator moves continuously back and forth between floors 0 through 15 and stopping time at each floor is negligible (a) You find it irritating that every time you want to go home for the day, the elevator is almost always going up when it arrives at your floor. What is the explanation for this? Compute the probability of this occurring. (b) Write the expected value of the...
java
Object Oriented Programming The assignment can be done individually or in teams of two. Submit one assignment per team of two via Omnivox and NOT MIO.Assignments sent via MIO will be deducted marks. Assignments must be done alone or in groups and collaboration between individuals or groups is strictly forbidden. There will be a in class demo on June 1 make sure you are prepared, a doodle will be created to pick your timeslot. If you submit late, there...
This assignment requires you to create simulations for different
scheduling algorithms commonly employed by operating systems to
achieve multiprogramming. All problems in this assignment assume
the following:
The simulations you will be creating are for a uniprocessor
system (single CPU).
Processes in these simulations will require CPU bursts of one or
more time units followed by I/O bursts of one or more time units.
For simplicity’s sake, when more than one process is executing its
I/O burst at the same...
C++ -- Event processing simulation using a transaction queue Hi! it is queue simulation please read the instructions, write codes, and explain the code with comments. Thank you Transactions enter the system and are stored in a queue. Each transaction represents some work that needs to be accomplished. Servers exist which process transactions. Servers take transactions off the queue and process them. you’re building the simulation framework. The idea is that somebody would take your framework, and add the specifics...