Chapter(s) Covered:
- Chapter 7
- Chapter 8
Concepts tested by the program:
- Working with arrays
- Using file operations
- Using a selection sort to sort an array
- Using a function to display arrays
- Using a function to save arrays to file
- Implementing functions besides function main()
Project Description
Can you legally gamble? Are you 21 years old or older? Do you know Powerball? Don’t worry. You are not going to play Powerball but create a simulated game just like that :)! Go find the rule and study it so that you know how to design and code your program accordingly. Go ahead, search the Internet!
Do you see that your program basically just needs to randomly generate 6 numbers for the user to guess and calculate the prize depending on how many numbers are guessed correctly? Develop a C++ program using random number generator, i.e. rand(), function(s), and array(s) for it!
Project Specifications
Input for this project:
- Game mode choice – self_pick or auto_pick
- Five numbers between 1 and 69 (if game mode is self_pick)
- One number between 1 and 26 (if game mode is self_pick)
Output for this project:
- Game title
- Game rule
- Game result including
- Prize
- Sorted user’s numbers
- Sorted winning numbers
- Programmer’s full name
- Project number
- Project due date
Processing Requirements
- Define all functions after main function and prototype them properly.
- Use published PowerBall Prize rule for single draw. [https://www.powerball.com/games/powerball] Set Grand Prize as $1,000,000,000.00 in the program.
- Create and use five functions for the following:
- Function randomly generates and returns a number within the range passed/specified by arguments: max and min.
- Function sorts a passed array using selection sort.
- Function saves sorted wining numbers to a data file with a timestamp. Be sure to save the numbers in a way separate groups of numbers can be differentiated. [Hint: this function should call/use above two functions.]
- Function gets and validates user’s numbers, saves and sorted the numbers in an array. The sorted array needs to be returned/passed out by this function. This function accepts one argument: game mode choice.
- Function displays a passed array.
[NOTE: you can create and use more functions if you want.]
Sample Screen Output #1:
Sample Screen Output #2:
Sample Screen Output #3:
NOTE: Be sure to check also
- CMSC140 Common Project Submission Requirements (.docx)
- CMSC140 Grading Rubric_CheckList-Project 5 (.xlsx)
- Test Plan Template
Test Case # | Input | Actual input | Expected Output | Actual Output | Did Test Pass? |
1 | |||||
2 | |||||
… | |||||
10 |
Reviews
There are no reviews yet.