Solution for the problem and mention algorithms

Assignment Help JAVA Programming
Reference no: EM13188029

Objectives:

  1. To gain experience with Arrays.
  2. To gain experience with generic algorithms.

Documentation:

  1. Explain the purpose of the program as detail as possible
  2. Develop a solution for the problem and mention algorithms to be used
  3. List data structures to be used in solution.
  4. Give a description of how to use the program and expected input/output
  5. Explain the purpose of each class you develop in the program.

Programming:

  1. For each method, give the pre and post conditions and invariant, if any 
  2. Program execution according to the requirements given 36%
  3. Naming of program as required 
  4. Print out of source code 

Description of program:

You are to write a program name elevator.java that simulates elevator services in a 12-floor building. There must be one elevator working this building.

Here are some requirements for the program:

1. The floors of the building are numbered 1 to 12.

2. The Initialization Phase: Randomly generate 8 floors to stop whilst going UP (No repetitions) and 5 Floors whilst going DOWN (no repetitions). USE ARRAYS :- UPARRAY and DOWNARRAY respectively. If the last stop going up was at floor 10, and a request was made from floor 12 to go down, then the elevator must go up to floor 11 to satisfy that request.

3. HINT: A good idea is to sort the UPARRAY in ascending order and sort the DOWNARRAY in descending order.

4. The elevator must be located on the 1st floor and the first request is made which must be a request to go up.

5. From the 1st floor, the elevator can only go in one direction - up. And from the 12th floor the elevator can only go in one direction - down.

6. If the elevator is on a given floor and is going down, then it could be used only to go down. Thus the direction in which the elevator is going must be known at all times and the floor to which it is going. If the elevator is going up, the request could be anywhere from floor 2 to 12. If it is going down, it can be from 12 to 1, with 1 being the default.

7. The location of the elevator must be known at all times. The program should provide output regarding the current floor, whether the elevator is going up or down, which floor it is starting from and which floor it is going to, as the following output will show:

8. To travel from one floor to another, it will take 2 seconds and the elevator will stay for 3 seconds at each floor.

9. Display at least the waiting at each floor - Flashing the count of the seconds.

Just a sample example (not ordered)

Up array (NOT SORTED)

4

2

7

9

3

6

8

10

12

5

11

Down array  (NOT SORTED)

3

5

8

9

10

6

                                   Starting at floor 1

                                        Going up: now at floor 2

                                        Going up: now at floor 3

                                        Going up: now at floor 4

                                        Going up: now at floor 5

                                     Stopping at floor 5 for 3 seconds:  1 2 3

                                     Starting at floor 5

                                         Going up: now at floor 6

                                         Going up: now at floor 7

                                         Going up: now at floor 8

                                     Stopping at floor 8 for 3 seconds: 1 2 3

                                     Starting at floor 8

                                         Going down: now at floor 7

                                         Going down: now at floor 6

                                         Going down: now at floor 5

                                         Going down: now at floor 4

                                         Going down: now at floor 3

                                     Stopping at floor 3 for 3 seconds: 1 2 3

                                    Starting at floor 3

                                       Going down: now at floor 2

                                       Going down: now at floor 1

     Do you want to run the elevator again? "Y or y" continue. "N or n" stop.

10.  It must also display the request data structures - requests for going up and down as shown above.

11.  Every time the elevator stops at a floor, it should check the relevant request array to see which floor it should stop next.

12.  Any other functions that you could implement that would make the elevator operation as realistic as possible.

13. Give the user the option to run the program again and again, etc.

Reference no: EM13188029

Questions Cloud

Which country will experience the larger outward shift : Country A and country B produce the same consumption goods and capital goods and currently have identical production possibilities curves. They also have the same resources at present, and they have access to the same technology. Currently, countr..
Explain the average concentration of the pollutant : what wind flow rate entering the canyon would produce a pollutant concentration greater than 0.0025 gmol/ft^3 in the air coming out of the canyon?
Find the distance between a and b : a surveyor locates a point C on land such that CAB = 48.8°. He also measures CA as 317 ft and CB as 527 ft. Find the distance between A and B.
Will the future production possibilities curve for nation : Like Physical capital, human capital produced in the present can be applied to the production of future goods and services. consider the table in Problem, 2-11, and suppose that the nation's residents are trying to choose between combination C and..
Solution for the problem and mention algorithms : Explain the purpose of the program as detail as possible and develop a solution for the problem and mention algorithms to be used and list data structures to be used in solution.
What is the radius of the circle : How long should each piece of the wire be to minimize the total area? What is the radius of the circle? How long is each side of the square?
State what wind flow rate entering the canyon : what wind flow rate entering the canyon would produce a pollutant concentration greater than 0.0025 gmol/ft^3 in the air coming out of the canyon?
Determine coefficient of correlation between two variables : Does the breakfast revenue seem to increase as the number of occupied rooms increases? Draw a scatter diagram to support your conclusion.
State compound sloly isomerizes completely : This compound sloly isomerizes completely to compund B, which has the same formula, Sketch the structures of A and B, and explain why B might be more stable than A

Reviews

Write a Review

JAVA Programming Questions & Answers

  Uml exercise

UML Exercise: Automated Teller Machine (ATM),   1. To allow authorized card holders to make transactions,   Brief Summary of Requirements:

  Write a java program that prints the numbers from 1 to 125

Write a Java Program that prints the numbers from 1 to 125. But for multiles of three print "Batman" instead of the number and for the multiples of five print "Superman". For instances which are multiples of both three and five "JusticeLeague".

  Write a java program to compute salary

Write a Java program which computes the Salary for a given number of employees. The program prompts user to enter n the number of employees.

  Implementation of memory management

Implementation of memory management

  Qr codes are a popular way

QR codes are a popular way to encode data for easy reading by computerized cameras. True QR codes contain error correction, format specifiers, version information, and a size variable layout that makes them harder to decode and process

  Write java program to print strings given at command line

Write a program Average.java which just prints strings that it is given at command line, one per line. If nothing is given at command line, print "No arguments".

  Write a java program in a netbeans project

Write a Java program in a NetBeans project

  Ask user to enter a list of names

Write a program that ask a user to enter a list of names. When you finish, The program will show the total number of characters in all the names.

  Write a class named test scores

Write a class named TestScores.The class constructor should accept an array of test scores as an argument.The class should have a method that returns the average of the test scores.

  Statements to print a label

Add the statements to print a label in the following format (the numbers in the example output are correct for input of $4.25 per pound and 41 ounces). Use the formatting object money to print the unit price and total price and the formatting object ..

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Instance methods

instance methods: setWidth(double w), setHeight(double h), double getWidth(), double getHeight() and double getArea() * A triangle's area is calculated by width*height*0.5  * all variables are private and methods public.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd