hi danpost
i cant find my last post was it deleted.
public static double withdraw(double amount)
{
double current_bal=0;
current_bal = current_bal - amount;
return current_bal;
}
public static double deposit(double amount)
{
double current_bal=0, deposit_amt = 0;
deposit_amt = deposit_amt + current_bal;
return deposit_amt;
}
public static void printReport( )
{
}
public static void main(String[] args)
{
Scanner userin = new Scanner(System.in);
int pin = 1234;
int option;
double amt=0,w,d;
double withdrawal, currentBalance=0, deposits, balance=0,
initialacct_bal;
char acct_type = 's';
int i=0, operation_code=0,operation_menu=0;
while(i<2)
{
System.out.println("please enter your 4 digit pin number");
pin = userin.nextInt();
if(pin != 1234)
{
System.out.println("incorrect pin, please re-enter your pin");
}
else if(pin == 1234)
{
System.out.println("you can now start with your transaction");
}
do
{
System.out.println("please re-enter your pin");
pin = userin.nextInt();
}while(pin != 1234);
System.out.println("please enter the customer first name");
String customer_firstname = userin.next();
System.out.println("please enter the customer last name");
String customer_lastname = userin.next();
System.out.println("please enter customer ID");
String customer_ID = userin.next();
System.out.println("Account type menu");
System.out.println("S:Saving Accounts");
System.out.println("C:Checking Accounts");
option = userin.next().charAt(0);
System.out.println("please enter initial account balance");
initialacct_bal = userin.nextDouble();
System.out.println("what operation would you like to perform");
String operation = userin.next();
System.out.println("what operation do you wish to perform");
System.out.println("1: deposit");
System.out.println("2: withdraw");
System.out.println("3:exit and balance" + balance);
option = userin.next().charAt(0);
while(operation_code == 1)
{
System.out.println("enter money to be deposit");
deposits = userin.nextDouble();
d = deposit(amt);
System.out.println("$ "+ amt +" has been deposited "+ "Account blance is "+ balance);
i++;
}
while(operation_code == 2)
{
System.out.println("please enter the amount of money to withdraw");
withdrawal = userin.nextDouble();
if(withdrawal == currentBalance)
{
w = withdraw(amt);
System.out.println("$ "+amt +" has been withdrawwn"+ " available balance is "+balance);
}
else if(withdrawal > currentBalance)
{
System.out.println("The amount you are trying to withdraw exceed your current overdraft limit");
i++;
}
System.out.println("exist "+" account balance is "+balance);
}
while(operation_menu < -3)
{
msg = printReport();
}
}please enter your 4 digit pin number 1247 incorrect pin, please re-enter your pin please re-enter your pin 1234 please enter the customer first name shantelle please enter the customer last name roberts please enter customer ID RBC0000136 Account type menu S:Saving Accounts C:Checking Accounts 5 please enter initial account balance 1200 what operation would you like to perform 1 what operation do you wish to perform 1: deposit 2: withdraw 3:exit and balance0.0 deposit please enter your 4 digit pin number BUILD STOPPED (total time: 2 minutes 17 seconds)
if(playerage < 8)
{
System.out.println(playername+" you are too young for this game");
System.out.println(playername+" come back when you are a bit older bye!!! ");
System.exit(0);
}
else if(playerage > 13)
{
System.out.println(playername+" you are too old for this game");
System.out.println(playername+" you have a bless day goodbye!!!!!");
System.exit(0);
}
else if(playerage > 8 && playerage < 13)// start of round 1
{
System.out.println("\n*********************welcome to the addition round: round 1");
//indicationg to the user what level and round she will be starting from
while (i < 4 && wrongcount < 4)
{
i++;
//getting the random numbers
intvalue = 1 + randobj.nextInt(25);
intvalue2 = 1 + randobj.nextInt(9);
correct_ans = intvalue + intvalue2;
incorrect_ans = 1 + randobj.nextInt(35);
while(correct_ans == incorrect_ans)//this indicating if the random happen to drop to same numbers for the correct and incorrect answer
{
incorrect_ans = 1 + randobj.nextInt(35);
}
System.out.println(playername+" you are on round 1 "+ " level "+ i);
System.out.println(playername+" please match the answer with the corresponding letter");
System.out.println(playername +" please add "+ intvalue + " + "+ intvalue2);
System.out.println("A:"+correct_ans);
System.out.println("B:"+incorrect_ans);
uSelect = reader.next().charAt(0);
if(uSelect == 'A' || uSelect == 'a')
{
System.out.println(playername+" great job, answer is correct keep up the good work");
totalscore += 350;
System.out.println("round 1");
System.out.println("level "+ i);
totalscore +=score;
System.out.println(" total score is: "+totalscore);
}
else
{
while(uSelect !='A' && uSelect !='a' && wrongcount < 4)
{
System.out.println(playername+" okay let me catch my breath here, answer is wrong, try again");
totalscore -=175;
System.out.println("round 1");
System.out.println("level:"+ i);
totalscore -=score;
System.out.println("total score is: "+totalscore);
wrongcount++;
while(wrongcount < 4)
{
i++;
System.out.println(playername+" you are still on round 1 "+ " level "+ i);
System.out.println(playername+" please match the answer with the corresponding letter");
while( intvalue2 == 0)
{
incorrect_ans = i + randobj.nextInt(35);
}
System.out.println(playername+" please add "+ intvalue + " + "+intvalue2);
System.out.println("A:"+correct_ans);
System.out.println("B:"+incorrect_ans);
uSelect = reader.next().charAt(0);
wrongcount++;
}
}
}
}
System.out.println("\n**********welcome come to the subtraction round:***round 2*********");
while(i >= 4 && i <=8 && wrongcount < 4)
{
i++;
//get random numbers
largest = 1 + randobj.nextInt(25);
smallest = 1 + randobj.nextInt(9);
correct_ans = largest - smallest;
incorrect_ans = 1 + randobj.nextInt(35);
while(correct_ans == incorrect_ans)
{
incorrect_ans = 1 + randobj.nextInt(35);
}
if(i == 1)
{
//get the largest and smallest number
largest = numvalue;
smallest = numvalue2;
}
else
{
if(numvalue > largest)
{
largest = numvalue;
}
if(numvalue2 > smallest)
{
smallest = numvalue2;
}
}
//indicting the user what level and round they are on
System.out.println(playername+" you are on round 2 "+ " level "+ i);
System.out.println(playername+" choose the correct answer with the corresponding letter");
while(smallest == 0)
{
smallest = 1 + randobj.nextInt(35);
}
System.out.println(playername+" please subtract "+ largest+ " - "+ smallest);
System.out.println("A:"+correct_ans);
System.out.println("B:"+incorrect_ans);
uSelect = reader.next().charAt(0);
if(uSelect == 'A' || uSelect == 'a' )
{
System.out.println(playername+" well done kiddo!!!!!!!! you are so right, keep it up");
totalscore +=350;
System.out.println("round 1");
System.out.println("level "+ i);
totalscore+=score;
System.out.println("total score "+ totalscore);
}
else
{
while(uSelect != 'A' && uSelect != 'a' && wrongcount < 4)
{
System.out.println(playername+" Boo-ya boo-hoo you are wrong, please try again");
totalscore +=350;
System.out.println("round 1");
System.out.println("level "+ i);
totalscore-=score;
System.out.println("total score is "+totalscore);
wrongcount++;
if(wrongcount == 4)
{
break;
}
while(wrongcount < 4)
{
System.out.println(playername+" you are still on round 2");
System.out.println(playername+" please match the correct answer with the corresponding letter");
System.out.println(playername+" please subtract "+largest+ " - "+smallest);
System.out.println("A:"+correct_ans);
System.out.println("B:"+incorrect_ans);
uSelect = reader.next().charAt(0);
wrongcount++;
}
}
}
}
System.out.println("\n**************welcome to the division round: round 3***********************");
while(i >=8 && i <=10 && wrongcount < 4)
{
i++;
//get the random numbers
numerator = 1 + randobj.nextInt(25);
denominator = 2 + randobj.nextInt(9);
while(denominator == 0)
{
denominator = 2 + randobj.nextInt(9);
}
rand1 = 1 + randobj.nextInt(25);
rand2 = 2 + randobj.nextInt(9);
correct_ans = numerator = denominator * 2;
correct_ans = numerator / denominator;
incorrect_ans = 1 + randobj.nextInt(35);
while(correct_ans == incorrect_ans)
{
incorrect_ans = 1 + randobj.nextInt(35);
}
System.out.println(playername+" you are on round 3 "+ " level "+ i);
System.out.println(playername+" match the correct answer with the corresponding letter");
System.out.println(playername+" please divide "+ numerator+ " / "+denominator);
System.out.println("A:"+incorrect_ans);
System.out.println("B:"+correct_ans);
uSelect = reader.next().charAt(0);
if(uSelect == 'A' || uSelect == 'a')
{
System.out.println(playername+"yayyyyy well done kiddoo!!! you are on the right track, keep it up");
totalscore += 350;
System.out.println("round 1");
System.out.println("level "+i);
totalscore += score;
System.out.println("total score is: "+totalscore);
}
else
{
while(uSelect != 'A' && uSelect != 'a' && wrongcount < 4)
{
System.out.println(playername+" awwww come on you can do better than that, incorrect answer again, try again");
totalscore -= 175;
System.out.println("round 3 ");
System.out.println("level "+ i);
totalscore -= score;
System.out.println("total score is: "+totalscore);
wrongcount++;
while(wrongcount < 4)
{
i++;
System.out.println(playername+"okay let me take a deep breath here, that is not the correct answer, please try again");
totalscore -=175;
System.out.println("round:3");
System.out.println("level:"+ i);
totalscore-= score;
System.out.println("total score is: "+ totalscore);
wrongcount++;
}
}
}
}
}
else
{
System.out.println(playername+" you have entered an invalid character");
System.exit(0);
}
System.out.println("the winner is "+playername);
System.out.println("total score is "+totalscore);
System.out.println("the level the player was on is "+ " level "+ i);
System.out.println("number of chances left is "+wrongcount);
}
private void bumpWrongCount()
{
wrongcount++;
if (wrongcount == 4)
{
System.out.println("You have answered wrong too many times. Game Over!"
System.exit(0);
}
}char correct_response = 'A';
int option1 = correct_ans;
int option2 = incorrect_ans;
if (randObj.nextInt(2) == 1)
{
int hold = option2:
option2 = option1;
option1 = hold;
correct_response = 'B';
}if (Character.toUpperCase(uSelect) == correct_response)