Starting from:

$29

Programming Project 5 – Number Guessing Game

Fall 18 CMSC 140 Programming Project 5 – Number Guessing Game

 

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

o   Prize

o   Sorted user’s numbers

o   Sorted winning numbers

·         Programmer’s full name

·         Project number

·         Project due date

 

 

Processing Requirements

 

1.   Define all functions after main function and prototype them properly.

2.   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.

3.   Create and use five functions for the following:

a.    Function randomly generates and returns a number within the range passed/specified by arguments: max and min.

b.    Function sorts a passed array using selection sort.

c.    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.]

d.   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.

e.    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

1.   CMSC140 Common Project Submission Requirements (.docx)

2.   CMSC140 Grading Rubric_CheckList-Project 5 (.xlsx)

3.     Test Plan Template

Test Case #
Input
Actual input

 
Expected Output
Actual Output
Did Test Pass?
1
 
 
 
 
 
2
 
 
 
 
 

 
 
 
 
 
10
 
 
 
 
 
4.       

 

 

 

 

More products