Commit 75fc06f9 authored by s7_bekman_i's avatar s7_bekman_i
Browse files

.

parent 7f94b17f
No preview for this file type
......@@ -75,53 +75,53 @@ public class Main {
System.out.println("--------------------------------------------------------");
/*============================BOARDING PASSES===================================*/
BoardingPass b1 = new BoardingPass(p1);
BoardingPass b2 = new BoardingPass(p2);
BoardingPass b3 = new BoardingPass(vip1);
BoardingPass b4 = new BoardingPass(vip2);
/*=============================FLIGHTS=======================================*/
AirportService.allAirports.add(a1);
services.addNewAirport(AirportName.RIGA, 4000);
/*Date d1 = new Date(2020, 10, 10, 9, 00);
Date d1 = new Date(2020, 10, 10, 9, 00);
Date d2 = new Date(2020, 11, 12, 10, 00);
Flight f1 = new Flight(d1, (byte) 3, AirportService.allAirports.get(0), AirportService.allAirports.get(1));
Flight f2 = new Flight(d2, (byte) 3, AirportService.allAirports.get(0), AirportService.allAirports.get(2));
AirportService.allFlights.add(f1);
AirportService.allFlights.add(f2);
for(Passenger p : AirportService.allPassenger) {
System.out.println(p);
System.out.println("------------------Flights------------------------------");
for(Flight f : AirportService.allFlights) {
System.out.println(f);
}
System.out.println("--------------------------------------------------------");
System.out.println("Delete Flight by flight number and airport name: " + services.deleteFlightInAirportByNr(AirportName.OSLO, 0));
System.out.println("------------Flights after delete-----------------------");
for(Flight f : AirportService.allFlights) {
System.out.println(f);
}
services.addNewBoardingPassByObject(f1, AirportService.allPassenger.get(0));
services.addNewBoardingPassByObject(f1, AirportService.allPassenger.get(2));
services.addNewBoardingPassByObject(f1, AirportService.allPassenger.get(3));
System.out.println("--------------------------------------------------------");
/*============================BOARDING PASSES===================================*/
BoardingPass b1 = new BoardingPass(p1);
BoardingPass b2 = new BoardingPass(p2);
BoardingPass b3 = new BoardingPass(vip1);
BoardingPass b4 = new BoardingPass(vip2);
for(BoardingPass bp : AirportService.allBoardingPasses) {
System.out.println(bp);
AirportService.allBoardingPasses.add(b1);
AirportService.allBoardingPasses.add(b2);
AirportService.allBoardingPasses.add(b3);
AirportService.allBoardingPasses.add(b4);
System.out.println("-------------------Boarding passes---------------------");
for(BoardingPass b : AirportService.allBoardingPasses) {
System.out.println(b);
}
System.out.println("--------------------------------------------------------");
services.addNewBoardingPassByObject(f1, AirportService.allPassenger.get(2));
for(BoardingPass bp : AirportService.allBoardingPasses) {
System.out.println(bp);
System.out.println("Delete bording pass by number: " + services.deleteBoardingPassByBoardingPassNr(AirportService.allBoardingPasses.get(1).getBoardingPassNr()));
System.out.println("--------------Boarding passes after delete---------------");
for(BoardingPass b : AirportService.allBoardingPasses) {
System.out.println(b);
}
System.out.println("--------------------------------------------------------");
//services.showAppFlightsFromAirport(AirportName.BARSELONA);
services.showOnlyVIPPassengersInFlight(AirportName.BARSELONA, 0);*/
}
}
......@@ -97,9 +97,9 @@ public class BoardingPass implements INumberGenerator{
public void generateSeatByPriority() {
Random rand = new Random();
char[] rows = {'a', 'b', 'c', 'd', 'e', 'f'};
for(Passenger p : AirportService.allPassenger) {
//Passenger tempPass = p;
if(p instanceof VipPassenger) {
for(int i = 0; i < AirportService.allPassenger.size(); i++) {
Passenger tempPass = AirportService.allPassenger.get(i);
if(tempPass instanceof VipPassenger) {
char row = rows[rand.nextInt(6 - 1) + 1];
short seat = (short) (rand.nextInt(3 - 1) + 1);
this.seat = new Seat(row, seat);
......
......@@ -131,6 +131,7 @@ public class Flight implements INumberGenerator{
setAirportFrom(airportFrom);
setAirportTo(airportTo);
generateNr();
}
/*
* @brief Prints output
......
......@@ -63,7 +63,7 @@ public class Passenger extends Person {
boolean isAdult, String extraNeeds) {
super(name, surname, idenNr, nationality, idenType);
setAudult(isAdult);
generateExtraNeeds();
setExtraNeeds(extraNeeds);
}
/*
......@@ -85,7 +85,7 @@ public class Passenger extends Person {
*/
@Override
public String toString() {
return "Passenger: " + getName() + " " + getSurname() + ", isAudult: " + isAdult + ", extraNeeds: " + getExtraNeeds();
return "Passenger: " + getName() + " " + getSurname() + ", isAudult: " + isAdult + ", extraNeeds: " + extraNeeds;
}
/*
* @brief Generates passengers extra needs
......@@ -94,9 +94,6 @@ public class Passenger extends Person {
* @return none
*/
public void generateExtraNeeds() {
if(isAdult == false)
System.out.println("Adult companion requred!");
else
System.out.println("No extra needs!");
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment