Create a flight class that uses the plane and time class

Assignment Help JAVA Programming
Reference no: EM131599449

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

Reference no: EM131599449

Questions Cloud

How does the amish approach to dolls reflect their worldview : The Catholic Church has a long history of social action. Describe two examples of Catholics taking action to improve the lives of people.
Smokers first start to smoke varies : From generation to generation, the mean age when smokers first start to smoke varies.
Identify a popular news story : Debate which of the major new outlets in the U.S. is the most biased and why. First, identify a popular news story.
Information about overweight adolescents : Enter the following information about overweight adolescents in 1999-2000 into Excel: Children less than 2 years old were 11.6
Create a flight class that uses the plane and time class : 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
Probability of rain and a cancellation : Probabilty of rain is .30. Probabilty of game being cancelled, given it raining, is .50. Whats the probability of rain and a cancellation?
Sampling distribution of the proportion of milk chocolate : Construct the sampling distribution of the proportion of milk chocolate candy bars.
The article you choose can relate to various disciplines : The article you choose can relate to various disciplines within the topics discussed in the modules. For example, your article may cover sport management.
Write a procedural email message to employees reminding them : Write a procedural email message to employees reminding them of standard operating procedures or organizational changes that take the form of step-by-step.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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