Prepare an implementation of the citypathconnector interface

Assignment Help Computer Engineering
Reference no: EM131984742

Assignment

This lab is about finding a path from some source city to a destination city. Cities are represented by the City enum in the provided jar file. CitySelector is a provided interface that determines a "next hop" city (the next city to go to). CityPathConnector is a provided interface that uses a CitySelector to determine a path from a given source city to a given destination city.

Starting from the source city, a CityPathConnector will get the next city to visit from its CitySelector. The CityPathConnector will repeatedly do this until the CitySelector presents the destination city, at which point the path is complete. The CityPathConnector needs to keep track of which intermediary cities were visited.

For example, a path from New York to Atlanta might be:

New York, Washington, Boston, Los Angeles, Atlanta

Note that the realistic practicality of the path is not a concern for this lab.

However, here's a caveat. The CitySelector may return null; this denotes that there are no paths from the current city. When this happens, the CityPathConnector needs to go back to the previously visited city.

For example, given a source of New York and destination of Atlanta, the first part of the path might be:

New York, Washington, Boston

If the next city to visit is null, then the path becomes

New York, Washington, Boston, Washington

And the CityPathConnector checks for a next city from Washington (a CitySelector will not present a city more than once).

From there, the path can be completed; for example:

New York, Washington, Boston, Washington, Charlotte, Atlanta

Or, it will be possible that the CitySelector will return a string of null values, denoting that there is no path to the destination; for example:

New York, Washington, Boston, Washington, New York (null value and done).

Values of null presented by the CitySelector denote dead-end cities. When this happens on a path, we will also want to know what the "direct" (for lack of a better term) path is. For example, if the full path is:

New York, Washington, Boston, Washington, Charlotte, Atlanta

Then the direct path is:

New York, Washington, Charlotte, Atlanta

And when there is no path to the destination, the direct path will be empty. For example (going from New York to Atlanta):

Full Path: New York, Washington, Boston, Washington, New York Direct Path: (empty)

Part 1

1. Create an implementation of the CityPathConnector interface.

a. Use the stack data structure (java.lang.Stack) in your implementation.

Part 2

There are three ways to test and validate your implementation, as follows.

1. Use the RandomCitySelector which will present cities or null values in random order. A null value has equal chance as any eligible city to be presented.

2. Use the ListCitySelector. This allows you to hard code a city order so you can test specific test cases.

3. Use CityPathConnectorTester. This will automatically run your CityPathConnector against a series of predefined test cases and will show you which test cases were failed, if any.

Reference no: EM131984742

Questions Cloud

Value of the bond if interest rates unexpectedly increased : Calculate the value of the bond. Calculate the value of the bond if interest rates unexpectedly increased by 1%.
Describe what buffett means by float : Describe what Buffett means by "float" and "underwriting profit" in his overview of Berkshire's insurance business.
Construct a histogram showing percent frequency distribution : HI6007 Group Assignment - Construct a histogram showing the percent frequency distribution of the furniture-order values in the sample
How much will you pay for the policy : Calculating Perpetuity Values. Curly's Life Insurance Co. is trying to sell you an investment that will pay you and your heirs $25,000 per year forever.
Prepare an implementation of the citypathconnector interface : Prepare an implementation of the CityPathConnector interface. Use the ListCitySelector. This allows you to hard code a city order so you can test specific test.
Returns level stream of four annual payments : Consider an investment scenario that returns a level stream of four annual payments of $10,000 each (i.e., an annuity).
What is present value of the investment : What is the present value of the investment at a discount rate of 8%?
Why does chekov subtitle this play a comedy in four acts : With all that in mind, why does Chekov subtitle this play A Comedy in Four Acts?
How much will you have at the end of ten years : In Year 1, you plan to deposit $3000. In year 2 and Year 3, you plan to deposit $4000 and in Year 4 and 5, you plan to deposit $5000.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd