ManagerClass - import java.util.Scanner; public class...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 import java.util.Scanner public class flightControl { private Flight[] flights = new Flight[6] p flightControl(){ flights[0]= new Flight("QJ101", "Melbourne", "Sydney",2.0,"1/1/2011","08:00",80,'S') flights[1]= new Flight("QJ203", "Melbourne", "Brisbane",3.5,"1/1/2011","09:00",100,'S') flights[2]= new Flight("QJ301", "Melbourne", "Perth",5.0,"1/1/2011","10:00",100,'S') flights[3]= new Flight("QJ102", "Sydney","Melbourne",2.5,"1/1/2011","12:00",80,'S') flights[4]= new Flight("QJ204", "Brisbane", "Melbourne",4.0,"1/1/2011","14:30",100,'S') flights[5]= new Flight("QJ302", "Perth", "Melbourne",4.5,"1/1/2011","17:00",100,'S') } public void display(){ System.out.printf("%-15s %-15s %-15s %-15s %-15s\n", "Flight No", "Departing from", "Arriving at", "Date", "Time") System.out.printf("%-15s %-15s %-15s %-15s %-15s\n", "===============", "===============", "===============", " = for (int i = 0 System.out.printf("%-15s %-15s %-15s %-15s %-15s\n", flights[i].getFlightNo(), flights[i].getDeparturePoint(), flights[i].getDest i n } System.out.println() } public void flightBook(){ Scanner console = new Scanner(System.in) String flightNum int j = 0, fl = 0 System.out.println("Which flight would you like to reserve?") System.out.println("(Or enter a blank line to exit)") System.out.print("User Input: ") flightNum = console.nextLine() System.out.println() for (int i = 0 if (flightNum.equalsIgnoreCase(flights[i].getFlightNo())){ j++ fl = i } }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

ManagerClass - import java.util.Scanner; public class...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online