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...
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...
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...
Hi! it is c++ 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 for whatever type of system it was going...
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...
Write a C++ code based this question n this assignment you will create three additional functions for each one of the data structures created in class. You will be provided with a header file which you will modify and a demo program for each data structure. If your functions are implemented correctly the demo programs should compile and execute correctly. Part 0 (Comments) 1. Over the course of the semester we have discussed comments for each data structure. Please add...
I NEED THE CODE FOR PART 2-MATH MODELING CLASS USING MATH LAB in thrve posed elevator problem, your assistant notified you that there are 60 workers operating on each of 5 floors atop the ground floor in your office building - 300 in total. The elevator occupancy is 10 people, and there are 3 elevators in total. In the worst-case scenario in terms of total transition time, on each elevator ride at least one person is getting off at each...
Hi I need a fix in my program. The program needs to finish after serving the customers from the queue list. Requeriments: Headers: DynamicArray.h #ifndef DynamicArray_h #define DynamicArray_h #include using namespace std; template class DynamicArray { V* values; int cap; V dummy; public: DynamicArray(int = 2); DynamicArray(const DynamicArray&); ~DynamicArray() { delete[] values; } int capacity() const { return cap; } void capacity(int); V operator[](int) const; V& operator[](int); DynamicArray& operator=(const DynamicArray&); }; template DynamicArray::DynamicArray(int cap) { this->cap = cap; values =...