Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

More Books

Students also viewed these Databases questions

Question

How will it be used?

Answered: 1 week ago

Question

3. Design a program for preparing for cross-cultural assignments.

Answered: 1 week ago

Question

2. Develop a program for effectively managing diversity.

Answered: 1 week ago

Question

7. What is coaching? Is there only one type of coaching? Explain.

Answered: 1 week ago