# a function that uses a switch statement to determine the number of the nearest cross street for a given address and avenue number according to the preceeding alogorithm

Given: To locate the nearest numbered cross street for a given avenue address, the following algorithm can be used: cancel the last diget of the address, divide by 2, and add or subtract the number given in the following abbreviated table:

1st Ave. add 3

2nd Ave. add 3

3rd Ave. add 10

4th Ave. add 8

5th Ave. up to 200 add 13

5th Ave. up to 400 add 16

6th Ave. (Ave. of the Americas) Subtract 12

7th Ave. add 12

8th Ave. add 10

10 Ave. add 14

Write a function that uses a switch statement to determine the number of the nearest cross street for a given address and avenue number according to the preceeding alogorithm. Then write a program to test your function.

Â© BrainMass Inc. brainmass.com March 4, 2021, 6:09 pm ad1c9bdddfhttps://brainmass.com/computer-science/programming-language-theory/31583

#### Solution Summary

Write a function that uses a switch statement to determine the number of the nearest cross street for a given address and avenue number according to the preceeding alogorithm.