Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

In this assignment you will practice creating classes and enumerations in the context of a larger system. Overall, we are building pieces of an airline flight booking system. The classes that we are constructing in this assignment will take care of representing the flight data in Java. The final booking system should be able to searching for flights from a list of commercial airlines (e.g. American, United, or Delta), and locate various routes between two airports. The output is somewhat inspired by Google Flights. Don't panic! We go will through this system step by step. For the sake of simplifying the problem, we will make a couple of assumptions:
There is only one timezone.
All flights occur in the same day.
Already provided for you is a file called Driver.java. A "driver" is a common term for the main program that manages a set of objects, and manipulates them. It contains the entry point (main) for an entire project. The file you have been provided contains five static methods that can be called from main. These are testing methods that will run sample operations on the enumerations and classes you will be constructing. Initally, they are all commented out. As you implement parts of the assignment, you should uncomment lines in the test methods, in order to see how your program behaves. Also attached is the file sample_output.txt. This file contains the sample output for running this Driver with all of the included tests. You should check the output of your program against the sample output. Plan to test your files one at a time, for example: make sure to test your Airline and Airport enumerations before you start on Plane. Don't start working on Plane until those two classes work completely. Time is independent of Airline, Airport, and Plane, but is complicated enough that you'll want the experience of implementing those other questions before you started it.
Q1: Create an Airline enumeration. This is adatatypethat represents airlines in our system. Include three values: American, United, and Delta. This should be a single file containing theenumdeclaration. [2 points]
Q2: Create a smart Airport enumeration. This is a datatype that represents airports in our system, and has the ability to change from airport code and city name. Include five values: PHX, LAX, SFO, NRT, and SIN. Also add a static method called getAirportCity. This should be a single file containing the enum declaration, with the method declaration nested inside. (Hint:ExampleSmartEnum contains an example of including a method into an enumeration.) [8 points]
getAirportCity(...) will take an Airport enumeration value as a parameter, and return a String containing the city where that airport is located (e.g., "Phoenix", "Los Angeles", "Tokyo", "San Francisco"). Use a switch statement. Have a default case that returns "Unknown City". Do not implement the switch statement for SIN (Singapore) - we want to test the default case first.
Q3:Create a Plane class. This class will represent a plane in our system. It should contain a constructor, two instance variables (an Airline enumeration, and a String) and three methods (getAirline,getModel, toString) [10 points]
The constructor will take an Airline and String and use them to set up the instance variables.
getAirline(): will return the Airline of the plane (e.g., Airline.United).
getModel(): will return a String containing the model of the plane (e.g., "Boeing 737").
toString(): will return the name of the plane's airline (e.g., "United"), followed by a star (" * "), and the model of the plane (e.g., "Boeing 737").
Q4:Create a Time class. This class will represent a point in time, such as a departure time. It should contain 2 constructors, 2 instance variables (hour and minute), and 10 methods (see below). All methods but toString should be in terms of the 24 hour format. [30 points]
default constructor: Creates a Time object for 12:00AM.
overloaded constructor: Creates a Time object at a specific hour and minute.
getHour(): Returns an integer representing the hour of the Time object.
getMinute(): Returns an integer representing the minute of the Time object.
addHours(...): Updates the object by moving it forward a number of hours.
addMinute(...): Updates the object by moving it forward a number of minutes. (Hint: Be careful that you don't allow minutes to be more than 59.)
addTime(...): Updates the object by moving it forward by the hour and minute from another Time object.
getCopy(...): Returns a new Time object that has the same hour and minute of the existing Time object.
isEarlierThan(...): Returns true if this Time object is earlier than another Time object.
isSameTime(...): Returns true if this Time object is the same as another Time object.
isLaterThan(...): Returns true if this Time object is later than another Time object.
toString(): Returns a string representing the Time object. Uses 12 hour AM/PM format and pads minutes to be two digits. See the sample output for an example.
Q5:Create a Flight class that uses the Plane and Time class. This class will represent a flight between two airports, using a specific Plane, and departing at a specific Time. It should contain a constructor, 7 instance variables (plane, flight number, cost, departure, duration, source, destination), and 9 methods (see below). [25 points]
overloaded constructor: Creates a Flight object that is setup up with a Plane, a flight number, a cost, a departure Time, a duration time, a source Airport, and a destination Airport.
getPlane(): Returns the Plane that operates this flight.
getNumber(): Returns the flight number.
getCost(): Returns the flight cost.
getDestination(): Returns the destination Airport.
getDeparture(): Returns the departure Time.
getArrival(): Returns a Time object with the arrival time (computed from the departure time and duration).
getSource(): Returns a Airport object for the departure location.
toOverviewString(): Returns a String representing an overview of the flight. UseNumberFormatto display the price. See the sample output for an example.
toDetailedString(): Returns a String representing the flight's detail information. See the sample output for an example.

Attachment:- Java Code.rar

Java, Programming

  • Category:- Java
  • Reference No.:- M92408162
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in Java

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Can someone please help me with the following java

can someone please help me with the following java question The input is an N by N matrix of nonnegative integers. Each individual row is a decreasing sequence from left to right. Each individual column is a decreasing s ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Simple order processing systemquestion given the classes

Simple Order Processing System Question: Given the classes Ship (with getter and setter), Speedboat, and SpeedboatTest. Answer the following questions: Refine the whole application (all classes) and create Abstract class ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Can someone help me please with those question1what is the

Can someone help me please with those question 1:what is the best data type for student id datatime,currency,number,decimal 2:which relationshipis preferable? one to one,one to many,many to many 3:if you add table A's pr ...

Solving 2nd degree equationsbull write the following java

Solving 2nd degree equations • Write the following Java methods • boolean real-sols(double a, double b, double c): it returns true if the 2nd degree equation ax2 + bx + c has real solutions • double solution1(double a, d ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As