Professional Documents
Culture Documents
Scanner;
//Main Function
public static void main(String []args){
do{
//Call the function to display the menu and prompt the user
for their choice
//HINT: The displayMenu() function must return the choice
back to main()! In main(), dont forget to assign the call statement to a variable.
//Call the displayMenu() function AND assign it to a
variable
menuChoice=displayMenu(menuChoice);
switch(menuChoice){
acctBalance=depositFunds(acctBalance);
break;
case 'W':
case 'w':
acctBalance=withdrawFunds(acctBalance);
break;
case 'B':
case 'b':
checkBalance(acctNumber, acctBalance);
break;
case 'X':
case 'x':
default:
}//end of switch
if(false)
break;
}while(menuChoice != 'X');
}//end of main
/**************************************************** FUNCTION DEFINITIONS
*****************************************************/
System.out.println("********************************************************Welcome
to Seminole Bank!********************************************************");
}//end of welcomeMessage
//Prompt and Read users account number. RETURN the account number to
main().
public static int accountInfo (){
Scanner input = new Scanner (System.in);
int acctNumber;
System.out.println("\n\nPlease enter your 5-digit Account
Number: \n");
acctNumber = input.nextInt();
System.out.println("Thank you!");
return acctNumber;
//Display menu choices to the user and Read the users banking choice.
RETURN the users menu choice to main().
public static char displayMenu (char menuChoice){
Scanner input = new Scanner (System.in);
//Prompt the user for the amount to deposit and Read deposit amount.
Update the balance and RETURN the balance to main().
public static double depositFunds(double acctBalance){
Scanner input = new Scanner (System.in);
int depositAmt;
System.out.println("Enter the amount for this deposit: ");
depositAmt = input.nextInt();
acctBalance = acctBalance + depositAmt;
return acctBalance;
//Prompt the user for the amount to withdraw and Read withdrawal amount.
Update the balance and RETURN the balance to main().
public static double withdrawFunds (double acctBalance){
Scanner input = new Scanner (System.in);
int withdrawAmt;
System.out.print("Enter the amount of the withdrawal: ");
withdrawAmt = input.nextInt();
acctBalance = acctBalance - withdrawAmt;
return acctBalance;
}//end of checkBalance
/**************************************************END OF FUNCTION
DEFINITIONS **************************************************/