CSci A201/A597
Frequently Asked Questions on Lab #7


General Questions


Questions About Iuess2.java

  1. The solution for the Iguess program from lab 5 seems to be wrong - it tries larger numbers even if I say "s" as the first response.

    Well, the specification of the assignment was like this: if the number the computer guesses is too big, then the user responds with "b", then the computer guesses a smaller number, since the last guessed number was too big.

  2. Although you say the machine should guess between 1 and 15, the machine still guesses 1. How come?

    I should have specified that the limits are inclusive. So 1 and 15 could be valid guesses in the above case. For this assignment, the user should guess a number between 1 and the upper bound, both inclusive. So, if the upper bound is 100, both 1 and 100 can be valid guesses.


Questions About Cards.java

  1. I know how to generate a random number, but how do I generate things like Ace, King, Queen, Jack? Is there something like a randomString?

    Well, no, but you can generate a number between 1 and 13, and have an if statement after that which generates the proper string based on the number (i.e., generate "Ace" if the number is 1, etc.)

  2. Can you give me some hints about how to organize my program?

    OK, here are a couple of things to consider:

  3. If the random total the dealer gets is equal to the total of the player, then who wins?

    In a tie situation, the player wins, not the dealer.

  4. My BlackJack program gives prints the name of a numeric card spelled out. For example, I print

    You are dealt a seven.

    as opposed to

    You are dealt a 7.

    Do you prefer one way over the other?

    No. Either way is fine... whatever you prefer...


Last modified: Wed Mar 31 17:21:32 EST 1999