Write a program that manages a list of train tickets, JAVA Programming

A fictitious train company, 'Transrail', has commissioned you to write a program that manages a list of train tickets.

The program should display a text menu that prompts the user to add, retrieve and delete tickets, as well as display summary information. The data structure used to store ticketing information should be an array. It should prevent a seat from being double-booked. 

The program should be able to distinguish, store and display both standard and first class tickets on-the-fly. Data will also be persistent between each execution of the program, by it loading data from a file at startup, and dumping the contents of the train ticket list when quitting.

Class Definitions
 
TrainTicket
 
The basic TrainTicket class models information that describes a single train ticket. It should store three pieces of data:

  • seat number: an integer (e.g. 12)
  • passenger name: a string (e.g. "John Doe")
  • duration: an integer that measures the legs in the journey (e.g. 3)

 
There should also be a provision to return a ticket's price, which is currently calculated at a constant $9 for each leg of the journey (e.g. a three-leg train ticket will cost $27). After construction, all data in a TrainTicket object should not be modifiable under any circumstances.
 
FirstClassTicket
 
The FirstClassTicket class is a subclass of TrainTicket. This ticket provides passengers with access to the bar car and a sleeper cabin. First class tickets have a greater cost: each leg of the journey is $20 more than a normal train ticket (e.g. a three-leg first class ticket will cost $87).
 
It also has an option not available to normal train tickets: personal waiter service. If this is selected, the ticket incurs a $15 flat fee. This added fee should be 'invisible' (i.e. it should be included in the ticket price, when the price accessor is called.) The waiter option can only be chosen at construction; it cannot be toggled afterwards.

Posted Date: 2/16/2013 4:14:40 AM | Location : United States







Related Discussions:- Write a program that manages a list of train tickets, Assignment Help, Ask Question on Write a program that manages a list of train tickets, Get Answer, Expert's Help, Write a program that manages a list of train tickets Discussions

Write discussion on Write a program that manages a list of train tickets
Your posts are moderated
Related Questions
1. RUP is relying on a few important principles and philosophies like planning ahead, knowing where the process is capturing and heading the project in extensible and storable mann

The different types of actions in Struts are: ? DispatchAction ? LookupDispatchAction ? ForwardAction ? SwitchAction ? IncludeAction


Javascript validation, JAVA Programming 1. Obtaining the new script: Download and save the attached comment CGI mailer script form-mail2.pl to your server''s cgi-bin directory, and

WHY WE USE JAVA IN PROGRAMMING INSTEAD OF OTHER PROGRAMMING LANGUAGE

(CarbonFootprint Interface: Polymorphism) Using interfaces, as you learned in this chapter, you can specify similar behaviors for possibly disparate classes. Governments and compan

Create a compressed file that contains the eclipse project directory and a short document that describes:   the methods implemented any missing or incomplete elements o


Develop a Client/Server (MySQL) student record application Project Description: I need a client/server application with a MySQL backend database. The prototype could interfac

This project focuses on demonstrating the understanding of data types, input/output, sequential and selection programming statements, and mathematical operations. The project re