Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help, I need a refresher of these topics to get back into the groove. See below. Please write all code in C++ thank you!

Please help, I need a refresher of these topics to get back into the groove. See below. Please write all code in C++ thank you!

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Essentially a review of the lessons and material from a previous C++ course. Students entering this class should be able to accomplish the tasks in this assignment with few problems. This assignment will require that you generate a list of suggested lottery numbers using random number generation techniques. The project will involve passing complex parameters such as arrays, generating random numbers and proper programming techniques. This may be a time consuming project so you may want to get started early and write it a piece at a time. Programming Specifications: 1. The program will prompt the user for the following information: 1. The number of values to print out ranging from 3 to 7 (inclusive). Any values outside that range must be rejected and the user prompted to enter in correct values. 2. The range of random numbers to consider. This will be the number of possible values to be selected. This value will range from 1-45 to 1-70 inclusive. You need only prompt for the last number since all lottery values will start with 1. Any values outside that range will be rejected and the user prompted to enter the correct values. 3. The number of tickets that you wish to generate from 1 to 100 inclusive. Any value outside the range will be rejected and the user prompted to enter the correct value. 4. Once a number is selected in cannot be selected again. You must have some method of avoiding duplicate numbers. 5. You can assume that valid integers will be entered so you won't need to check for invalid characters or converting numbers. 2. Output 1. Echo the information that the user input. 1. Number of numbers ( number between 3 and 7 inclusive) 2. Range of Values ( 1 to the largest value) 3. Number of ticket guesses (number of tickets) 4. Odds of winning. To estimate the odds of winning you use a formula that uses the highest value and the number of numbers. So, if you wanted 6 numbers with a maximum value of 55 you would calculate the odds at: N!/(K!(NK)! where N is the highest number and K is the number of balls selected. 555453525150/(123456)=1in28,989,675 5. The numbers produced by your program, one group per line. See Example. Design Considerations: 1. The program need not be written in object oriented fashion but is meant as a refresher from your previous C++ class. 2. I would recommend making your program highly modular. Having routines that perform the following functions might be useful: 1. Get the range of numbers from the user 2. Get the number of lottery balls the user wants 3. Get the number of tickets the user wants. 4. Have a function that calculates the odds and returns it as a floating point number 5. Some method to keep track of the numbers you have selected so you do not get a duplicate 3. In your global space ( above the main routine) you should have several constants declared: 1. Maximum number of balls 2. Minimum number of balls 3. Maximum range of numbers ( assume the range goes from 1 to Maximum) 4. Minimum range of numbers ( assume the range goes from 1 to Minimum) 5. Maximum number of tickets 4. Provide an initial seed to your random number generator by pasting the current time to srand. . Be sure to include the , >, and > and libraries. 5. Each subsequent call to rand() will cause a new seed to be generated automatically. 6. The random number generator returns a large integer number which must have the modulo operator used to reduce the possible number of returned values for the range you wish. For instance, if you wanted the upper range of your numbers to be 56 you would use the following statements: Randomnumber = rand ()%56+1 4. Each number within a ticket can be used only once. Think of the ping pong ball method used on lottery shows where once a ball is selected that number cannot be used again. 5. Your program must use functions that shows examples of passing parameters and returning values. 6. I have found out the major issue with this program is calculating the odds. I have provided you the routine I use to do this. If you use this routine copy it exaclty as it appears here including the comments to avoid Plagariasm charges. / /1 // Name: Odds // * Description: Given the number of balls (nb) and the // float Odds (const int nb, const int tr) \{ float sum=1.0; int numballs=nb; cout for random numbers. You may use the library for formatting your output if you wish. 5. When you write source code, it should be readable and well-documented. 6. You must have prototypes for all of your functions. Grading Criteria: 1. (25 Points) The program compiles and executes without exception and produces output. The grading of the output cannot be accomplished unless the program executes. 25 points will be deducted if the grader must make modifications to your program in order for it to work on the Visual Express compiler

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions

Question

Distinguish among T1, T2, T3, and T4 circuits.

Answered: 1 week ago

Question

My opinions/suggestions are valued.

Answered: 1 week ago