CMPS 1044 – Program 3 – Fall 2016 – If/Else

advertisement
CMPS 1044 – Program 3 – Fall 2016 – If/Else
Division of Nlogonia
Problem Solving Steps: Not Required
Program Due: Friday, March 18 (Note, this is the last day before Spring Break so it MUST be turned in by this
date or you will have SIGNIFICANT late points deducted.
After centuries of hostilities and skirmished between the 4 nations located in the land generally known as
Nlogonia, and years of negotiations involving diplomats, politicians, and armed forces of all interested parties,
with mediation by UN, NATO, G7, and SBC, it was at last agreed by all, the way to end the dispute was to
divide the land into 4 independent territories.
It was agreed that one point, called the Division Point, with coordinates to be established in the
negotiations, will define the country division. Two lines, both containing the division point, one in the NorthSouth direction and one in the East-West direction, willhny be drawn on the map, dividing the land into 4 new
countries with names as shown below on the map.
Comanche
Kiowa
Comanche
Tepee
Nocona
Division Point
The UN determined that as negotiations continue, a page on the Internet should exist so that the inhabitants
can check to determine in which of the countries their homes are potentially to be located. You have been
hired to help implement the online system.
Input Testing
Before launching the online site, the program you are writing must be tested. For each data set (there will be
3 data sets), the first pair of integers will be the division point, followed by a list of coordinate pairs, each
representing a specific location. The program must determine in which country the location resides. Print out
the coordinate points and the country name, in aligned columns. If a pair of points lies on a line, print the
coordinate pair followed by the word DIVISA. You will read until the end of the file. ~~ Repeat for the 2
additional files.
Sample file
1 1
11 7
-42 -50
-30 1
Sample output
11
-42
-30
7
-50
1
Kiowa
Nocona
DIVISA
3 data files will be posted Monday, March 14. Until then, use your own data. Print your code only once but
print all 3 output files for turning in. All documenting standards, output formatting, etc. are required.
Download