Sale!

Assignment #8 Functions

$30.00

Category:
Rate this product

Assignment #8
Introduction
You will complete one program to give you experience with:
• Functions
• Modules
• Default Parameters
Task 1
Programming Exercise 6.47
We are going to modify the requirements a bit. You will prompt the user for input. You will ask for
the starting location (x, y) and a height and width of the board. You will use this information to draw
the chessboard (just a single chessboard). Keep in mind that it may not be a square.
The user must enter the location, but if they do not enter a value for height or width you will use a
default value of 250. Note, that input() returns an empty string(“”) if the user just hits enter without
giving input. Here is some code that you must use in your program. It should be placed in a main()
function.
if width == “” and height == “”:
draw_chessboard(start_x, start_y)
elif width == “”:
draw_chessboard(start_x, start_y, width=eval(width))
elif height == “”:
draw_chessboard(start_x, start_y, height=eval(height))
else:
draw_chessboard(start_x, start_y, eval(width), eval(height))
Make sure to read the rubric to see the additional requirements.
Rubric
5 pts: Software Development Lifecycle Plan (see assn #5 for description)
10 pts: Get input properly from users. You may assume the users give valid input
5 pts: main() is the only function defined in main.py, which also calls main()
5 pts: Create a module called chessboard.py.
This contains all of the functions associated with drawing the board
10 pts: File main.py should be completed properly
See the starter file.
10 pts: Define draw_chessboard() with appropriate parameters
This should draw the board outline, then call…
10 pts: Define draw_all_squares() with appropriate parameters
This should handle drawing all of the black squares by calling…
NOTE: It may be easiest to call this function twice, but not required
10 pts: Define draw_square() with appropriate parameters
This should draw a single black square (This will be called many times!)
10 pts: A grid of 8×8 rectangles is properly drawn with alternating black/whites rectangles
Really this means to draw the black rectangles
20 pts: Proper output for any location, height and width values
Height and width can be different and can be blank (then use default)
Note: The location should be the bottom-left corner of the chessboard
5 pts: Follow proper coding conventions
Starter
Use the main.py file to get started. You should add to this file, but not modify any existing code. This
should give insight to the draw_chessboard() function definition you need to write.
Helpers
Remember that you can find solutions to the even programming exercises online. Check Canvas for a
link.
What/How To Turn In (READ THIS)
Submit your files on Canvas.

Open chat
Need help?
Hello
Can we help you?