0% found this document useful (0 votes)
23 views4 pages

C ! C"#C!C !C

The document describes an exam question that involves creating two Java modules - an Initial Departure Scheduler module and a Simulator Controller module - to simulate the departure of airplanes. The Initial Departure Scheduler module is responsible for creating an initial random departure schedule for airplanes and distributing them across airports. It must implement the getSchedule() and convertToMinutes() methods. The Simulator Controller module is responsible for controlling the simulation by starting, stopping, pausing it and setting the sleep time between increments. It must extend the SimulatorController abstract class and implement the start(), pause(), and setSleep() methods. The document provides details on what each method is required to do and how to

Uploaded by

John Orsola
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views4 pages

C ! C"#C!C !C

The document describes an exam question that involves creating two Java modules - an Initial Departure Scheduler module and a Simulator Controller module - to simulate the departure of airplanes. The Initial Departure Scheduler module is responsible for creating an initial random departure schedule for airplanes and distributing them across airports. It must implement the getSchedule() and convertToMinutes() methods. The Simulator Controller module is responsible for controlling the simulation by starting, stopping, pausing it and setting the sleep time between increments. It must extend the SimulatorController abstract class and implement the start(), pause(), and setSleep() methods. The document provides details on what each method is required to do and how to

Uploaded by

John Orsola
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Exam Set # 1: Writing

1.

Connect the statement Only God is all-knowing to the statement Humans are using numbers to simplify simulation experiments. (20 pts) If the concept of randomness does not exist in human reasoning, what possibilities would humans be like? (20pts) If the concept of randomness does not exist in human reasoning, what would humans be like aside from being reduced to mere animals? (10 pts) Explain how do you derive a range of random numbers by merely using the random number generated by Math.random(). (10 pts) No simulation model can exist if it does not employ the use of random numbers. Affirm or denounce this statement. Give an argument to your point. (20 pts) Will the use of random number truly solve a problem? Explain your answer. (20 pts)

2.

3.

4.

5.

6.

Exam Set # 2: Programming (100pts)


Create the core modules that will create a simulator which will simulate the departure of airplanes. You must implement two modules within a single java application project. You will be given a library to import into your project. The librarys name is SimulatorInterface.jar. This contains the abstract class you need to extend in order to create a Simulator Controller module. This library also contains the interface you must implement in order to create an Initial Departure Scheduler. INITIAL DEPARTURE SCHEDULER MODULE The first module is the Initial Departure Scheduler. This module is responsible for creating initial departure schedule of the airplanes. In addition to that, this module is also responsible for evenly distributing the airplanes into different airports. You will implement org.cjc.ms.library.InitialDepartureScheduler interface to create a scheduler. You must therefore provide the codes for the following methods:

org.cjc.ms.library. InitialDepartureScheduler
public double[] getSchedule(int planePopulation, double average)

This method is responsible for creating a random initial departure schedule for each airplane. Airplanes will be assigned with a plane number starting from zero ( 0, 1 , 2 planePopulation 1). So you will refer to the first airplane as 0 and to the last airplane as planePopulation 1. You will create a distribution of flight schedules with the mean AVERAGE. For Example, If you have the AVERAGE value of 1 hour (Meaning, all planes shall depart in more or less an hour from the start of the simulation) and a plane population of 3. This method may generate the distribution of random numbers: {0.2, 0.5, 0.3} The above distribution tells us that plane#0 departs at 0.2 hours, plane#1 at 0.5 hours and plane#2 at 0.3 hours. Each flight schedule is a double floating point value representing the hour the plane will depart in hours. Parameters:
planePopulation - The Number of planes to schedule average - The average time all airplanes will depart

Returns: An array containing the schedule of each airplane

org.cjc.ms.library. InitialDepartureScheduler
public int convertToMinutes(double hours)

Returns the minute value of the argument hours. Parameters:


hours - The value to convert

Returns: The minute value in Integer

SIMULATOR CONTROLLER MODULE This module is responsible for controlling the behavior of your simulator. This is your main control module where you can start, stop, pause and set how fast the simulation is going to run.

You will extend the abstract class org.cjc.ms.library.SimulatorController to create a controller. You must therefore provide the codes for the following methods:

org.cjc.ms.library.SimulatorController
public abstract void start()

Initializes and starts the simulation thread. The simulation thread will increment the simulationTime. After each increment, the method simulationTimeChanged(time) MUST be invoked. In addition to that, after each increment the thread must pause for a certain time set by the method setSleep(sleepTime). If the simulation is paused then invoking this method will continue incrementing the simulation time. If the simulation is stopped, then invoking this method will reset the thread and the simulation time back to zero.

org.cjc.ms.library.SimulatorController
public abstract void pause()

Pauses the increment of the simulation time but not necessarily the simulation thread.

org.cjc.ms.library.SimulatorController
public abstract void pause()

Pauses the increment of the simulation time but not necessarily the simulation thread.

org.cjc.ms.library.SimulatorController
public abstract void setSleep(int sleepTime)

Sets the time to sleep after each increment of the simulation time. Parameters:
sleepTime The new sleep time

HOW TO TEST IF IMPLEMENTATIONS ARE CORRECT? Invoke the following code as shown in the diagram:

public class Main {

public static void main(String[] args) { org.cjc.ms.library.Tester.test(new InitialDepartureSchedulerImp(), new SimulatorControllerImp()); } } In the diagram above, the InitialDepartureSchedulerImp refers to your implementation of the InitialDepartureScheduler interface. While the SimulatorControllerImp refers to the class you extended from the SimulatorController abstract class. In order to pass your code, please make sure you invoke the above code. It will automatically call into the database and update your rankings.

You might also like