Share
Explore BrainMass

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.

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.

$2.19