-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPreviousBooking.java
More file actions
42 lines (41 loc) · 1.36 KB
/
PreviousBooking.java
File metadata and controls
42 lines (41 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.util.Scanner;
import java.io.*;
class PreviousBooking
{
static int n=0;
public static void mainpage()
{
Scanner sc = new Scanner(System.in);
System.out.print("Please enter the Passenger Code: ");
try
{
BufferedReader brline = new BufferedReader(new InputStreamReader(System.in));
n = Integer.parseInt(brline.readLine());
try
{
BufferedReader br = new BufferedReader(new FileReader("Passengers\\Pas"+n+".txt"));
System.out.println("\fYour flight was succesfully found.");
System.out.println("The details are: \n");
String text;
while((text=br.readLine())!=null)
{
System.out.println(text);
}
br.close();
System.out.println("\n\nPlease press enter and any character to return back to the home page.");
sc.next();
MainPage.mainpage();
}
catch(Exception e)
{
System.out.println("\nThe code is not valid. Please try again.");
mainpage();
}
}
catch(Exception e)
{
System.out.println("Please enter an integer. Please try again.");
mainpage();
}
}
}