In this project, you will implement an airport system. In this system, we keep the flight...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In this project, you will implement an airport system. In this system, we keep the flight details in a file. Please see image 1 for our input file. In this file, there are 9 flights whose origin is our airport. In each line, you see the destination code, flight time, flight code (airline and flight code actually but consider them combined), eco price, flex price and business price. E.g. JFK 16.20 TK001 1200 1800 5700 means there is a flight from our airport which will go to JFK airport at 16.20 with flight code TK001. Prices for eco, flex and business seats are 1200, 1800 and 5700 dollars. O cost: int[] in.txt JFK 16.20 TK001 1200 1800 5700 LAX 18.20 VR65 450 650 2300 IST 1.20 KLM12 1000 2000 4000 ACA 2.30 AA23 660 780 1100 ACC 11.30 DL11 310 540 900 NW 4.50 KLM24 450 670 1200 CO 14.40 VR34 500 600 900 LAX 23.20 VR66 450 650 2300 ACC 18.30 DL12 310 540 900 STEP 1 - Create a Flight class. In this class, you will: declare 4 private variables: O destination: String O time: String code: String methods as: Image 1 - input file: in.txt O 2 constructors no-arg all strings to empty string initialize cost array to have 3 elements (for eco, flex and business) arguments as: String, String, String, int, int, int all strings to empty string initialize cost array to have 3 elements all costs initialized with given arguments O 1 set method (String, String, String, int, int, int) to setup all variables all setters and getters of instance variables O STEP 2 -Create a file similar to above (you can use the same). STEP 3 Now, create a driver class for testing purposes. This class has a main method and a method: int returnArrayIndex (String code). In the main method: Create a Flight array of number of items in your text file (for the given example, it is 9) Create an integer array of the same number of items to keep reservations. This array will increment the number of reservations for chosen flight. Read the file. AS YOU READ YOUR FILE, YOU HAVE TO HANDLE EXCEPTIONS IN A TRY_CATCH BLOCK BY USING FileNotFoundException. How to read a file (this example is without exceptions but you need to add exceptions, too): File myObj = new File("in.txt"); Scanner myReader = new Scanner (myObj); while (myReader.hasNextLine()) { String data = myReader.nextLine(); // DO anything you need......... } myReader.close(); O O o O You are free to use any method to read your file. You can read char by char, word by word or line by line. The above example reads the line, so the programmer needs to split it to destination, time, code and costs. Initialize your Flight objects in the array with the read information. Show Options to the user and ask what they want: 1: See all flights 2: Make a reservation 3: Airport based flights 0: Exit If 1-show all flights If 2 - ask the code. Find the index of this code in the reservations array by using a helper method (returnArrayIndex). returnArrayIndex method returns the array index of any given flight code, e.g. "TK001" 0; VR65" 1; KLM12" 2; etc.. Increment the value of the given code in the reservations array. Print it. If 3, show airport based flights. If 4, exit. For all cases, see the below sample output and be consistent with it. Press: 1: See all flights 2: Make a reservation 3: Airport based flights 0: Exit 1 Flight Details for Flight 1 Destination is: JFK Time is: 16.20 Code is: TK001 Eco price is: 1200 Flex price is: 1800 Business price is: 5700 Flight Details for Flight 2 Destination is: LAX Time is: 18.20 Code is: VR65 Eco price is: 450 Flex price is: 650 Business price is: 2300 Flight Details for Flight 3 Destination is: IST Time is: 1.20 Code is: KLM12 Eco price is: 1000 Flex price is: 2000 Business price is: 4000 Flight Details for Flight 4 Destination is: ACA Time is: 2.30 Code is: AA23 Eco price is: 660 Flex price is: 780 Business price is: 1100 Flight Details for Flight 5 Destination is: ACC Time is: 11.30 Code is: DL11 Eco price is: 310 Flex price is: 540 Business price is: 900 Flight Details for Flight 6 Destination is: NW Time is: 4.50 Code is: KLM24 Eco price is: 450 Flex price is: 670 Business price is: 1200 Flight Details for Flight 7 Destination is: CO Time is: 14.40 Code is: VR34 Eco price is: 500 Flex price is: 600 Business price is: 900 Flight Details for Flight 8 Destination is: LAX Time is: 23.20 Code is: VR66 Eco price is: 450 Flex price is: 650 Business price is: 2300 Flight Details for Flight 9 Destination is: ACC Time is: 18.30 Code is: DL12 Eco price is: 310 Flex price is: 540 Business price is: 900 Press: 1: See all flights 2: Make a reservation 3: Airport based flights 0: Exit 2 Enter the flight code: VR65 Number of reservations in this flight is: 1 Press: 1: See all flights 2: Make a reservation 3: Airport based flights 0: Exit 2 Enter the flight code: VR65 Number of reservations in this flight is:2 Press: 1: See all flights. 2: Make a reservation 3: Airport based flights 0: Exit 3 Airport workloads are: TK001 VR65 VR66 JFK: 1 LAX: 2 - IST: 1 KLM12 ACA: 1 ACC: 2 NW: 1 CO: 1 AA23 DL11 DL12 KLM24 VR34 Press: 1: See all flights 2: Make a reservation 3: Airport based flights 0: Exit 0 Thank you for visiting us!! In this project, you will implement an airport system. In this system, we keep the flight details in a file. Please see image 1 for our input file. In this file, there are 9 flights whose origin is our airport. In each line, you see the destination code, flight time, flight code (airline and flight code actually but consider them combined), eco price, flex price and business price. E.g. JFK 16.20 TK001 1200 1800 5700 means there is a flight from our airport which will go to JFK airport at 16.20 with flight code TK001. Prices for eco, flex and business seats are 1200, 1800 and 5700 dollars. O cost: int[] in.txt JFK 16.20 TK001 1200 1800 5700 LAX 18.20 VR65 450 650 2300 IST 1.20 KLM12 1000 2000 4000 ACA 2.30 AA23 660 780 1100 ACC 11.30 DL11 310 540 900 NW 4.50 KLM24 450 670 1200 CO 14.40 VR34 500 600 900 LAX 23.20 VR66 450 650 2300 ACC 18.30 DL12 310 540 900 STEP 1 - Create a Flight class. In this class, you will: declare 4 private variables: O destination: String O time: String code: String methods as: Image 1 - input file: in.txt O 2 constructors no-arg all strings to empty string initialize cost array to have 3 elements (for eco, flex and business) In this project, you will implement an airport system. In this system, we keep the flight details in a file. Please see image 1 for our input file. In this file, there are 9 flights whose origin is our airport. In each line, you see the destination code, flight time, flight code (airline and flight code actually but consider them combined), eco price, flex price and business price. E.g. JFK 16.20 TK001 1200 1800 5700 means there is a flight from our airport which will go to JFK airport at 16.20 with flight code TK001. Prices for eco, flex and business seats are 1200, 1800 and 5700 dollars. O cost: int[] in.txt JFK 16.20 TK001 1200 1800 5700 LAX 18.20 VR65 450 650 2300 IST 1.20 KLM12 1000 2000 4000 ACA 2.30 AA23 660 780 1100 ACC 11.30 DL11 310 540 900 NW 4.50 KLM24 450 670 1200 CO 14.40 VR34 500 600 900 LAX 23.20 VR66 450 650 2300 ACC 18.30 DL12 310 540 900 STEP 1 - Create a Flight class. In this class, you will: declare 4 private variables: O destination: String O time: String code: String methods as: Image 1 - input file: in.txt O 2 constructors no-arg all strings to empty string initialize cost array to have 3 elements (for eco, flex and business) arguments as: String, String, String, int, int, int all strings to empty string initialize cost array to have 3 elements all costs initialized with given arguments O 1 set method (String, String, String, int, int, int) to setup all variables all setters and getters of instance variables O STEP 2 -Create a file similar to above (you can use the same). STEP 3 Now, create a driver class for testing purposes. This class has a main method and a method: int returnArrayIndex (String code). In the main method: Create a Flight array of number of items in your text file (for the given example, it is 9) Create an integer array of the same number of items to keep reservations. This array will increment the number of reservations for chosen flight. Read the file. AS YOU READ YOUR FILE, YOU HAVE TO HANDLE EXCEPTIONS IN A TRY_CATCH BLOCK BY USING FileNotFoundException. How to read a file (this example is without exceptions but you need to add exceptions, too): File myObj = new File("in.txt"); Scanner myReader = new Scanner (myObj); while (myReader.hasNextLine()) { String data = myReader.nextLine(); // DO anything you need......... } myReader.close(); O O o O You are free to use any method to read your file. You can read char by char, word by word or line by line. The above example reads the line, so the programmer needs to split it to destination, time, code and costs. Initialize your Flight objects in the array with the read information. Show Options to the user and ask what they want: 1: See all flights 2: Make a reservation 3: Airport based flights 0: Exit If 1-show all flights If 2 - ask the code. Find the index of this code in the reservations array by using a helper method (returnArrayIndex). returnArrayIndex method returns the array index of any given flight code, e.g. "TK001" 0; VR65" 1; KLM12" 2; etc.. Increment the value of the given code in the reservations array. Print it. If 3, show airport based flights. If 4, exit. For all cases, see the below sample output and be consistent with it. arguments as: String, String, String, int, int, int all strings to empty string initialize cost array to have 3 elements all costs initialized with given arguments O 1 set method (String, String, String, int, int, int) to setup all variables all setters and getters of instance variables O STEP 2 -Create a file similar to above (you can use the same). STEP 3 Now, create a driver class for testing purposes. This class has a main method and a method: int returnArrayIndex (String code). In the main method: Create a Flight array of number of items in your text file (for the given example, it is 9) Create an integer array of the same number of items to keep reservations. This array will increment the number of reservations for chosen flight. Read the file. AS YOU READ YOUR FILE, YOU HAVE TO HANDLE EXCEPTIONS IN A TRY_CATCH BLOCK BY USING FileNotFoundException. How to read a file (this example is without exceptions but you need to add exceptions, too): File myObj = new File("in.txt"); Scanner myReader = new Scanner (myObj); while (myReader.hasNextLine()) { String data = myReader.nextLine(); // DO anything you need......... } myReader.close(); O O o O You are free to use any method to read your file. You can read char by char, word by word or line by line. The above example reads the line, so the programmer needs to split it to destination, time, code and costs. Initialize your Flight objects in the array with the read information. Show Options to the user and ask what they want: 1: See all flights 2: Make a reservation 3: Airport based flights 0: Exit If 1-show all flights If 2 - ask the code. Find the index of this code in the reservations array by using a helper method (returnArrayIndex). returnArrayIndex method returns the array index of any given flight code, e.g. "TK001" 0; VR65" 1; KLM12" 2; etc.. Increment the value of the given code in the reservations array. Print it. If 3, show airport based flights. If 4, exit. For all cases, see the below sample output and be consistent with it. Press: 1: See all flights 2: Make a reservation 3: Airport based flights 0: Exit 1 Flight Details for Flight 1 Destination is: JFK Time is: 16.20 Code is: TK001 Eco price is: 1200 Flex price is: 1800 Business price is: 5700 Flight Details for Flight 2 Destination is: LAX Time is: 18.20 Code is: VR65 Eco price is: 450 Flex price is: 650 Business price is: 2300 Flight Details for Flight 3 Destination is: IST Time is: 1.20 Code is: KLM12 Eco price is: 1000 Flex price is: 2000 Business price is: 4000 Flight Details for Flight 4 Destination is: ACA Time is: 2.30 Code is: AA23 Eco price is: 660 Flex price is: 780 Business price is: 1100 Flight Details for Flight 5 Destination is: ACC Time is: 11.30 Code is: DL11 Eco price is: 310 Flex price is: 540 Business price is: 900 Flight Details for Flight 6 Destination is: NW Time is: 4.50 Code is: KLM24 Eco price is: 450 Flex price is: 670 Business price is: 1200 Flight Details for Flight 7 Destination is: CO Time is: 14.40 Code is: VR34 Press: 1: See all flights 2: Make a reservation 3: Airport based flights 0: Exit 1 Flight Details for Flight 1 Destination is: JFK Time is: 16.20 Code is: TK001 Eco price is: 1200 Flex price is: 1800 Business price is: 5700 Flight Details for Flight 2 Destination is: LAX Time is: 18.20 Code is: VR65 Eco price is: 450 Flex price is: 650 Business price is: 2300 Flight Details for Flight 3 Destination is: IST Time is: 1.20 Code is: KLM12 Eco price is: 1000 Flex price is: 2000 Business price is: 4000 Flight Details for Flight 4 Destination is: ACA Time is: 2.30 Code is: AA23 Eco price is: 660 Flex price is: 780 Business price is: 1100 Flight Details for Flight 5 Destination is: ACC Time is: 11.30 Code is: DL11 Eco price is: 310 Flex price is: 540 Business price is: 900 Flight Details for Flight 6 Destination is: NW Time is: 4.50 Code is: KLM24 Eco price is: 450 Flex price is: 670 Business price is: 1200 Flight Details for Flight 7 Destination is: CO Time is: 14.40 Code is: VR34 Eco price is: 500 Flex price is: 600 Business price is: 900 Flight Details for Flight 8 Destination is: LAX Time is: 23.20 Code is: VR66 Eco price is: 450 Flex price is: 650 Business price is: 2300 Flight Details for Flight 9 Destination is: ACC Time is: 18.30 Code is: DL12 Eco price is: 310 Flex price is: 540 Business price is: 900 Press: 1: See all flights 2: Make a reservation 3: Airport based flights 0: Exit 2 Enter the flight code: VR65 Number of reservations in this flight is: 1 Press: 1: See all flights 2: Make a reservation 3: Airport based flights 0: Exit 2 Enter the flight code: VR65 Number of reservations in this flight is:2 Press: 1: See all flights. 2: Make a reservation 3: Airport based flights 0: Exit 3 Airport workloads are: TK001 VR65 VR66 JFK: 1 LAX: 2 - IST: 1 KLM12 ACA: 1 ACC: 2 NW: 1 CO: 1 AA23 DL11 DL12 KLM24 VR34 Eco price is: 500 Flex price is: 600 Business price is: 900 Flight Details for Flight 8 Destination is: LAX Time is: 23.20 Code is: VR66 Eco price is: 450 Flex price is: 650 Business price is: 2300 Flight Details for Flight 9 Destination is: ACC Time is: 18.30 Code is: DL12 Eco price is: 310 Flex price is: 540 Business price is: 900 Press: 1: See all flights 2: Make a reservation 3: Airport based flights 0: Exit 2 Enter the flight code: VR65 Number of reservations in this flight is: 1 Press: 1: See all flights 2: Make a reservation 3: Airport based flights 0: Exit 2 Enter the flight code: VR65 Number of reservations in this flight is:2 Press: 1: See all flights. 2: Make a reservation 3: Airport based flights 0: Exit 3 Airport workloads are: TK001 VR65 VR66 JFK: 1 LAX: 2 - IST: 1 KLM12 ACA: 1 ACC: 2 NW: 1 CO: 1 AA23 DL11 DL12 KLM24 VR34 Press: 1: See all flights 2: Make a reservation 3: Airport based flights 0: Exit 0 Thank you for visiting us!! Press: 1: See all flights 2: Make a reservation 3: Airport based flights 0: Exit 0 Thank you for visiting us!!
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
(a) A dice is thrown n times where n is a sufficiently large enough number to provide a uniformly distributed set of results. What would be the conditions for the arrangement of the result set that...
-
Sunshine Pools purchased $100,000 of 12% BHT bonds on January 1, 2016, at a price of 107.5 when the market rate of interest was 10%. Sunshine intends to hold the bonds until their maturity date of...
-
IDENTIFY THE COST OF THE FOLLOWING USING MARKET PRICE. please show simple solutions in each number. 1. The cost of beef trimmings 25 kg per box, with quantity of 3 boxes, supplier 1 cost 16,500,...
-
What is the purpose of an abstract of judgment? Why is an abstract of judgment an effective way to enforce a judgment?
-
Differing Frames of Reference: E-Mail Cross-Cultural Misunderstanding A cultural misunderstanding nearly derailed an Indo-Japanese bridge-building project. An Indian firm sent a detailed list of...
-
You are negotiating the rights to mine a gold field for the next 30 years. The initial investment, all the equipment and the operating license, would cost you a million dollars upfront. Then you...
-
The director of laboratory services at Henry Hospital is assessing her staffing requirements. The hospital processes 1,440,000 lab tests per year. A lab tech can process 50 per day and earns $50,000...
-
1. Write an algorithm (in readable pseudocode) that finds the beginning and end points (the index in the sequence) of the longest string of repeating digits in a sequence of random digits (0...9) of...
-
Determine the R value and U-factor for the following assemblies.Assume winter conditions. Use the attached Tables. Exterior Wall Component R-Value 3/8\" Plywood 1\" Air Space 3 1/2\" Fiberglass Batt...
-
DISCUSS THE CONCEPT OF Change Management.show the barriers of organizational change
-
The following information has been extracted from the records of Mas Bhd. about one of its products "LITTLE JOMBO". Mas Bhd. uses the perpetual inventory system and its reporting period ends on 30...
-
A tennis player place is a 41 KG ball machine on a frictionless surface as shown below. The machine fires is 0.063 KG tennis ball horizontally with a velocity of 31.6 m/s toward the north. What is...
-
-Suppose an oil company is thinking of buying some land for $10,000,000. There is a 60% chance of economic growth and a 40% chance of recession. The probability of discovering oil is 44% when there...
-
1) Circle Y has a central angle ?XYZ, which formsthe shaded segment shown. If the area of the segment isapproximately 4.64 square inches and m? XYZ=90*, what isthe radius of circle Y? 2) Given cos(?)...
-
1. Following are information about Alhadaf Co. Cost incurred Inventory Purchases Sales Adverting expense Salary Expense Depreciation Beginning Inventory Ending Inventory Amount 118,000 350.000 90,000...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
Sherry Hopson owns a retail family clothing store. Her store is located at 4321 Circle Drive, Houston, TX 77001. Her employer identification number is 95- 1234321 and her Social Security number is...
-
Walter, a single taxpayer, purchased a limited partnership interest in a tax shelter in 1985. He also acquired a rental house in 2012, which he actively manages. During 2012, Walter's share of the...
-
Briefly explain the connections between values such as effort optimism, utilitarian individualism, and the American economic system. Throughout this chapter, we have identified culture as something...
-
Do you speak a language other than English as a first language? If so, do you want your children and grandchildren to speak that language? In the United States, the tools of government and education...
-
If English is your first language, did your parents or grandparents speak a different first language? How do you feel about your ability (or lack of ability) in that language? In the United States,...
Study smarter with the SolutionInn App