Please help me This is about Java programming Write a Java a

Please help me! This is about Java programming.

Write a Java application program to calculate and display a table the odds of winning a lottery (for n starting at 37, incrementing by 2, ending at 69, and r = 5, then 6 for each n) using the following formula for calculating how many possible winning combinations there are:

n!/(r!(n-r)!). In the formula, n stands for the total number of chooseable numbers and r stands for the number of numbers chosen. ! denotes a factorial.

You must include in this program:

1. for loops (nested for in main or optional odds method, one in the static method for factorial)

2. static final (class-scope) variables for 37 and 49 (minimum and maximum values of n, inclusive), 2 (increment) , 5 (minimum value for r) and 6 (maximum value for r).

3. static method to return a double value for calculating and returning (in a return statement) the factorial of the parameter. Make sure you don\'t overflow by using the correct type!

***DO NOT USE CLASS-SCOPE VARIABLES unless they\'re final and static. Do not use any input for these programs!

Here\'s some of the output

37 1 in 435897. 39 1 in 575757. 41 1 in 749398.e 43 1 in 962598.0 1 in 2324784.e 1 in 3262623.0 1 in 4496388.0 1 in 6096454.0 63 1 in 7028847. 65 1 in 8259888.0 67 1 in 9657648.0 69 1 in 11238513.0 1 in 67945521.0 1 in 82598880.0 1 in 99795696.0 1 in 119877472.0

Solution

Please find the required program along with its output. Please see the comments against each line to understand the step.

----------------------------------------------------

OUTPUT:

n           r = 5           r = 6
37   1 in 435897.0   1 in 2324784.0  
39   1 in 575757.0   1 in 3262623.0  
41   1 in 749398.0   1 in 4496388.0  
43   1 in 962598.0   1 in 6096454.0  
45   1 in 1221759.0   1 in 8145060.0  
47   1 in 1533939.0   1 in 10737573.0  
49   1 in 1906884.0   1 in 13983816.0  
51   1 in 2349060.0   1 in 18009460.0  
53   1 in 2869685.0   1 in 22957480.0  
55   1 in 3478761.0   1 in 28989675.0  
57   1 in 4187106.0   1 in 36288252.0  
59   1 in 5006386.0   1 in 45057474.0  
61   1 in 5949147.0   1 in 55525372.0  
63   1 in 7028847.0   1 in 67945521.0  
65   1 in 8259888.0   1 in 82598880.0  
67   1 in 9657648.0   1 in 99795696.0  
69   1 in 11238513.0   1 in 119877472.0  

Please help me! This is about Java programming. Write a Java application program to calculate and display a table the odds of winning a lottery (for n starting

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site