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

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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