/** Lotto.java
* Programming Project, NCI
*
* Date: 9 Nov 2011
* @author Katie
*
*/
import javabook.*;
class LottoApp
{
public static void main (String args[]){
//Declare variables
double money;
double bet;
double a;
double b;
double c;
double d;
double e;
double f;
double g;
double h;
double i;
double j;
double k;
double l;
double m;
double n;
double o;
double p;
//Declare objects
MainWindow mWindow;
InputBox iBox;
OutputBox oBox;
//Create Objects
mWindow = new MainWindow();
iBox = new InputBox(mWindow);
oBox = new OutputBox(mWindow);
//Use objects
mWindow.show();
oBox.show();
//get Input
money = iBox.getDouble("Please enter an amount. Note that one line costs 0.50 cent");
bet = iBox.getDouble("How much would you like to bet?");
a = 0;
b = 0;
c = 0;
d = 0;
e = 0;
f = 0;
g = 0;
h = 0;
i = 0;
j = 0;
k = 0;
l = 0;
m = 0;
n = 0;
o = 0;
p = 0;
//process
if (bet >= 2.00)
{
a = iBox.getDouble("enter first number");
b = iBox.getDouble("enter second number");
c = iBox.getDouble("enter third number");
d = iBox.getDouble("enter fourth number");
e = iBox.getDouble("enter fifth number");
f = iBox.getDouble("enter sixth number");
g = iBox.getDouble("enter seventh number");
h = iBox.getDouble("enter eighth number");
i = iBox.getDouble("enter ninth number");
j = iBox.getDouble("enter tenth number");
k = iBox.getDouble("enter elleventh number");
l = iBox.getDouble("enter twelfth number");
m = iBox.getDouble("enter thirteenth number");
n = iBox.getDouble("enter fourteenth number");
o = iBox.getDouble("enter fifteenth number");
p = iBox.getDouble("enter sixteenth number");
}
else if (bet >= 1.50)
{
a = iBox.getDouble("enter first number");
b = iBox.getDouble("enter second number");
c = iBox.getDouble("enter third number");
d = iBox.getDouble("enter fourth number");
e = iBox.getDouble("enter fifth number");
f = iBox.getDouble("enter sixth number");
g = iBox.getDouble("enter seventh number");
h = iBox.getDouble("enter eighth number");
i = iBox.getDouble("enter ninth number");
j = iBox.getDouble("enter tenth number");
k = iBox.getDouble("enter elleventh number");
l = iBox.getDouble("enter twelfth number");
}
else if (bet >= 1.00)
{
a = iBox.getDouble("enter first number");
b = iBox.getDouble("enter second number");
c = iBox.getDouble("enter third number");
d = iBox.getDouble("enter fourth number");
e = iBox.getDouble("enter fifth number");
f = iBox.getDouble("enter sixth number");
g = iBox.getDouble("enter seventh number");
h = iBox.getDouble("enter eighth number");
}
else if (bet >= 0.50)
{
a = iBox.getDouble("enter first number");
b = iBox.getDouble("enter second number");
c = iBox.getDouble("enter third number");
d = iBox.getDouble("enter fourth number");
}
else
{
oBox.print("You have insufficient funds");
}
//Output
switch (bet)
{
case 2:
oBox.print(" The numbers you have chosen are: " + a + ", " + b + ", " + c + ", " + d + ", " + e + ", " + f + ", " + g + ", " + h + ", " + i + ", " + j + ", " + k + ", " + l + ", " + m + ", " + n + ", " + o + " & " + p );
break;
case 150:
oBox.print(" The numbers you have chosen are: " + a + ", " + b + ", " + c + ", " + d + ", " + e + ", " + f + ", " + g + ", " + h + ", " + i + ", " + j + ", " + k + " & " + l );
break;
case 1:
oBox.print(" The numbers you have chosen are: " + a + ", " + b + ", " + c + ", " + d + ", " + e + ", " + f + ", " + g + " & " + h );
break;
case 50:
oBox.print(" The numbers you have chosen are: " + a + ", " + b + ", " + c + " & " + d );
break;
default:
oBox.print("Invalid Entry");
break;
}
}
}