Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A bus route is represented by using a list of all bus stops on that route from source to destination inclusive. For example, the bus

A bus route is represented by using a list of all bus stops on that route from source to destination inclusive. For example, the bus route connecting Amman and Sult cities is a list of the following main bus stops: Amman, Swaileh, Beer-Albahsa, and Sult. Each route is a given a unique integer identification number. Write an ADT Route representing a bus route which should satisfy the following specifications:

1. [2] Immutable. 2. [2] Hides the abstraction barrier using a makeRoute method in the interface. 3. [3] Re-implements toString, equals, and hashCode. 4. [2] Provides a method interset which takes a Route object and returns a List of all shared bus stops. 5. [4] Demonstrate your solution by a. Create a route ID = 15, from Amman to Al-Sult, bus stops = [Shamal, Dakhliyya, Jordan University, Beer-Albahsa, Sult]. b. Create a route ID = 20, from Raghadan to Jordan University, bus stops = [Raghadan, Dakhliyya, Jordan University]. c. Print the route using toString method formatted as follows: ID: nn, Bus Stops: stop1, stop2, ..., last stop. d. Use the intersect method to find the shared bus stops of routs 15 and 20, and print these stops.

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

Advanced Level Audit And Assurance Exam Room Notes 2017

Authors: ACA Simplified

1st Edition

1545501653, 978-1545501658

More Books

Students also viewed these Accounting questions