Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Description of the application The code is a slice of a larger application that sells tickets for airline fights. The first slice developed includes only
Description of the application
The code is a slice of a larger application that sells tickets for airline fights. The first slice
developed includes only the classes required to perform the very specific tasks of issuing a ticket,
assigning a seat to a passenger, and building up the manifest or list of passengers on a specific
flight.
Your starting position is a prototype that has a very simple command line interface so that the
complications of a Web application or graphical user interface are eliminated. Most of the
classes and associations between classes are shown in the class diagrams on page
Business rules
There are two classes of seats: Economy and Business.
A business class ticket costs $ and an economy seat costs $
Passengers may be frequent flyers, airline employees but not both or neither.
Airline employees get a discount on economy seats, but not on business class seats.
Frequent flyers get no discount but have privileges outside the scope of this slice of the
application.
Notes
For this slice of the application, passengers have already selected a specific flight and day.
Invoicing and payment processing are handled by a separate subsystem.
For simplicity, the test airplane has very limited seating of only seats.
Row is business class and has one seat on either side of the aisle: A and B Rows
and are economy class and have two seats on either side of the aisle: A B C and D
No persistent data databases is used.
All output goes to the console command line IO The placeholder classes Manifest and
UserPrompter will be replaced by a GUI user interface at a later time in development.
COMP Assignment : Debugging exercise
Page of
What the provided code should do requirements:
The Manifest class is the main program for this slice of the application.
User interface asks each passenger whether she want to purchase a ticket. If the answer is
no the program stops as this situation simulates end of ticket sales.
The UI first asks whether the passenger wants business class and then, if no economy class
The UI asks for the passenger name and whether the passenger is a frequent flyer or member
of the airline staff.
At this point, the UI invokes the core business logic to sell a ticket.
The application should check whether a suitable seat is available. Passengers cannot choose
their seat: the application assigns one. It issues a ticket and calculates the ticket price. Then it
prints out the ticket details.
Before ending, the Manifest class prints a list of all seats followed by the name of the
passenger who owns a ticket for that seat or the word Available if the seat was not sold.
Notes:
The seating plan is generated by the constructor of the SeatingPlan class and can be modified
easily by changing the enumeration type SeatingClass. You can assume these two classes have
already been tested and have no errors. In other words, dont worry if you dont understand their
code.
Instructions
You are given a JAR that contains source code.
Import the Java source into Eclipse. Follow instructions from the instructor if you are not
familiar with Eclipse
Run the program a few times to see how it works. You should see clear evidence of bugs.
Use the debugger to trace what is going wrong. Resist the temptation to just read the code
looking for bugs. The instructor will walk you through using the debugger to determine
what code causes at least one of the problems.
Continue to debug and fix bugs as you go until you are satisfied you have done all that
you can with this code.
FrequentFlyer.class:
package com.ccairline.passengers;
public class FrequentFlyer extends Passenger
private String fFlyerId;
public FrequentFlyer PassengerName pName, String fFlyerId
superpName;
this.fFlyerId fFlyerId;
public String getFFlyerId
return fFlyerId;
public void setFFlyerIdString flyerId
fFlyerId flyerId;
Passenger.class
package com.ccairline.passengers;
public class Passenger
private PassengerName pName;
public Passenger
this.pName new PassengerNameTBA;
public PassengerPassengerName pName
this;
this.pName pName;
public PassengerName getPName
return pName;
public void setPNamePassengerName name
pName name;
PassengerName.class
package com.ccairline.passengers;
public class PassengerName
private String firstName;
private String lastName;
private String mInitial;
public PassengerNameString first, String middle, String last
firstName first;
mInitial middle;
lastName last;
public PassengerNameString first, String last
firstName first;
lastName last;
public String toString
String name firstName;
if mInitial null && mInitial.length
name mInitial;
return name lastName;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started