Commit 586ff3a3 authored by User's avatar User

class fix

output correction
parent 10fba06b
......@@ -98,17 +98,31 @@ public class reservation {
System.out.println("Sorry there is no available seat at the moment. The next flight is in 6 hours");
return;
case "Y":
for(int s=6; s<30; s++) {
for(int s=6; s<15; s++) {
for(int r=0; r<3; r++) {
if(plane[s][r] != "XX") {
reserve = plane[s][r];
plane[s][r] = "XX";
section = "Business";
System.out.println("Your booked seat is " + reserve);
ticket(first,last,city,destination,section, reserve);
return;
}
}
}
for(int s=15; s<30; s++) {
for(int r=0; r<3; r++) {
if(plane[s][r] != "XX") {
reserve = plane[s][r];
plane[s][r] = "XX";
section = "Economy";
System.out.println("Your booked seat is " + reserve);
ticket(first,last,city,destination,section, reserve);
return;
}
}
}
System.out.println("Sorry there is no available seat in any class at the moment. The next flight is in 6 hours");
return;
default:
System.out.println("invalid input please choose Y or N");
......@@ -204,13 +218,14 @@ public class reservation {
}
public static void ticket(String first, String last, String city, String destination, String section, String reserve) {
System.out.println("Here are your ticket details:"
+ "|{BOARDING PASS}|"
+ "\n|{BOARDING PASS}|"
+ "\n Name: " + first + " " + last
+ "\n From: " + city
+ "\n To: " + destination
+ "\n Flight: "
+ "\n Seat No.: " + reserve
+ "\n Section: " + section);
+ "\n Section: " + section
+ "\n--------------------------");
System.out.println("Thanks for using our booking service");
display(plane);
}
......
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