Assigned: Friday, January 26
Due: Thursday, February 1, 2018 by 11:55pm (on Moodle)
Description
You are playing a strange game of darts with a square board that looks like the image below. Pretend there is a grid on the board similar to the regular x-y Cartesian coordinate system. The lower left corner of the board is at position (0, 0) and the upper right corner is at (40, 40).You earn points in this game of darts depending on what color the square is that you hit. Red squares are worth 5 points, yellow squares are 10 points, and blue squares are 15 points. If the dart lands off the board, no points are earned.
You may work with ints or floats. You should assume that if the dart lands on a vertical dividing line, the points are awarded for the region to the right, and if the dart lands on a horizontal dividing line, the points are awarded for the region above.
You MUST define a main() function for your program and call it. You do not need to use any other functions unless you so desire. (The primary point of this program is to test your if/else skills; there will be other programs later to test your function skills.)
Test your program on lots of examples, including the sample ones below, and make sure they work correctly. Your program should work correctly for all reasonable inputs, not just the sample ones below.
Make sure to include comments in your code that describe what the program does as a whole, what each separate function does (if you write functions other than main), and what any complicated sections of code do. You should feel free to use more comments if you so desire. Follow the instructions in the comment guide.
Your code does not need to follow this script verbatim, but all the mentioned functionality should work as shown.Test 1
(Program begins) What is the x-coordinate where your dart landed? 15 What is the y-coordinate where your dart landed? 9 (Program determines the dart is in a red region.) You win 5 points! (Program ends)Test 2
(Program begins) What is the x-coordinate where your dart landed? 20 What is the y-coordinate where your dart landed? 10 (Program determines the dart is in a blue region.) You win 15 points! (Program ends)Test 3
(Program begins) What is the x-coordinate where your dart landed? 5 What is the y-coordinate where your dart landed? 0 (Program determines the dart is in a yellow region.) You win 10 points! (Program ends)Test 4
(Program begins) What is the x-coordinate where your dart landed? -1 What is the y-coordinate where your dart landed? -1 (Program determines the dart is off the board.) You win 0 points! (Program ends)Test 5
(Program begins) What is the x-coordinate where your dart landed? 100 What is the y-coordinate where your dart landed? 150 (Program determines the dart is off the board.) You win 0 points! (Program ends)
Requirements
A good program will do all of the following:
Your program will be graded on correctness, as well as on coding style, which refers to choices you make when writing your code, such as good use of variable names, appropriate indentation, and comments (this is not an exhaustive list). See the syllabus for further grading details.
You will receive one bonus point for every complete day your program is turned in early, up to a maximum of five points. For instance, if your program is due on September 20 at 11:59pm, if you turn in your code on Moodle any time on September 19 from 12:00am through 11:59pm, you will receive one extra point on your project. Programs submitted on September 18 from 12:00am through 11:59pm will receive two points. This pattern continues for up to five points.