V22.0005 - Spring 2002
Assignment # 1

Due: Tuesday, Feb. 5th

 

This is a simple programming assignment involving arrays. It may be programmed in any language of your choice: Pascal, C, Java, Ada, etc., etc. It may also be run on any platform of your choice: Mac, Windows, UNIX, etc. There are many compilers available at the University, and you are probably familiar with one or more.

For this assignment ONLY, you are to turn in a hard copy of the program, a printed copy of some sample output, and a disk with the source code on it. CLEARLY indicate what language and compiler you are using, and what platform it will run on. Make certain you put all of the required items inside of an envelope so they can't get separated.

Basically, you are to set up an array which is thirteen postions long, which will represent the ranks of a suit of cards: That is the cards Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, and King. Using a random number generator, pick 100 cards at random, printing out the results as you go along and counting which card you have drawn in the array. Once you have picked all 100 cards, print out how many of each rank the computer chose. Finally, print out what the HIGHEST count was, and which card or cards received that count.

A portion of the output might look like:


Here are your cards: Card # 1 = Ace
Card # 2 = 10
Card # 3 = 9
Card # 4 = King
Card # 5 = 9
.
.
.
Card # 99 = Ace
Card # 100 = 7
You were dealt an Ace 7 times. You were dealt a 2 card 9 times. . . You were dealt a King 9 times. The highest count was 9, and was found on a 2 card and King.