Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Description You live in a city in which all roads are oneway. Streets run East/West, while Avenues run North/South (for a visualization of this, look

Description You live in a city in which all roads are oneway. Streets run East/West, while Avenues run North/South (for a visualization of this, look at any map of Manhattan). All streets and avenues are numbered: lowernumbered streets are furthest south, and lowernumbered avenues are furthest east. There are 100 Streets and 10 Avenues; so 1st Street and 1st Avenue is the most southeastern point of the city, while 100th street and 10th avenue is the most northwestern point of the city. The oddnumbered Streets (1st Street, 3rd Street, etc) go from West to East, while evennumbered Streets go from East to West. Oddnumbered Avenues go from South to North, while evennumbered Avenues go from North to South. For the purposes of simplicity, assume that the distance between two consecutive streets is the same as the distance between two consecutive avenues. We will refer to this distance as one block (or a cityblock).

Project You are to write a Java program which asks the user to input in a starting position (a starting Street and a starting Avenue) and an ending position (a destination Street and a destination Avenue), and output a list of directions that one can take, by car, to go from the starting position to the ending position. Also output the total number of cityblocks traveled during this trip.

Example Here are some examples of output: 1) Enter in a starting street: 10 Enter in a starting avenue: 1 Enter in a destination street: 10 Enter in a destination avenue: 2 Directions: Start at 10 Street and 1 Avenue. Go west on 10 Street for 1 block. Arrive at 10 Street and 2 Avenue. You drove 1 blocks. https://docs.google.com/document/d/1y0YnvOMzjZbFI8X7c1d16shYIkTm_2JCNkzUaBuVKJM/edit#heading=h.oaffr4vip2zp 1/3 2/7/2019 Project 1: City Grid Navigation - Google Docs 2) Enter in a starting street: 10 Enter in a starting avenue: 2 Enter in a destination street: 10 Enter in a destination avenue: 1 Directions: Start at 10 Street and 2 Avenue. Go south on 2 Avenue for 1 block. Go east on 9 Street for 1 block. Go north on 1 Avenue for 1 block. Arrive at 10 Street and 1 Avenue. You drove 3 blocks.

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 M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

Students also viewed these Databases questions