Writes all of the updated reservations in the list to a file

Assignment Help JAVA Programming
Reference no: EM131593846

Assignment

The Problem:

A common task in computing is to take data and apply changes (called transactions) to the data, then saving the updated data. This is the type of program you will write.

You will read a file of flight reservation data to be loaded into an array with a max size of 20. A second file will hold the transactions that will be applied to the data that has been stored in the array. At the end of the program, the updated data in the array will be written to a third file.

Flight class

This class will hold the information about a flight. It is responsible for the following data: flight number,flight date, departure airport, arrival airport, departure time, arrival time, and seat assignment. The date will be in the form mm/dd/yyyy. The time will be in the form hh:mm PM. This class should include a default constructor and another constructor that will receive data for all of the instance variables. Also includetoString and equals methods. The toString needs to format the data in the form that is needed for output written to the screen in an itinerary. Two Flight classes are considered equal when they have the same flightNumber and flightDate.

Reservation class

This class holds all of the information about a reservation for one person. It will include the passenger's name (one variable to hold first and last names), reservation number, departure flight and return flight (the flights are objects of the Flight class). Constructors should include a default constructor and another one that accepts values for all of the instance variables. Also include toString and equals methods. ThetoString needs to format the data in the format of output written to the screen in an itinerary. Reservations are considered to be equal when they have the same reservation number.

Airline class

This class is responsible for holding the array of reservations and all of the methods to process the transactions. Transactions are represented in the file with a numeric code as follows:

Code Transaction

1 Add a reservation - all data will be the same format as the reservations that are loaded into the array at the beginning of the program.

2 Print the itinerary of one passenger - Printed to the screen

3 Print the itineraries of all of the reservations - Printed to the screen

4 Write list to file - Writes all of the updated reservations in the list to a file

AirlineInput class

There are two input files. The first file, AirlineData.txt, holds all of the existing reservations. This should be read at the beginning of the program and stored in an array. The second file,Transactions.txt, has the transaction codes and data that is associated with each code.

AirlineData.txt format

<passenger name - include first and last name in one variable>
<reservation number>
<departure flight number>
<departure date>
<departure airport>
<arrival airport>
<departure time>
<arrival time>
<seat>
<return flight number>
<return date>
<departure airport>
<arrival airport>
<departure time>
<arrival time>
<seat>

Transactions.txt format.

Note: each type of transaction requires different input. The code will be followed by the data required for that code. There will be a code and data in one of the following formats.

Transaction code 1

<code>
<passenger name - include first and last name in one variable>
< reservation number>
<departure flight number>
<departure date>
<departure airport>
<arrival airport>
<departure time>
<arrival time>
<seat>
<return flight number>
<return date>
<departure airport>
<arrival airport>
<departure time>
<arrival time>
<seat>

Transaction code 2

<code>
<reservation number>

Transaction code 3

<code>

Transaction code 4

<code>

AirlineOutput class

This class will be responsible for:

• Code 2 - Displaying the itinerary for one passenger

o Sample output:

Passenger Name: Carl Foreman

Reservation Number: 1234

DepartureFlight:

Flight Number: UA1235
Flight Date: June 23, 2014
Departure Airport: null

Arrival Airport: null

Departure Time: 4:00 PM
Arrival Time: 7:15 PM
Seat: 23A

Return Flight:
Flight Number: UA673
Flight Date: July 12, 2014
Departure Airport: null
Arrival Airport: null
Departure Time: 10:00 AM
Arrival Time: 11:25 AM

Seat: 8A

o Note that the date has been changed from the form 04/16/2014 to the form April 16, 2014

• Code 3 - Displaying the itineraries for all reservations

o This displays the itinerary for each person in the same format as above.
o Leave a blank line between each itinerary.

• Code 4 - Writing the contents of the array to the file

o This should be in the same format as the input file AirlineData.txt

- The data can be left in the format used to display to the screen.

o Name this file xxx-UpdatedData.txt where the xxx represents your initials.

Design: Create an electronic document in .doc, .docx, or .pdf format containing the pseudocode algorithm for the driver and the class diagrams for all other classes.

JavaDoc: Generate the JavaDocs for the project.

Reference no: EM131593846

Questions Cloud

Write down the mechanism for the formation : Advanced Organic Chemistry - 300906 - write down the mechanism for the formation of 11 from compound 10 using curly arrows
Explain the law of increasing opportunity cost : (a) Explain the Law of Increasing Opportunity Cost. (b) What is the reason for the law?
Internal rate of return : You buy a new piece of equipment for $12, 539, and you receive a cash inflow of $2, What is the internal rate of return?
Market failure could worsen the situation : List five reasons why government's solution to a market failure could worsen the situation.
Writes all of the updated reservations in the list to a file : Writes all of the updated reservations in the list to a file. Print the itineraries of all of the reservations - Printed to the screen.
Ten year plan for finding life in the universe : You have just been named the director of a world consortium charged with finding extra terrestrial life as quickly as possible.
Explain what is marginal revenue product : Explain what is marginal revenue product, and how does it work?
Can the result be a pull or a push system : MRP and JIT each have benefits. Can they work together successfully, and how would one go about combining them at one of the Feets vendors?
Determine the profit maximizing price : How does the monopolist determine the profit maximizing price?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Build application and activate the camera for android mobile

The proposed idea build application and activate the camera for android mobile and take picture and put animation on someone face

  How are exceptions caught

How are exceptions caught? When should Exception Handling be used

  How many yogurts would you like to buy

You qualify for a free yogurt. Would you like to use your credits - How many yogurts would you like to buy - which they may use toward the purchase of a single

  Write sql statement to delete dept_id 1

Add 2 employees into EMPLOYEE12 table with one employee should belong to dept_id  1 and another employee should belong to dept_id 2. Remember to create and use Sequence number for employee_id which will start from 1000 and increment by 1 20.Write SQL..

  Generate a random number

A method called productsBuilder that takes no parameters and returns a String. In the method body construct a String

  Complete the analysis and design for the project

You will complete the analysis and design for the project. You will use the guidelines described above and the grading rubric below to complete this document.

  Describe which base class members may not be inherited

Without considering the access attributes, list and describe which base class members may not be inherited by a derived class and provide a rationale for why this is.

  Complete the design details of the classes in the package

The design phase of the SRS project is in full swing and every developer on the team is assigned a group of packages to work on and to complete the design details of the classes in the package. To help speed up the design process, you-as the softw..

  Modify each sorting algorithm

Modify each sorting algorithm so that it keeps track of the number of comparisons it performs and the number of exchanges (swaps) it performs during a single sorting operation. Keep track of these numbers using two long integer counters

  Implementation of tru file system

Design and implement TFS. It is a file system that can be used on a standalone machine. There are several simplifying assumptions such as a single application is accessing the file system at any given time.

  Demonstrate how the quicksort algorithm behaves

Demonstrate how the quicksort algorithm behaves. You will be implementing quicksort, but in a way that allows the program's user to visually observe how the algorithm proceeds by watching animated colored bars.

  Create a class called employee with name idno address and

create a class called employee with name idno address and phone number as attributes. create the setter and getter

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd