Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Java Assignment (Flight)

joemomma1018
joemomma1018 


Design and implement a class called Flight that represents airline flight. It should contain instance data that represent the airline name, the flight number, and flight's origin and destination cities. Define the Flight constructor to accept and initialize all instance data. Include a toString method that returns a one line description of the flight. Create a driver class called FlightTest, whose main method instantiates and updates several Flight objects. Attachments
Tags Clarifications

Answers

Java Assignment (Flight) Solution

mariobeka
mariobeka 



Below you will find the solution to your problem. Attachments
Flight.zip (1 K) Download
Preview
Constructor initializing. * * @param airlineName the flight airline name * @param flightNumber the flight number * @param origin the origin city * @param destination the destination of this flight. */ public Flight(String airlineName, String flightNumber, String origin, String destination) { this.airlineName = airlineName; this.flightNumber = flightNumber; this.origin = origin;

Preview
System.out.println(flight); flight.setAirlineName("US Airways"); System.out.println(flight); flight.setDestination("Miami"); System.out.println(flight); flight.setFlightNumber("US3134");

Screen Shot 2015-04-01 at 5.41.04 AM.png (56 K) Download Preview

Screenshots
Screenshot
Purchase Answer

Solutions

zkingleo2009
zkingleo2009 



Attached is the solution to the given problem. Attachments
flight.zip (1 K) Download
Preview
this.origin = origin; } public int getFlightNo() { return flightNo; } public String[] getDestinations() { return destinations; } public String getAirlineName() { return airlineName; } @Override public String toString() { return "Flight

Preview
String[] destinations = {"LA", "SA"}; Flight f = new Flight(flightno, airline, origin, destinations); System.out.println(f.toString()); System.out.println("Now changing

Screenshots
Purchase Answer

Flight

uetian_cute
uetian_cute 



The flight class and a driver class to test the flight class are included and also a screenshot of output. Attachments
Flight.zip (13 K) Download
Preview

Preview
private int number; public Flight(String n, int num, String o, String d) { this.name=n; this.number=num; this.origin=o; this.destination=d; } public String getName() { return name; } public void setName(String n)

Preview
* @param args */ public static void main(String[] args) {

Screenshots
Screenshot
Purchase Answer