Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create three classes, each representing a different mode of transportation. To ensure all methods of travel give standardized information to the clients, create an interface

Create three classes, each representing a different mode of transportation. To ensure all methods of travel give standardized information to the clients, create an interface that all three classes must implement. Use a driver class to create and display your objects and demonstrate each running the methods designated in the interface.

Next you will get information from the user, compare different transportation options for that user, and display the options for the user in ranked order, best first.

Remember to comment your work with your name, the date, and a general description of the program at the top of each of your files. You should also put appropriate comments in the code. (-1 for lack of comments)

What you need

1. An Interface with three methods

  • Price, Speed, and Tagline

  • The price and speed, when implemented, should return different results based on the instance of the class. Tagline need not be unique for every instance.

2. Three transportation classes

  • Each representing a different mode of transportation

  • Implementing the interface

  • With at least two attributes, constructors, get and set methods for each attribute, and a toString method.

3. A driver class

  • At least two instances of each of the classes you created, (Total >= 6 instances), stored in an ArrayList.

  • Printing a list using the toString method of each class

  • Then asking the user the appropriate questions for:

    • The distance they will be traveling.

    • The most they are willing to pay.

    • Whether they care more about how fast they get there or how expensive their transportation is.

    • Three methods (see below)

a. UnderMaxPrice, which will take in the max price the user is willing to pay and your ArrayList containing the instances of your transportation classes. The method will then return an ArrayList of options under the max price.

b. Fastest, which will take in two generic objects and return the object that has the shortest travel time.

c. Cheapest, which will take in two generic objects and return the object that has the lowest cost.

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

Successful Keyword Searching Initiating Research On Popular Topics Using Electronic Databases

Authors: Randall MacDonald, Susan MacDonald

1st Edition

0313306761, 978-0313306761

More Books

Students also viewed these Databases questions