CSSE 120 — Introduction to Software Development

Homework 15

Reminder: for each class session and associated homework:

Tasks

  1. Do the reading assignment for the next session.  Zelle Chapter 10.6 – 10.7.  Unless announced in class or by email there is no ANGEL quiz.
  2. (30 points) Checkout 15-Blackjack from your repository. (15-Blackjack will be available after class so that I can include the code we develop together in class.) Run the program to see how it works.  Here are a few sample runs that may be helpful to you as you implement your solutions to this problem.

    Add the following features to this code, and commit it back to your repository.
    1. Initially the program asks the user how many games to play.
    2. The program then takes the user through that many games. Do not get a new deck for each game, but continue to deal from the same deck. You may assume that the number of games is small enough so that the deck will not be exhausted (i.e., your program does not have to check for an empty deck).
    3. At the end of each game, print the number of games the user has won so far, the number lost, and the number remaining to be played. Do not use any new global variable or top-level constant in your code as you add these features.

    To add the features described above, you should adopt the following strategy:

    1. Rename your main() function to something like playOneGame().
    2. Add to that function's code the ability to return information about who won that game.
    3. Now write a new main function that repeatedly calls playOneGame and keeps track of wins/losses. You will probably need to move one line of code from playOneGame back to your new main function. Can you see why?

    You may also wish to refer to the structure diagram of the BlackJack program, which is included in the 15-Blackjack project.

  3. Web Link: Why all the spam references in CSSE120? Watch this video and find out the horrible truth.

Turn In

Be sure to commit your code to SVN when you’re finished, or more frequently.