Question: In Java I have made the required method, but I'm not sure as to what needs to go in it. the requirement is as follows:

In Java I have made the required method, but I'm not sure as to what needs to go in it.

the requirement is as follows:

Abstract addFlightToHistory which takes an int representing the flight duration.

My code:

abstract class Traveler { public static int nextIDNum = 0; private String name; private static int paxCreated = 0; private int id; private Location location; Traveler () { this("Bubba"); System.out.println("Name is required. Calling this traveler Bubba"); this.name = null; this.location = null; nextIDNum = 1; this.id = nextIDNum; nextIDNum ++; } Traveler (String name) { this(name, Location.EARTH); System.out.println("Location is required. Calling this location EARTH"); } Traveler (String name, Location location) { this.name = name; this.location = location; this.id = ++Traveler.paxCreated; nextIDNum = 1; id = nextIDNum; nextIDNum++; }

public void setLocation (Location l) { this.location = l; }

public Location getLocation () { return this.location; }

public String getName () { return this.name; } public void setId() { id = nextIDNum; nextIDNum++; }

public int getId () { return this.id; } public String toString () { return "[name = "+ this.name +", id = " + this.id + ", current = " + this.location + "]"; }

public void addFlightToHistory() { // TODO Auto-generated method stub } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!