Quiz 06

  • Due Feb 17, 2016 at 10:10am
  • Points 5
  • Questions 2
  • Available after Feb 9, 2016 at 11:53am
  • Time Limit None
  • Allowed Attempts Unlimited

Instructions

Each square on a chess board can be described by a letter and number, such as g5 in the example on p. 115 of Horstmann. (Letters a through h, numbers 1 through 8.)

The following pseudocode describes an algorithm that determines whether a square on a chessboard with a given letter and number is dark (black) or light (white). (See Horstmann exercise R3.7 p. 115 for a picture.)

If the letter is an a, c, e, or g
  If the number is odd
    color = "black"
  Else
    color = "white"
Else
  If the number is even
    color = "black"
  Else
    color = "white"

Only registered, enrolled users can take graded quizzes