Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

Write a program that simulates a basic lottery.

Your user will "purchase" one lottery ticket. Each ticket will contain 5 unique numbers (numbers cannot be repeated within the ticket). Each number will be between 1 and 50, inclusive. You will allow the user to select their own numbers for their ticket or to have the computer randomly select the numbers. You should represent the "ticket" using an array.

Once the ticket has been purchased, your program will randomly generate the "winning lottery numbers and determine if the user has won. Again, the ticket will contain 5 unique numbers (numbers cannot be repeated within the ticket) in the range 1 to 50 (inclusive). The winning lottery numbers should be stored in a separate array.

Here's the fun part - your program should continue to generate "winning lottery numbers" drawings until your

user wins the lottery. Your program will count the number of lottery drawings it takes to win.

A few things to consider:

The program should contain the following methods·

o A main method

o A method that determines the user's ticket numbers

o A method that determines the winning lottery numbers

o A method that determines if the user has a winning ticket

The program should display the following:·

o The numbers in the user's ticket

o The winning lottery numbers when the win occurred

o The number of times it took to get a match with a winning ticket

At the time of the win, the number of times each value 1-50 was generated for a winning lottery number should be written to a file. In addition, statements indicating which number(s) was generated most often and which number(s) was generated least often should be written to the file. You must validate all user input.

Numeri·c output should be displayed with commas.

Be aware that your program will run faster if you do not print out a lot of output. So, I recommend that you break this into small pieces and validate that each of the pieces works using output statements and then remove all but the final required output statements so that it will run faster.

The code should be written using efficient processing.·

Remember to use good programming practices (comments, naming conventions, program structure, etc).

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M92053677
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Programming Language

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Extend the adworks applicationi add dialogs to allow the

Extend the AdWorks application I. Add Dialogs to allow the user to Add, Edit, Read and Delete a Customer and refresh the view accordingly. 1. The user should be able to select a specific customer from the DataGrid and cl ...

Task - hand execution of arraysoverviewin this task you

Task - Hand Execution of Arrays Overview In this task you will demonstrate how arrays work by hand executing a number of small code snippets. Instructions Watch the Hand Execution with Arrays video, this shows how to ste ...

Php amp session managment assignment -this assignment looks

PHP & SESSION MANAGMENT ASSIGNMENT - This assignment looks at using PHP for creating cookies and session management. Class Exercise - Web Project: Member Registration/Login This exercise will cover adding data connectivi ...

Question 1 what is hadoop explaining hadoop 2 what is

Question: 1. What is Hadoop (Explaining Hadoop) ? 2. What is HDFS? 3. What is YARN (Yet Another Resource Negotiator)? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

Overviewthis tasks provides you an opportunity to get

Overview This tasks provides you an opportunity to get feedback on your Learning Summary Report. The Learning Summary Report outlines how the work you have completed demonstrates that you have met all of the unit's learn ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As