Question: PROGRAM FROM ASSIGNMENT 7 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class SeminoleBank_B { public static void main(String[] args) throws IOException { double deposit = 0,

PROGRAM FROM ASSIGNMENT 7
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader;
class SeminoleBank_B {
public static void main(String[] args) throws IOException {
double deposit = 0, withdrawal = 0, balance = 1000;
System.out.println("**************************************************************************"); System.out.println("\t\t\tWelcome to Seminole Bank!\t\t\t"); System.out.println("************************************************************************** "); System.out.print(" Please enter your 5-digit Seminole Account Number : ");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int ac = Integer.parseInt(br.readLine());
System.out.println(" Thank you! ");
do{ System.out.println(" Enter D for deposit, W for withdrawal, B for balance, X to exit the menu: "); String ch = br.readLine().toUpperCase();
if(ch.equals("X")) break;
switch (ch){
case "D" : { System.out.println(" Enter the amount of the deposit: "); deposit = Double.parseDouble(br.readLine()); balance = balance + deposit; } break;
case "W" : { System.out.println(" Enter the amount of the withdrawal: "); withdrawal = Double.parseDouble(br.readLine()); balance = balance - withdrawal; } break;
case "B" : System.out.println(" Account Number: "+ac+" has a current balance of : $ "+balance); break;
default: System.out.println(" ERROR: Please enter a D, W, B, or X: "); break; } }while (true);
System.out.println(" Thank you for being a loyal Seminole Bank customer!"); } }
ALGORITHM GIVEN:
import java.util.Scanner; public class BankAccountStudent{ //Main Function public static void main(String []args){ //Declare Scanner object(s) //Declare other variables as needed //Declare and initialize a variable for balance to $5000. //Display the welcome message - (HINT: This method does NOT require a value returned!) //Call the welecomeMessage() function //Prompt the user to enter the account number //HINT: The account number must be returned to main()! In main(), dont forget to assign the call statement to a variable. //Call the accountInfo() function //Process menu using a Do-While loop and Switch statement //This will Display the menu and Call the Function(s) based on the user's choice until the user enters X 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 //Start the switch() statement to determine which function is called based on the users choice //HINT: Each case calls or invokes a function to perform some specific task switch( ){ //Case (If the menu choice is D) //Call the depositFunds(balance) function and assign it to a variable //Case (If the menu choice is W) //Call the withdrawFunds(balance) function and assign it to a variable //Case (If the menu choice is B) //Call the checkBalance(account number, balance) function //Case (If the menu choice is X) //Default for user error handling }//end of switch }while( include condition here ); //Display final message }//end of main /**************************************************** FUNCTION DEFINITIONS *****************************************************/ //Display welcome message public static void welcomeMessage(){ }//end of welcomeMessage //Prompt and Read users account number. RETURN the account number to main(). public static int accountInfo (){ }//end of accountInfo //Display menu choices to the user and Read the users banking choice. RETURN the users menu choice to main(). public static char displayMenu (){ }//end of displayMenu //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(variable for balance){ }//end of depositFunds //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 ( variable for balance){ }//end of withdrawFunds //Display the balance and DO NOT RETURN anything to main(). public static void checkBalance(variable for account number, variable for balance){ }//end of checkBalance /**************************************************END OF FUNCTION DEFINITIONS **************************************************/ }//end of BankAccount Class ![SeminoleBank_B { public static void main(String[] args) throws IOException { double deposit](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f52ae7b2b6d_33566f52ae714d69.jpg)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
