项目作者: irinadeeva

项目描述 :
[School 42] Aircraft logistics simulation program
高级语言: Java
项目地址: git://github.com/irinadeeva/avaj-Launcher.git
创建时间: 2021-04-19T09:18:01Z
项目社区:https://github.com/irinadeeva/avaj-Launcher

开源协议:

下载


Avaj-Launcher

This is the first project of the Java branch at School 42.

Simple aircraft logistics simulation program based on the provided UML class diagram. All classes are required to be implemented respecting every detail provided in the diagram.

Description

This project is intended to teach a student:

  • the basics of Java development
  • interpreting UML class diagrams
  • implementing object-oriented design patterns (Observer, Singleton, Factory)
  • working with files
  • error management

The program takes one and only one argument from the command line. This argument represents the name of a text file that will contain the scenario needs to be simulated. The program execution generates a file
scenario.txt
that describes the outcome of the simulation.

Scenario file
The first line of the file contains a positive integer number. This number represents the number of times the simulation is run.
Each following line describes an aircraft that will be part of the simulation, with this format: TYPE NAME LONGITUDE LATITUDE HEIGHT.

Each run, the Weather Tower provides updated weather conditions for every aircraft and its coordinates. And aircraft react with changing coordinates by specified step and logging a message to the simulation file, the message corresponds to the weather. If the height of an aircraft reaches 0, it lands and unregisters from the Tower, thus stopping its participation.

Detailed description of the task: avaj-launcher.en.pdf

Usage

Compile and run the program with the script compileProject.sh. A program takes a path to a scenario file as a single parameter. By default, it looks for scenario.txt in the src dir.

  1. SCENARIO INPUT FILE FORMAT:
  2. A) First line: <PositiveInt>
  3. (NumberOfSimulationsToRun)
  4. B) All following lines - list of participating aircrafts in format:
  5. <String> <String> <PositiveInt> <PositiveInt> <PositiveInt>
  6. (Type) (Name) (Longitude) (Latitude) (Height)
  7. * 3 types of aircraft are available: Helicopter, JetPlane, Baloon.

For example:

  1. 25
  2. Baloon B1 2 3 20
  3. Baloon B2 1 8 66
  4. JetPlane J1 23 44 32
  5. Helicopter H1 654 33 20
  6. Helicopter H2 22 33 44
  7. Helicopter H3 98 68 99
  8. Baloon B3 102 22 34
  9. JetPlane J2 11 99 768
  10. Helicopter H4 223 23 54

From this input, the program generated this simulation log file: simulation.txt.

For example:

  1. Tower says: Baloon#B22(1) registered to weather tower.
  2. Tower says: JetPlane#J1(2) registered to weather tower.
  3. Tower says: Helicopter#H1(3) registered to weather tower.
  4. Tower says: Helicopter#H2(4) registered to weather tower.
  5. Tower says: Helicopter#H3(5) registered to weather tower.
  6. Tower says: Baloon#B3(6) registered to weather tower.
  7. Tower says: JetPlane#J2(7) registered to weather tower.
  8. Tower says: Helicopter#H4(8) registered to weather tower.
  9. Baloon#B22(1): We'll likely to hit fog soon.
  10. JetPlane#J1(2): The only thing we want for Christmas is snow...
  11. JetPlane#J1(2) landing.
  12. Tower says: JetPlane#J1(2) unregistered to weather tower with coordinates (23,44, 0).
  13. Helicopter#H2(4): All I could see is fog.
  14. Helicopter#H3(5): All I could see is fog.
  15. Baloon#B3(6): We'll likely to hit fog soon.
  16. Baloon#B3(6) landing.
  17. Tower says: Baloon#B3(6) unregistered to weather tower with coordinates (102,22, 0).
  18. Helicopter#H4(8): All I could see is fog.
  19. Baloon#B22(1): I'm afraid we shall have rain before morning.
  20. Baloon#B22(1) landing.
  21. ...