Difference between revisions of "CSC111 Homework 6 2014"

From dftwiki3
Jump to: navigation, search
(Created page with "--~~~~ ---- =Problem #1= <br /> Study the solution programs for the chessboard section of Lab 6. Make sure you under...")
 
(Problem #1)
Line 8: Line 8:
 
Your assignment is write a program that asks the user for an integer that is greater than or equal to 0, and that displays a chessboard  with that dimension.  The chessboard uses a 3x3 block to represent each cell of the board.
 
Your assignment is write a program that asks the user for an integer that is greater than or equal to 0, and that displays a chessboard  with that dimension.  The chessboard uses a 3x3 block to represent each cell of the board.
  
Below is an example of how your program should behave.  The user input is in boldface.
+
Below is an example of how your program should behave if the user enters 8 for the dimension (the user input is in boldface):
  
 
  Enter dimension of board: '''8'''
 
  Enter dimension of board: '''8'''
  ###....###....###....###....
+
  ###...###...###...###...
  ###....###....###....###....
+
  ###...###...###...###...
  ###....###....###....###....
+
  ###...###...###...###...
  ....###....###....###....###
+
  ...###...###...###...###
  ....###....###....###....###
+
  ...###...###...###...###
  ....###....###....###....###
+
  ...###...###...###...###
  ###....###....###....###....
+
  ###...###...###...###...
  ###....###....###....###....
+
  ###...###...###...###...
  ###....###....###....###....
+
  ###...###...###...###...
  ....###....###....###....###
+
  ...###...###...###...###
  ....###....###....###....###
+
  ...###...###...###...###
  ....###....###....###....###
+
  ...###...###...###...###
  ###....###....###....###....
+
  ###...###...###...###...
  ###....###....###....###....
+
  ###...###...###...###...
  ###....###....###....###....
+
  ###...###...###...###...
  ....###....###....###....###
+
  ...###...###...###...###
  ....###....###....###....###
+
  ...###...###...###...###
  ....###....###....###....###  
+
  ...###...###...###...###
  ###....###....###....###....
+
  ###...###...###...###...
  ###....###....###....###....
+
  ###...###...###...###...
  ###....###....###....###....
+
  ###...###...###...###...
  ....###....###....###....###
+
  ...###...###...###...###
  ....###....###....###....###
+
  ...###...###...###...###
  ....###....###....###....###
+
  ...###...###...###...###
   
+
 
>>>
+
Here is another example where the user enters 1:
 +
 
 +
Enter dimension of board: '''1'''
 +
###
 +
  ###
 +
###

Revision as of 19:14, 3 March 2014

--D. Thiebaut (talk) 19:11, 3 March 2014 (EST)


Problem #1


Study the solution programs for the chessboard section of Lab 6. Make sure you understand the program(s). Remember, it's ok to play with programs, to insert additional print statements here and there to see what happens, how the programs behave under different tests.

Your assignment is write a program that asks the user for an integer that is greater than or equal to 0, and that displays a chessboard with that dimension. The chessboard uses a 3x3 block to represent each cell of the board.

Below is an example of how your program should behave if the user enters 8 for the dimension (the user input is in boldface):

Enter dimension of board: 8
###...###...###...###...
###...###...###...###...
###...###...###...###...
...###...###...###...###
...###...###...###...###
...###...###...###...###
###...###...###...###...
###...###...###...###...
###...###...###...###...
...###...###...###...###
...###...###...###...###
...###...###...###...###
###...###...###...###...
###...###...###...###...
###...###...###...###...
...###...###...###...###
...###...###...###...###
...###...###...###...###
###...###...###...###...
###...###...###...###...
###...###...###...###...
...###...###...###...###
...###...###...###...###
...###...###...###...###

Here is another example where the user enters 1:

Enter dimension of board: 1
###
###
###