Write a program that simulates a basic lottery

Assignment Help JAVA Programming
Reference no: EM132095130

please code in Java

Write a program that simulates a basic lottery.

Your user will "purchase" one lottery ticket. Each ticket will contain 5 numbers. Each number will be between 1 and 20, 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. The winning lottery numbers should be stored in a separate array.

Here's the fun part - your program should continue to generate a full set of "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

o A method that displays the following to the screen:

A message indicating the win ? The numbers in the user's ticket when the win occurred 

The winning lottery ticket numbers 

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

The number of times each value 1-20 was generated for a winning lottery ticket 

The number(s) generated most often for the winning lottery tickets during this run of the program

The following should also be written to a file:

o The number of times each value 1-20 was generated for a winning lottery number

o The number(s) generated most often for the winning lottery tickets during this run of the program

For the sake of simplicity, you should implement your code to prevent duplicate values in the lottery tickets (ie - a specific number should only appear one time in any ticket).

You will need to write code to ensure the user doesn't select the same number twice and that the computer doesn't generate the same number twice.

The numbers do not have to match in order. For example, a user ticket with numbers 1, 2, 3, 4, 5 should be considered a match if the winning ticket numbers are 5, 2, 1, 3, 4.

You must validate all user input. 

Numeric output should be displayed with commas

The code should be written using efficient processing.

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

please use java

Reference no: EM132095130

Questions Cloud

Discuss the likelihood of stonyfield : Discuss the likelihood of Stonyfield having a strong influence on Danone's sustainability practices over the long term.
Write a program that will ask the user to input the names : Write a program that will ask the user to input the names of cities they would like to visit.
Terms of document design : Review the following documents and discuss which version is more effective in terms of document design, and why.
Develop a caesar cipher-type encryption algorithm : Develop a Caesar cipher-type encryption algorithm with a little more complexity in it.
Write a program that simulates a basic lottery : Your user will "purchase" one lottery ticket. Each ticket will contain 5 numbers. Each number will be between 1 and 20, inclusive.
Recommend to the executive team : If you were Henrietta what would you recommend to the executive team? Why? Back up your recommendations with detailed facts, information
Search for microsoft dynamics : Go to www.microsoft.com and search for Microsoft Dynamics. Ignore Dynamics CRM. Have any important changes occurred in Microsoft's ERP
What factors raise concerns among the hospital managers : What factors raise concerns among the Hospital managers about the viability of the facility as a general community hospital
Prepare an aggregate plan : Prepare an aggregate plan for the next 3 years for the increased manufacturing of private jets in regards to buildings

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

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

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