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

  Run multiple clients and one server

Run multiple clients and one server - create your client side and server

  Program to find if number input by user is palindrome or not

Write down the program which uses the method called palindrome ( ) to find out if number input by user is a palindrome or not. For instance 1221 is palindrome as it can be read same way forwards and backwards.

  Create a default string of cars in main

Build the default constructor first. Create a default string of cars in main. Build an output function, similar to the old one, but dereferrencing the pointers.

  Designing system to handle donations of non-profit agency

You have been hired by worldwide non-profit agency to create a system to handle their donations.

  Create drawing application using gui components

Create drawing application (have look at Microsoft Paint application on your Windows system). Application should have menus.

  Script that displays the results of rolling a die n times

The example in the links below shows a script that displays the results of rolling a die n times. It retains (in memory) and can display the results of all rolls. The two links below are the html and js files for this example.

  Program by bernstein-s conditions to get maximum parallelism

Restructure program by using Bernstein's conditions in order to get maximum parallelism between processes. Specify which of the three conditions is not satisfied.

  Confi gure the repository and define the repository

Configure the repository and define the repository usernames and passwords - Install the subversion package.

  Implement shape hierarchy-compute area of two-dimensional

Implement Shape hierarchy. Each TwoDimensionalShape must contain function getArea to compute the area of two-dimensional shape. Each ThreeDimensionalShape must have member functions.

  Write a program to read the data from csv file

Write a program that will read the data from the CSV file into an ArrayList of State objects where each State object stores information about all County objects for that state.

  Program to determines and print all prime numbers

Use this function in program which determines and prints all prime numbers between 2 and 10,000. How many of these numbers do you actually have to test before being sure that you have found all primes?

  Object-oriented analysis and design

Object-Oriented Analysis and Design,  PART B-object-oriented design involves the steps 13-18:

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