Write a program that simulates a basic lottery

Assignment Help Programming Languages
Reference no: EM131299029

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

Reference no: EM131299029

Questions Cloud

Create a application whose main method accepts ten integer : You will need to create a console based application whose Main() method accepts ten integer values from the user and stores them in an array.
Why distribution of dates would be skewed to the left : Skewed left. Sketch a histogram for a distribution that is skewed to the left. Suppose that you and your friends emptied your pockets of coins and recorded the year marked on each coin. The distribution of dates would be skewed to the left. Explai..
Evaluate the firm financial performance for fiscal 2015 : You are an analyst covering Screen Microtech and have been asked to evaluate the firm's financial performance for fiscal 2015. Specifically, you have been asked to review the accounting decisions that the firm has made and prepare a revised 2015 ..
Increasing prices for viable drugs people : 1. Technology: Technology and connectivity will continue its steady infiltration of the healthcare landscape, branding and trust take priority over convenience, and the advancement and integration of connected health technologies will center on c..
Write a program that simulates a basic lottery : 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).
Company align organizational and employee goals : In what ways can a company align organizational and employee goals? How can a company ensure that employees are focused on the right goals? (please address both parts)
Create a query with all fields from the student table : Create a query with all fields from the student table, where the student's last name is "Smith". Create a query that includes students' first names, last names, and phone numbers.
Pros and cons of four provider payment methods : Explain the pros and cons of four provider payment methods: (a) fee-for-service; (b) capitation; (c) global capitation; and (d) bundled payment.
Changing landscape of the health care system : Write a 1,050 word reflection that details the changing landscape of the health care system. Include the following:

Reviews

Write a Review

Programming Languages Questions & Answers

  Create program to sum all integers between one and n

Using C++ create program to sum all integers between 1 and n where n is input by keyboard. Print "The sum of all integers from 1 to n is SUM

  Write down a program which explores the seating patterns

write a program that explores the seating patterns related to course performance by using an array of student scores.

  Prepare clear button which will clear result text box

Make the compute button the Accept button. Prepare Clear button which will clear result text box and reset all text boxes, 4. controls, and internal variables used.

  Create object-oriented design to enter name into text box

Create the object-oriented design for the system which permits the user to enter their name into the text box. When they press Go button message.

  Create command line based application for perfect hundred

Create a COMMAND LINE based application to play a game called Perfect Hundred. In this game, the user/player competes against the computer.

  Write a short report on a current game engine

Briefly introduce and discuss a game engine of students own choice. Students are encouraged to explore the concept and discussion of existing technologies which define a game engine.

  Write function which takes string as its input

In this, you are required to write the function which takes string as its input, chops sentence into words, and for each word, capitalizes the rst letter

  Perform some analysis of the age and weight relationships

In this project you will combine the use of arrays and objects to perform some analysis of the age and weight relationships among a group of people. You have been contracted to write a program into which data about people, including their ages and..

  Program a maze-type game using assembly language

Project requires you to program a maze-type game using Assembly Language, it is not acceptable to use any other programming language for this project

  Write program which functions similarly to atm

Write program which functions similarly to the ATM. A user must be able to give their account number, choose whether they want to make a deposit or a withdrawal

  Create a dtd for a small xml data set

Create a DTD for a small XML data set drawn from the Stanford course catalog. There are multiple departments, each with a department chair.

  Utilizing the step-by-step mrp calculation process students

utilizing the step-by-step mrp calculation process students will solve the following mrp problem given product a is an

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd