Declare a Dog
class with
two private members: weight
(an
int
), and name
(a string
). Be sure to add properties to
access the members. Then create an array that holds three Dog
objects (Milo, 26 pounds; Frisky, 10 pounds; and Laika, 50
pounds). Output each dog’s name and weight.
Create an array of 10 integers. Populate the array by having
the user enter integers at the console (use Console.Readline
). Don’t worry about
error-checking for this exercise. Output the integers sorted from
greatest to least.
Extend Exercise 10-1 by creating a two-dimensional array that represents a collection of strings that indicate the awards each dog has won at dog shows. Each dog may have a different number of awards won. Output the contents of the array to check its validity.
Create a two-dimensional array that represents a chessboard (an 8 × 8 array). Each element in the array should contain either the string “black” or “white,” depending on where it is on the board. Create a method that initializes the array with the strings. Then create a method that asks the reader to enter two integers for the coordinates of a square, and returns whether that square is black or white.