Assignment 06

Due: Wednesday, March 9, 2016 at noon 100 pts

You know how to submit; do it in the usual way. However, this time you will submit multiple files for this programming project. The cssubmit script will work as usual, picking up all .cpp and .h files in the current directory. So, make sure you have created a separate directory for your hw 6 program. Do not create sub-directories in the hw6 directory.

Background: The background for hw 6 is hw 4. That's right, you are going to rewrite hw #4, but this time using functions. And, there is to be a modification.

Specifications: Rewrite the program as described in hw #4 this semester, but this time you are to fully use functions to accomplish the task. Also, we are NOT going to specify the functions you are to use. YOU are going to make these decisions. Make your choice of functions wisely because you are going to be graded on how well you do this! Subjective?? Yes, but that's life. Now, you have a lot of freedom here in how you do this, but the overall goal is simple: make the code more readable, more modular, more versatile. One thing you DON'T want to do is to simply rename main:

When you submit: Seed the random number generator with the value 5 (for consistent results from everyone for the purposes of grading). And..

  • choose option 3

  • choose option 1

  • choose option 2 and attempt to transfer $1200

  • choose option 2 transfer $200 to game balance

  • choose option 3 and request 300 spins

  • choose option 3, spin 40 times

  • choose option 3, spin 1 time

  • quit

And, as always, if you have any questions about this assignment, don't gamble....ask your instructor.

CLARIFICATIONS: Jackpots are awarded on the seventh instance of a double or triple. The jackpot replaces the potential award on that seventh spin. Jackpots recur - after a jackpot award, start counting for subsequent jackpots. For matching, stated above it says "first symbol". In our examples and in hw 4, 'a' is the first symbol. A triple is only counted as a triple, and not as any number of doubles.

To give you an idea about how you might go about this, here are the names of some of the functions Dr. Leopold used in her solution: outputGreeting, outputSignoff, calculateInitialBankBal, displayMenu, displayBalances, transferFunds, getNumSpins, determineWinnings, determineNumMatches, playGame, isDoubleSymbol. So I've left out the return-types and parameter lists here. This is only to give you an idea of how you might do it. Again, you make the design and the decisions. Perhaps you should write an outline of the main function first. This will give you ideas of how to make the functions.

Modification(s): There is a difference now in how the game is played. If, during the course of a user running this program (from initial distribution of bank funds to cashing out), the user manages to "spin" enough triple matches and double matching of the first symbol to total 7(so, maybe 2 triples and 5 doubles, or 1 triple and 6 doubles, etc), then he/she wins a jackpot of $100. So, for triples you need aaa, bbb, ccc, ddd, and double a's you need aba, aad, caa, etc. to have the results count towards the jackpot. Now, there are a lot of ways to accomplish this, but the sensible way (and the way that will earn you points like no other can) is to use static variables. If that isn't clear, let's put it this way: you are required to use static variable(s) to accomplish this modification.

Note: IF it is the case that the jackpot is won on a triple, the payoff is only the $100, and not the $30 in addition to that. Likewise for a double.

This accomplishes nothing. If you have one or two functions, that's not enough. And if you have 457 functions, you need to see a psychologist about your infatuation with functions.....that's far too many, so be reasonable (for this assignment). Think carefully about how you should break up the code.

int main()

{

do_stuff();

return 0;

}