Lab 10 PostLab CS1440 Overview To tie everything all together, we will now complete the TicketKiosk...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Lab 10 PostLab CS1440 Overview To tie everything all together, we will now complete the TicketKiosk class. The TicketKiosk class reads and prints the schedule and manages input and output to and from the user. The schedule information is stored in a file named Flight Info.txt. Do not change FlightInfo.txt. Opening and using this file is part of the readSchedule method, which you must complete in the postLab. Activities 1. Copy FlightInfo.txt files into your project directory. You cannot simply drop Flight Info.txt into your BlueJ window. You must copy it into the project folder instead. Do not change the Flight Info.txt file. This file contains the flight schedule information. 2. Complete the method readOneFlight. It should read one set of flight data from the Flight Info.txt file. NOTE: You are given a Scanner object as a parameter that already has the file open. Use it. NOTE: Do not attempt to read the entire file (i.e., don't use a loop). Simply read the next five data items one by one. NOTE: Do not try to open the text file. It has already been opened. NOTE: You will have to insert an extra inFile.nextLine() somewhere in your method to correctly read mixed data (i.e., data of both String types and numeric types). To complete readoOneFlight, (a) Read the flight number using the Scanner object. (b) Read the pilot information as follows: Read the name using the Scanner object. Read the license number using the Scanner object. • Create a new Pilot object from the above two pieces of information. (c) Read the date using the Scanner object. (d) Read the destination using the Scanner object. (e) Create a new Flight object with the data you have read in and return it. 3. If you do so working correctly and have created your Flight class correctly, you should be able to run print Schedule and see a schedule very close to the following: Flt#: 885 Dest Boston Plt: Bill Jones Date: 06/21/14 Flt#: 885 Flt#: 602 Flt#: 212 Flt#: 650 Flt#: 111 Dest: Boston Dest: London Dest: Berlin Dest: Chicago Dest: New York Plt: Bill Jones Plt: Tim Jones Plt: Tim Jones Plt: Tim Jones Flt#: 190 Dest: Tokyo Plt: Bill Jones Plt: Tim Jones Date: 06/21/14 Date: 06/21/14 Date: 06/24/14 Date: 06/26/14 Date: 06/26/14 Date: 06/28/14 4. Complete the purchaseTickets method. Always prompt your user for any input. Use prompts exactly as shown in the "Finished Ticket Kiosk usage example" at the end of this document. Use println for all prompts. Do not use print or you will get errors. The purchaseTickets method should: (a) Print the schedule using printSchedule. (b) Read a name from the user. (c) If the name is not the word exit, then i. Read a social security number from the user. ii. Create a Customer object using the above data. iii. Read a flight number from the user. iv. Look up the flight using the flight number with the findFlight method as follows: Flight flight = find Flight (flight Number); (You can read about findFlight in the method javadoc.) v. If the flight is not null (which means the user entered a valid flight number), then A. Create a new Ticket object using the customer and flight information from steps ii and iv above A. Create a new Ticket object using the customer and flight information from steps ii and iv above. B. Print the Ticket object. Print a blank line before and after the ticket. Otherwise, if the flight is null (i.e., if the user entered a bad flight number), then A. Print an error message. B. Wait for user to acknowledge the error by hitting enter. You can accomplish this by adding an extra call to keyboard.nextLine(). (d) Repeat steps a, b, and c until the user types the word exit for the name. (e) Print a goodbye message. 5. Assuming everything in all classes is correct, you should be able to run the main method and operate the kiosk software. After the UML diagrams below is a sample run of a working kiosk titled "Finished Ticket Kiosk Usage Example". Items the user typed in are in red. If you type exactly the red text at exactly the same places the output on your screen should look exactly like the output on the sample below. If it does not match line for line, you will fail the tests. Make your output conform exactly to the sample before continuing. Red text is user input. Blue text is simply pointing out where the pause should occur on an error. 6. Copy TestTicketKiosk1. java and TestTicketKiosk2. java files into your project and clear all errors. 7. Make sure the project conforms to Checkstyle with no errors. 8. Submit your project to Web-CAT. You may upload it to AsULearn for a backup, but you will earn a grade of 0 if your project is not uploaded on Web-CAT as well. Finished Ticket Kiosk Usage Example Red text is user input. Blue text is where the program pauses. The line numbers are for reference only. 1: 2: Flt#: 885 3: Flt#: 602 4: Flt#: 212 5: Flt#: 650 6: Flt#: 111 7: Flt#: 190 8: Dest: Boston Dest: London Dest: Berlin Dest: Chicago Dest: New York Dest: Tokyo Plt: Bill Jones Plt: Tim Jones Plt: Tim Jones Plt: Tim Jones Plt: Bill Jones Plt: Tim Jones Date: 06/21/14 Date: 06/21/14 Date: 06/24/14 Date: 06/26/14 Date: 06/26/14 Date: 06/28/14 9: Enter your name (or type exit): 10: Al Bundy 11: Enter your social security number: 12: 222-22-2222 13: Enter your flight number: 14: 885 15: 16: ******** TICKET 17: Name: Al Bundy 18: SSN: 222-22-2222 19: Flight: 885 20: Date: 06/21/14 21: Destination: Boston 22: 23: 24: 25: Flt#: 885 26: Flt#: 602 27 Flt#: 212 28: Flt#: 650 29: Flt#: 111 30: Flt#: 190 31: Dest: Boston Dest London Dest: Berlin Dest: Chicago Dest: New York Dest: Tokyo Plt: Bill Jones Plt: Tim Jones Plt: Tim Jones Plt: Tim Jones Plt: Bill Jones Plt: Tim Jones Date: 06/21/14 Date: 06/21/14 Date: 06/24/14 Date: 06/26/14 Date: 06/26/14 32: Enter your name (or type exit): 33: Peg Bundy 34: Enter your social security number: 35: 111-11-1111 36: Enter your flight number: 37: 100 38: Bad flight number 38: Hit enter to continue. Date: 06/28/14 <- Extra keyboard.nextLine() to pause here. 38: Hit enter to continue. Extra keyboard.nextLine() to pause here. 40: 41: 42: Flt#: 885 43: Flt#: 602 44: Flt#: 212 45: Flt#: 650 46: Flt#: 111 47 Flt#: 190 48: Dest: Boston Dest: London Dest: Berlin Dest: Chicago Dest: New York Dest: Tokyo Plt: Bill Jones Plt: Tim Jones Plt: Tim Jones Plt: Tim Jones Plt: Bill Jones Plt: Tim Jones Date: 06/21/14 Date: 06/21/14 Date: 06/24/14 Date: 06/26/14 Date: 06/26/14 Date: 06/28/14 49: Enter your name (or type exit): 50: exit 51: Goodbye Lab 10 PostLab CS1440 Overview To tie everything all together, we will now complete the TicketKiosk class. The TicketKiosk class reads and prints the schedule and manages input and output to and from the user. The schedule information is stored in a file named Flight Info.txt. Do not change FlightInfo.txt. Opening and using this file is part of the readSchedule method, which you must complete in the postLab. Activities 1. Copy FlightInfo.txt files into your project directory. You cannot simply drop Flight Info.txt into your BlueJ window. You must copy it into the project folder instead. Do not change the Flight Info.txt file. This file contains the flight schedule information. 2. Complete the method readOneFlight. It should read one set of flight data from the Flight Info.txt file. NOTE: You are given a Scanner object as a parameter that already has the file open. Use it. NOTE: Do not attempt to read the entire file (i.e., don't use a loop). Simply read the next five data items one by one. NOTE: Do not try to open the text file. It has already been opened. NOTE: You will have to insert an extra inFile.nextLine() somewhere in your method to correctly read mixed data (i.e., data of both String types and numeric types). To complete readoOneFlight, (a) Read the flight number using the Scanner object. (b) Read the pilot information as follows: Read the name using the Scanner object. Read the license number using the Scanner object. • Create a new Pilot object from the above two pieces of information. (c) Read the date using the Scanner object. (d) Read the destination using the Scanner object. (e) Create a new Flight object with the data you have read in and return it. 3. If you do so working correctly and have created your Flight class correctly, you should be able to run print Schedule and see a schedule very close to the following: Flt#: 885 Dest Boston Plt: Bill Jones Date: 06/21/14 Flt#: 885 Flt#: 602 Flt#: 212 Flt#: 650 Flt#: 111 Dest: Boston Dest: London Dest: Berlin Dest: Chicago Dest: New York Plt: Bill Jones Plt: Tim Jones Plt: Tim Jones Plt: Tim Jones Flt#: 190 Dest: Tokyo Plt: Bill Jones Plt: Tim Jones Date: 06/21/14 Date: 06/21/14 Date: 06/24/14 Date: 06/26/14 Date: 06/26/14 Date: 06/28/14 4. Complete the purchaseTickets method. Always prompt your user for any input. Use prompts exactly as shown in the "Finished Ticket Kiosk usage example" at the end of this document. Use println for all prompts. Do not use print or you will get errors. The purchaseTickets method should: (a) Print the schedule using printSchedule. (b) Read a name from the user. (c) If the name is not the word exit, then i. Read a social security number from the user. ii. Create a Customer object using the above data. iii. Read a flight number from the user. iv. Look up the flight using the flight number with the findFlight method as follows: Flight flight = find Flight (flight Number); (You can read about findFlight in the method javadoc.) v. If the flight is not null (which means the user entered a valid flight number), then A. Create a new Ticket object using the customer and flight information from steps ii and iv above A. Create a new Ticket object using the customer and flight information from steps ii and iv above. B. Print the Ticket object. Print a blank line before and after the ticket. Otherwise, if the flight is null (i.e., if the user entered a bad flight number), then A. Print an error message. B. Wait for user to acknowledge the error by hitting enter. You can accomplish this by adding an extra call to keyboard.nextLine(). (d) Repeat steps a, b, and c until the user types the word exit for the name. (e) Print a goodbye message. 5. Assuming everything in all classes is correct, you should be able to run the main method and operate the kiosk software. After the UML diagrams below is a sample run of a working kiosk titled "Finished Ticket Kiosk Usage Example". Items the user typed in are in red. If you type exactly the red text at exactly the same places the output on your screen should look exactly like the output on the sample below. If it does not match line for line, you will fail the tests. Make your output conform exactly to the sample before continuing. Red text is user input. Blue text is simply pointing out where the pause should occur on an error. 6. Copy TestTicketKiosk1. java and TestTicketKiosk2. java files into your project and clear all errors. 7. Make sure the project conforms to Checkstyle with no errors. 8. Submit your project to Web-CAT. You may upload it to AsULearn for a backup, but you will earn a grade of 0 if your project is not uploaded on Web-CAT as well. Finished Ticket Kiosk Usage Example Red text is user input. Blue text is where the program pauses. The line numbers are for reference only. 1: 2: Flt#: 885 3: Flt#: 602 4: Flt#: 212 5: Flt#: 650 6: Flt#: 111 7: Flt#: 190 8: Dest: Boston Dest: London Dest: Berlin Dest: Chicago Dest: New York Dest: Tokyo Plt: Bill Jones Plt: Tim Jones Plt: Tim Jones Plt: Tim Jones Plt: Bill Jones Plt: Tim Jones Date: 06/21/14 Date: 06/21/14 Date: 06/24/14 Date: 06/26/14 Date: 06/26/14 Date: 06/28/14 9: Enter your name (or type exit): 10: Al Bundy 11: Enter your social security number: 12: 222-22-2222 13: Enter your flight number: 14: 885 15: 16: ******** TICKET 17: Name: Al Bundy 18: SSN: 222-22-2222 19: Flight: 885 20: Date: 06/21/14 21: Destination: Boston 22: 23: 24: 25: Flt#: 885 26: Flt#: 602 27 Flt#: 212 28: Flt#: 650 29: Flt#: 111 30: Flt#: 190 31: Dest: Boston Dest London Dest: Berlin Dest: Chicago Dest: New York Dest: Tokyo Plt: Bill Jones Plt: Tim Jones Plt: Tim Jones Plt: Tim Jones Plt: Bill Jones Plt: Tim Jones Date: 06/21/14 Date: 06/21/14 Date: 06/24/14 Date: 06/26/14 Date: 06/26/14 32: Enter your name (or type exit): 33: Peg Bundy 34: Enter your social security number: 35: 111-11-1111 36: Enter your flight number: 37: 100 38: Bad flight number 38: Hit enter to continue. Date: 06/28/14 <- Extra keyboard.nextLine() to pause here. 38: Hit enter to continue. Extra keyboard.nextLine() to pause here. 40: 41: 42: Flt#: 885 43: Flt#: 602 44: Flt#: 212 45: Flt#: 650 46: Flt#: 111 47 Flt#: 190 48: Dest: Boston Dest: London Dest: Berlin Dest: Chicago Dest: New York Dest: Tokyo Plt: Bill Jones Plt: Tim Jones Plt: Tim Jones Plt: Tim Jones Plt: Bill Jones Plt: Tim Jones Date: 06/21/14 Date: 06/21/14 Date: 06/24/14 Date: 06/26/14 Date: 06/26/14 Date: 06/28/14 49: Enter your name (or type exit): 50: exit 51: Goodbye
Expert Answer:
Answer rating: 100% (QA)
Im sorry but as an AI textbased model I dont have access to your project directory or the FlightInfo... View the full 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
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Watts and Strogatz proposed a hybrid model that contains typical links of vertices near each other (people know their geographic neighbors), plus some random long-range connection links. Plot the...
-
Most professionals in Canada, such as doctors, lawyers, and public accounting firms, are organized as limited liability partnerships (LLPs). Explain the fundamental concept that governs an LLP.
-
An employee got hurt on the job, was unable to work for a period of time, and received Workers Compensation benefits. His employer did not deduct the employees share of health insurance premiums from...
-
What does Section 404 of the Sarbanes-Oxley Act of 2002 require? (a) A 10-year jail sentence and $1 million fine for violations of the act. (b) Rotation of audit partners every five years. (c) A...
-
Assume that you are conducting the audit of College Ware, a manufacturer and distributor of printed, embroidered, and embossed specialty clothing and gift items marketed to college students with...
-
Asked bytoriweinreis12 If the total on the schedule of accounts receivable and the Accounts Receivable balance in the general ledger do not agree, the error a. could be in the total of the schedule,...
-
The Dorilane Company produces a set of wood patio furniture consisting of a table and four chairs. The company has enough customer demand to justify producing its full capacity of 2,000 sets per...
-
Review the data of Northwood Company and prepare journal entries to record the activity and prepare an income statement for the year. This item will be reviewed by your instructor with any necessary...
-
The Daily Diner recorded the following sales and customer data last month. F&B Sales =$162,750 Same month sales last year = $146,790 Covers = 10,500 Sales to date = $475,000 What was the guest check...
-
The Online Cooking Community needs to redesign their website to enable registered users to rate recipes with a rating out of 5 . Develop a distributed web application that can be used as a recipe...
-
Rashida has no expectation of acknowledgment or awards from her donation of time and money to several philanthropic organizations. Which quality does this illustrate? Group of answer choices Intimacy...
-
What is the output of the following C code fragment? unsigned char first = 1; unsigned char second = 0; if(first) if (second) printf("Pikachu"); else printf("Mimikyu");
-
Reggie has been tasked with scheduling a meeting with all of the team leads in his division. He reserved a conference room and has just arrived to set up the room. At the same time, Cathy arrives....
-
Curtis Jackson, director of operations at Avalanche Corporation, was faced with some major decisions. The firm had been experiencing considerable difficulties in matching supply with demand; as a...
-
The value of a share of common stock depends on the cash flows it is expected to provide, and those flows consist of the dividends the investor receives each year while holding the stock and the...
-
Mike sells his home to Jane on April 2, 2012. Jane pays the property taxes covering the full calendar year in October, which amount to $2,500. How much may Mike and Jane each deduct for property...
-
Fisafolia Corporation has gross income from operations of $220,000 and operating expenses of $160,000 for 2012. The corporation also has $20,000 in dividends from publicly traded domestic...
-
Teresa is a civil engineer who uses her automobile for business. Teresa drove her automobile a total of 21,732 miles during 2012, of which 95 percent was business mileage. The actual cost of...
-
a. Suppose that General Hospital has a current ratio of 0.5. Which of the following actions would improve (increase) this ratio? Use cash to pay off current liabilities. Collect some of the current...
-
What is the role of internal control in an organization?
-
What are the elements and principles of the COSO framework?
Study smarter with the SolutionInn App