This is for a C# program. I would greatly appreciate any help! Thank you:)
using System;
using System.Linq;
public class Test
{
public static Random randomNumber = new
Random();
static int getRandomIntInclusive(int min,int
max)
{
return
(randomNumber.Next(min,max+1));
}
public static void Main()
{
int[] whiteBalls = new
int[5];
int redBall ;
char option = 'y';
do //loop to generate white balls
and red ball
{
for (int i = 0; i < 5; i++)
//generate 5 red balls
{
int wBall;
do // do
while loop to generate 5 white balls until the ball number is
repeated
{
wBall =
getRandomIntInclusive(1,69);
//1-69 for the white balls
}while(whiteBalls.Contains(wBall)); //no duplicate values
whiteBalls[i] =
wBall;
}
Array.Sort(whiteBalls);
//sorting the generated numbers
redBall =
getRandomIntInclusive(1,26);
Console.WriteLine("White
Balls");
for (int i = 0; i < 5;
i++)
Console.WriteLine(whiteBalls[i]);
//display white balls
Console.WriteLine("Red
Ball");
Console.WriteLine(redBall);
//display red ball
Console.WriteLine("Do you want to
have another set of numbers?");
option =
Convert.ToChar(Console.Read());
}while(option == 'Y' || option ==
'y');
}
}
Output:
White Balls 9 12 30 58 59 Red Balls 8 Do you want to have another set of numbers?y White Balls 3 28 39 42 63 Red Balls 1 Do you want to have another set of numbers?n
This is for a C# program. I would greatly appreciate any help! Thank you:) For this...
Write a C++ program that simulates playing the Powerball game. The program will generate random numbers to simulate the lottery terminal generated numbers for white balls and red Powerball. The user will have the option to self-pick the numbers for the balls or let the computer randomly generate them. Set the Grand Prize to $1,000,000,000.00 in the program. Project Specifications Input for this project: Game mode choice – self pick or auto pick Five numbers between 1 and 69 for...
c++ please help You are going to create a PowerBall Lottery game with functions. First, you are going to generate 5 UNIQUE numbers between 1 and 69. Then you are going to generate the powerball number, which is a number between 1 and 26. Next you are going to ask the user for 5 numbers. Users should only be allowed to enter numbers in the range 1-69 for regular numbers, 1-26 for powerball pick. You will compare each of the...
Python code question - you are given the grand prize(in USD) and the winning numbers. Your program will read multiple tickets (6 selected numbers in each ticket) from the input file. For each ticket, the program calculates its prize won, and outputs the prize (in USD) to the output file. How to Play the Game? In each ticket, the player selects five numbers from a set of 69 white balls (numbered 1 to 69) and one number from 26 red...
ASSIGNMENT 5 – POWERBALL SIMULATION Powerball® is a combined large jackpot game and a cash game. Every Wednesday and Saturday night at 10:59 p.m. Eastern Time, we draw five white balls out of a drum with 69 balls (1-69) and one red ball out of a drum with 26 red balls (1-26). Draw sales cut off at least 59 minutes before the draw. Check for local cut-off time. Players win by matching one of the 9 Ways to Win. The...
This question relates to pseudo random number generators. You will write a c program that pulls the Powerball numbers. You will demonstrate how a deterministic number generator works. In Powerball there are 5 white numbered balls that are pulled out of a drum containing 69 balls numbered 1-69. You cannot pull the same number twice. Additionally one red ball is numbered 1 to 26. You don’t have to worry about the PowerPlay option. A) Write a c program that simulates...
Please post screenshots only File Tools View CMSC 140 Common Projects Spring 2019(1) E - 3 x Project Description The Powerball game consists of 5 white balls and a red Powerball. The white balls represent a number in the range of 1 to 69. The red Powerball represents a number in the range of 1 to 26. To play the game, you need to pick a number for each ball in the range mentioned earlier. The prize of winning the...
The Powerball lottery is played twice each week in 44 states, the District of Columbia, and the Virgin Islands. To play Powerball, a participant must purchase a $2 ticket, select five numbers from the digits 1 through 69, and then select a Powerball number from the digits 1 through 26. To determine the winning numbers for each game, lottery officials draw 5 white balls out a drum of 69 white balls numbered 1 through 69 and 1 red ball out...
Please help to solve question 1 and subsections 1-4 1: Powerball Consider the multi-state lottery Powerball game. Each ticket is $2 and allows a player to select 5 white balls from 1 to 69 (without replacement), and 1 Red Powerball, from 1 to 26. The order of the five white balls does not matter when evaluating a win. If there are 64 losing whiteball numbers, how many ways can the winner pick 4 of them. If the player is only...
The Powerball is played by selecting five numbers (without repetition) from the white balls labeled 1 through 69 (the order doesn't matter) and one red ball (the powerball) with label from 1 through 26. You win the grand prize if you get all five white numbers plus the powerball. 3. (a.) How many possible tickets are there? What is the probability of winning the grand prize? (b.) You win $4 if you get the powerball and at most one white...
need help editing or rewriting java code, I have this program running that creates random numbers and finds min, max, median ect. from a group of numbers,array. I need to use a data class and a constructor to run the code instead of how I have it written right now. this is an example of what i'm being asked for. This is my code: import java.util.Random; import java.util.Scanner; public class RandomArray { // method to find the minimum number in...