Topics: Strings, Input, Selection (if-else)
Each square on a chess board can be described by a letter and number:
The following pseudocode describes an algorithm that determines whether a square with a given letter and number is dark or light.
If the letter is a, c, e, or g If the number is odd color = "dark" Else color = "light" Else If the number is even color = "dark" Else color = "light"
Write ChessSquares.java
to input a letter and number and output whether the specified square is dark or light.
Assume that the variables letter and color are of the String type. Assume that the number variable is of int type. Use only String and int types for this program.
Sample input/output:
Input the square's letter: a Input the square's number: 5 That square's color is: dark
In ChessSquares2.java, use a method called getSquareColor that returns a square color based on a square letter and square number that is passed as input to getSquareColor. The same input/output must be the same as ChessSquares.java.