SuperTutor

(15)

$15/per page/Negotiable

About SuperTutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Business & Finance See all
Accounting,Business & Finance,Economics,Engineering,HR Management,Math Hide all
Teaching Since: Apr 2017
Last Sign in: 232 Weeks Ago, 6 Days Ago
Questions Answered: 12843
Tutorials Posted: 12834

Education

  • MBA, Ph.D in Management
    Harvard university
    Feb-1997 - Aug-2003

Experience

  • Professor
    Strayer University
    Jan-2007 - Present

Category > Programming Posted 18 May 2017 My Price 9.00

Create a Time class

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. Use NumberFormat to 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.

Included below is an overall UML diagram that describes the three classes you will be constructing. It provides a useful summary of all of the methods you are expected to implement, and their corresponding types and visibility. Notice that one private method is listed here (formatDigits in Time) that isn't mentioned above. This is a method that was in our solution, you may not need it in your answer. Conversely, you may implement additional private methods that you find useful.

Answers

(15)
Status NEW Posted 18 May 2017 03:05 AM My Price 9.00

-----------

Attachments

file 1495077179-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)