Your task is to write python program that draws a board with alternating dark cells (black or some other color) and white cells. The number of cells to use in each row or column, width of each cell, and color to use for dark cells (either black, red, green, or blue) should be collected from the keyboard after showing appropriate inpat prompt messages. Note the following requirements: The program can either start with a dark (colored) cell or white cell. In the figure below, the board starts with dark cell. The program should draw an N by N board where N is the number of cells in a row (or a column). Note that the shape of board and the cells are both square. should draw a border (black line) around the board as shown in the figure. from the keyboard and then validate the input as follows: The program The program must prompt for input Number of cells in each row or column must be positive number > 1 Width of each cell must be a positive number > 9 The color can be one of 4 colors only: black, red, green or blue. If any of the provided input is invalid then the program should show a warning message and use the default value for that variable as follows: 8 for the number of cells, 25 for the cell width and black for the color of the dark cells.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section: Chapter Questions
Problem 14PP
icon
Related questions
Question
Turtle method
CD Page view
A Read aloud
V Draw
Highlight
Preface
The
of this assignment is to learn how to use nested loops and Turtle graphics library to draw
purpose
complex patterns in Python programming language.
Problem Definition
Your task is to write python program that draws a board with alternating dark cells (black or some other color)
and white cells. The number of cells to use in each row or column, width of each cell, and color to use for dark
cells (either black, red, green, or blue) should be collected from the keyboard after showing appropriate inpat
prompt messages. Note the following requirements:
The program can either start with a dark (colored) cell or white cell. In the figure below, the
board starts with dark cell.
The program should draw an N by N board where N is the number of cells in a row (or a column).
Note that the shape of board and the cells are both
square.
The program should draw a border (black line) around the board as shown in the figure.
The program must prompt for input from the keyboard and then validate the input as follows:
Number of cells in each row or column must be positive number > 1
Width of each cell must be a positive number > 9
The color can be one of 4 colors only: black, red, green or blue.
If any of the provided input is invalid then the program should show a warning message and use
the default value for that variable as follows: 8 for the number of cells, 25 for the cell width and
black for the color of the dark cells.
Transcribed Image Text:CD Page view A Read aloud V Draw Highlight Preface The of this assignment is to learn how to use nested loops and Turtle graphics library to draw purpose complex patterns in Python programming language. Problem Definition Your task is to write python program that draws a board with alternating dark cells (black or some other color) and white cells. The number of cells to use in each row or column, width of each cell, and color to use for dark cells (either black, red, green, or blue) should be collected from the keyboard after showing appropriate inpat prompt messages. Note the following requirements: The program can either start with a dark (colored) cell or white cell. In the figure below, the board starts with dark cell. The program should draw an N by N board where N is the number of cells in a row (or a column). Note that the shape of board and the cells are both square. The program should draw a border (black line) around the board as shown in the figure. The program must prompt for input from the keyboard and then validate the input as follows: Number of cells in each row or column must be positive number > 1 Width of each cell must be a positive number > 9 The color can be one of 4 colors only: black, red, green or blue. If any of the provided input is invalid then the program should show a warning message and use the default value for that variable as follows: 8 for the number of cells, 25 for the cell width and black for the color of the dark cells.
pdf
browser.
Complete setup
Maybe later
(D Page view A Read aloud
Draw
A
Program Input/Output
The table below shows sample test cases with input prompts and corresponding output in Turtle canvas that
can be used to debug/test your program. It is recommended to test your program thoroughly and not depend
only on the provided test cases.
Input Prompts
Output (Turtle canvas)
Enter number of cells in board: 2
Enter the width of each cell: 30
Enter the color (black or red or green or blue): black
Enter number of cells in board: 5
Enter the width of each cell: 15
Enter the color (black or red ór green or blue): blue
Enter number of cell5 in board: 8
Enter the width of each cell: 25
Enter the color (black or red or green or blue): red.
Enter number of cells in board: 1
Enter the width of each cetty 5
Enter the cotor (btack or red or green or bluel yetlow
harningr Invalid nurter for the Cells
Ustog defautr value of cetls Insteadt
ustng defatt vtue of25-4nstead
UAng defaltbtack cotor ipstead
Transcribed Image Text:pdf browser. Complete setup Maybe later (D Page view A Read aloud Draw A Program Input/Output The table below shows sample test cases with input prompts and corresponding output in Turtle canvas that can be used to debug/test your program. It is recommended to test your program thoroughly and not depend only on the provided test cases. Input Prompts Output (Turtle canvas) Enter number of cells in board: 2 Enter the width of each cell: 30 Enter the color (black or red or green or blue): black Enter number of cells in board: 5 Enter the width of each cell: 15 Enter the color (black or red ór green or blue): blue Enter number of cell5 in board: 8 Enter the width of each cell: 25 Enter the color (black or red or green or blue): red. Enter number of cells in board: 1 Enter the width of each cetty 5 Enter the cotor (btack or red or green or bluel yetlow harningr Invalid nurter for the Cells Ustog defautr value of cetls Insteadt ustng defatt vtue of25-4nstead UAng defaltbtack cotor ipstead
Expert Solution
steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr