
Using Java an elevator simulator that uses polymorphism and object-oriented programming to
simulate the movement of elevators in a building with multiple types of passengers and elevators.
The system has 8 elevators, each of which can be one of 4 types of elevators, with a certain
percentage of requests for each type. Similarly, each passenger can be one of 4 types, with a
different percentage of requests for each type.
Passenger Types:
There are 4 types of passengers in the system:
Standard: This is the most common type of passenger and has a request percentage of 70%.
Standard passengers have no special requirements.
VIP: This type of passenger has a request percentage of 10%. VIP passengers are given priority
and are more likely to be picked up by express elevators.
Freight: This type of passenger has a request percentage of 15%. Freight passengers have large
items that need to be transported and are more likely to be picked up by freight elevators.
Glass: This type of passenger has a request percentage of 5%. Glass passengers have fragile items
that need to be transported and are more likely to be picked up by glass elevators.
Elevator Types:
There are 4 types of elevators in the system:
StandardElevator: This is the most common type of elevator and has a request percentage of 70%.
Standard elevators have a maximum capacity of 10 passengers.
ExpressElevator: This type of elevator has a request percentage of 20%. Express elevators have a
maximum capacity of 8 passengers and are faster than standard elevators.
FreightElevator: This type of elevator has a request percentage of 5%. Freight elevators have a
maximum capacity of 5 passengers and are designed to transport heavy items.
GlassElevator: This type of elevator has a request percentage of 5%. Glass elevators have a
maximum capacity of 6 passengers and are designed to transport fragile items.
Simulation:
The simulation starts with a specified number of passengers added to different floors of the
building, each with a specified starting floor, destination floor, passenger type, and percentage of
requests for that passenger type. The elevator types are also specified, with their maximum
capacities and percentages of requests.
During the simulation, the elevators will move up and down the building, picking up and dropping
off passengers as appropriate, based on their passenger types and the elevator types available, the
percentage of requests for each, and the number of elevators in the system. Elevators will prioritize
picking up passengers that match their type, and passengers will prioritize selecting elevators that
match their type.
The simulation will continue for a specified number of iterations, during which the movements of
the elevators and passengers will be recorded and displayed. The system will also keep track of
wait times and travel times for each passenger, as well as any delays or malfunctions in the
elevators.
Sample Input File
# Building parameters
floors=30
# Passengers to add to floors
add_passenger 1 6 25 Standard 30
add_passenger 2 2 28 VIP 10
add_passenger 3 7 15 Freight 20
add_passenger 4 4 20 Glass 15
# Elevator types
elevator_type StandardElevator 10 40
elevator_type ExpressElevator 8 25
elevator_type FreightElevator 5 20
elevator_type GlassElevator 6 15
# Percentage of passenger requests for each elevator type
request_percentage StandardElevator 70
request_percentage ExpressElevator 20
request_percentage FreightElevator 5
request_percentage GlassElevator 5
# Percentage of passenger requests for each passenger type
passenger_request_percentage Standard 70
passenger_request_percentage VIP 10
passenger_request_percentage Freight 15
passenger_request_percentage Glass 5
# Number of elevators in the system
number_of_elevators 8
# Run simulation for 60 iterations
run_simulation 60

Trending nowThis is a popular solution!
Step by stepSolved in 5 steps with 1 images

- An airline can reconfigure the seating in an aircraft to respond to demand and to maximise revenue. The seating is arranged in rows and can be configured in different classes which have more or fewer seats per row and more or less separation between the rows. Each row consists of identical seating. The table below shows the four options. The Row separation includes the size of the seat itself and measures from the rear of the seat to the rear of the seat in front of it, or the front bulkhead. All measurements are in metres. Class No. of Seats Row separation Revenue per Seat Minimum Rows Maximum Rows First 4 1.98m £9,541 0 3 Business 8 1.93m £6,133 3 20 Premium Economy 10 0.86m £692 2 41 Economy 10 0.78m £404 5 48 The aircraft the company uses have 45 metres of available space and a legal limit of 374 passenger seats. One possible valid configuration is: 12 first class seats (taking up 3 rows and 5.94 metres) 56 business class seats (taking up 7 rows and 13.51 metres)…arrow_forwardIn Java Write an employee payroll program that uses polymorphism to calculate and print the weeklypayroll for your company. There are three types of employees ─ hourly, salaried, and salariedplus commission. Each type of employee gets paid using a different formula. However, for allemployee types, if the calculated paycheck exceeds $1000, the actual paycheck must bedecreased to $1000.Use this class hierarchy:Employee class (abstract ??):Instance variables:namesocial security numberbirthday monthbirthday week.load method :Prompts the user for instance-variable values and loads the entries.toString method:Returns a string that shows the employee’s name, social security number, and paycheck.Use the String.format method (See Java API documentation to help you format the stringas shown in the sample session’s paycheck report.) Here is an example from the samplesession:employee: Biff Sanchezsocial security number: 111-11-1111paycheck: $800.00getBonus method ( Extra Credit):Generates a $100…arrow_forwardChapter 6 Project Project Name: Chpt6_Project Class Name: Chpt6_Project Projectile Motion An object is thrown straight up from the top of a building that is h feet tall, with an initial velocity of v feet per second. The height of the object as a function of time can be modeled by the function h(t) = -16t² + vt + h, where h(t) is the height of the object (in feet) t seconds after it is thrown, and his the starting height, i.e. the height of the building This model assumes the object misses the top of the building on the way back down to the ground and that wind resistance is minimal. Example: Assume the ball is thrown straight up from the top of a 128 foot tall building with an initial speed of 32 feet per second (ft/sec). The height of the ball as a function of time can be modeled by the function by: h(t) = -16t² + 32t + 128. How high above the ground will the ball be after 3 seconds of flight time? Note: t² equals t times t h(t) = -16(3)² +32(3)+128 h(t) = -144 +96+ 128= 80 feet The…arrow_forward
- Write a C#program that uses a class called ClassRegistration as outlined below: The ClassRegistration class is responsible for keeping track of the student id numbers for students that register for a particular class. Each class has a maximum number of students that it can accommodate. Responsibilities of the ClassRegistration class: It is responsible for storing the student id numbers for a particular class (in an array of integers) It is responsible for adding new student id numbers to this list (returns boolean) It is responsible for checking if a student id is in the list (returns a boolean) It is responsible for getting a list of all students in the class (returns a string). It is responsible for returning the number of students registered for the class (returns an integer) It is responsible for returning the maximum number of students the class is allowed (returns an integer) It is responsible for returning the name of the class. (returns a string) ClassRegistration -…arrow_forwardWrite a class named IceCreamCup that implements the Customizable interface. The class should have the following private instance variables. Do NOT give any method implementations for this question, but only declare the instance variables. Do NOT initialize the instance variables -- except nCups below. A String variable name describing the ice cream name • A List of Flavor s added to the cup. Name it flist Additionally, define the following static variable: • An int nCups describing the total number of ice cream cups instantiated. Initialize this variablearrow_forwardIn Python write an address book program using object oriented design, you would need at least two things: An “address book” class. A class that will store information about a “person”. Using knowledge of classes, and thinking constructively about the task assigned with object-oriented design in mind. Requirements: A class named `Person`. Class constructor requires first, middle and last name of your person. Class method `set_email` must exist to set the person’s e-mail address, e.g.` "kirk@starfleet.org".` Class method `get_info` that returns a string formed from a person’s first, middle, last names and e-mail address, in this exact form: `"James Tiberius Kirk <kirk@starfleet.org>".` Class method `__str__ that returns the same string as the `get_info` method. A class named `AddressBook`. It must do the following: No class constructor arguments are required, though you should consider some internal data structures for initialization. Class method…arrow_forward
- Written in Python It should have an init method that takes two values and uses them to initialize the data members. It should have a get_age method. Docstrings for modules, functions, classes, and methodsarrow_forwardConsider this scenario, a mehtod in some class needs to access a data field in another class, here are two possible implementations: public class Process { /* * Check if student qualifies for financial help */ void check(Student student) { //.... } /* * Check if student qualifies for financial help */ void check(double studentGPA) { //.... }} In class Process, which check method you think is better, why? In other words, should we pass the object to the method or just the data member it needs? Disucuss the Pros and Cons of each approach (if any). Assume class Student has a mehod called getGPA( ).arrow_forwardclass A {protected int x1,y1,z; public: A(a, b,c):x1(a+2),y1(b-1),z(c+2) { for(i=0; i<5;i++) x1++;y1++;z++;}}; class B {protected: int x,y; public: B(a,b):x(a+1),y(b+2) { for(i=0; i<5;i++) x+=2; y+=1;}}; class D:public B, virtual public A { private: int a,b; public: D(k,m,n): a(k+n), B(k,m),b(n+2),A(k,m,n) { a=a+1;b=b+1;}}; int main() (Dob(4,2,5);} what the values of x1,y1 and zarrow_forward
- Implement a nested class composition relationship between any two class types from the following list: Advisor Вook Classroom Department Friend Grade School Student Teacher Tutor Write all necessary code for both classes to demonstrate a nested composition relationship including the following: a. one encapsulated data member for each class b. inline default constructor using constructor delegation for each class c. inline one-parameter constructor for each class d. inline accessors for all data members e. inline mutators for all data membersarrow_forwardPlease help me out with this java problem! Thanks!arrow_forwardCreate a Student class in C++ language to read and print N student's details. The output shall be like the following: Enter name: Ahmad Enter ID number: 101 Enter total marks out of 500: 456 Enter details of student 2: Enter name: Ali Enter ID number: 102 Enter total marks outof 500: 398 ...... until student number 10 Details of student 1: Student details: Name:Ahmed,Roll Number:101,Total:456,Percentage:91.2 Details of student 2: Student details: Name:Ali,Roll Number:102,Total:398,Percentage:79.6 ....... until student number 10 Enter total number of students: 10 Enter details of student 1:arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





