Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

import java.util.Scanner; public class MiniTellerShell { /* in the main method y

ID: 3801234 • Letter: I

Question

 import java.util.Scanner; public class MiniTellerShell {   /* in the main method you need to call the method validChoice   as long as the user's choice is not Q or q     based on the user's choice call the appropriate methods such as balance, depoist, withdraw and cretate     once the user select Q or q, prompt the user if there is another customer   */   public static void main(String[] args)   {     Scanner kb = new Scanner(System.in);     String choice ="";     double balance = 0;     description();     boolean repeat = true;     String answer = "";     boolean account = false;     while (repeat)  //as long as there is another user     {        balance = 0;        choice = "";        account = false;        while (!choice.equalsIgnoreCase("Q"))// as long as the user has not selected quit        {           //your code includes conditional statments        }                         }       System.out.println("The system is about to shut down");           }   /*This method accepts a Scanner object and the balance of the money that the person has as its parameter   prompt the user to enter the amount of the money to withdraw   call the method dataValiation to get the user's input   if the user's input is more than the balance display that the user cannot withdraw that amount   if the  balance - the user's input is less than 100 then no withdraw can be done   otherwise the withdraw can be done therefore the user's input must be subtracted from the balance. then return the new balance     */   public static double withdraw(Scanner kb, double balance)   {                   return 0;            }   /*this method prompt the user for the amount to deposit   call the method dataValidation to get the user's input   add the amonmut to the balance, return the new balance*/   public static double deposit(Scanner kb, double balance)   {          return 0;   }   /*   this method prompts the user to enter the initial amount of the money to cretae the account   call the method dataValidation   if the user's input is less than 100, the account cannot be cretaed   otherwise the account will be cretaed and a message will be displayed   indicating that the account has been cretaed, the initial amount of the money will be returned   */   public static double create(Scanner kb)   {      return 0;   }             /*   This method outputs Welcome to the Bank of America message including all the back slashes   */   public static void description( )   {   }   /*   This method displays the choices that the user has*/   public static void displayChoices()   {     }    /*this method prompts the user to enter the choice   as long as the user does not have a valid choice, it will keep prompting the user   for a valid choice*/        public static String validChoice(Scanner kb)   {                    return "";   }    /*This method accepts the scanner object and a message to be displayed on the screen   Outputs the prompt on the screen sking the user to enter the amount   As long as the amount is less than zero and as long as the user is entering an invalid    double value, this method should keep prompting the user for a valid amount.   return the valid amount*/      public static double dataValidation(String prompt, Scanner kb)   {            return 0;                  }    }   /*sample output  ____________________________________________________________________________________________________    \\\\\\\\\\\\\\\\\\\\\\  \     Welcome to the Bank of America      \  \\\\\\\\\\\\\\\\\\\\\\    Select one of the following options  Press C to create a new account  press D to deposit  press W to withdraw  press B for Balance  Press Q to quit  Enter your choice ---> r  Enter a valid choice ---> t  Enter a valid choice ---> c  lets cretae an account for you.  Enter the initial amount of money--> -20  You must enter a positive amount of money.   Enter a valid amount: 80  You must deposit 100 or more to create a new account  Do you want to cretae a new account? yes  Enter the initial amount of money--> 100  Your account has been cretaed successfully    Select one of the following options  Press C to create a new account  press D to deposit  press W to withdraw  press B for Balance  Press Q to quit  Enter your choice ---> w  Enter the amount of the withdraw--> 20  Your balance cannot go below 100 dollars.   your balance after withdraw will be :80.0  The amount of the money that you have is-->100.0    Hit enter key to continue -->     Select one of the following options  Press C to create a new account  press D to deposit  press W to withdraw  press B for Balance  Press Q to quit  Enter your choice ---> w  Enter the amount of the withdraw--> 100  Your balance cannot go below 100 dollars.   your balance after withdraw will be :0.0  The amount of the money that you have is-->100.0    Hit enter key to continue -->     Select one of the following options  Press C to create a new account  press D to deposit  press W to withdraw  press B for Balance  Press Q to quit  Enter your choice ---> d  Your balance is--> 100.0  Enter the amount of the money to deposit--> 200  Your new balance after deposit is: 300.0    Hit enter key to continue -->     Select one of the following options  Press C to create a new account  press D to deposit  press W to withdraw  press B for Balance  Press Q to quit  Enter your choice ---> w  Enter the amount of the withdraw--> 150  The amount of the money you have--> 300.0  The amount of the money that you have is-->150.0    Hit enter key to continue -->     Select one of the following options  Press C to create a new account  press D to deposit  press W to withdraw  press B for Balance  Press Q to quit  Enter your choice ---> c  You already have an account.    Hit enter key to continue -->     Select one of the following options  Press C to create a new account  press D to deposit  press W to withdraw  press B for Balance  Press Q to quit  Enter your choice ---> B  Your balance is --> 150.0    Hit enter key to continue -->     Select one of the following options  Press C to create a new account  press D to deposit  press W to withdraw  press B for Balance  Press Q to quit  Enter your choice ---> w  Enter the amount of the withdraw--> 200  You do not have enough money to withdraw  The amount of the money that you have is-->150.0    Hit enter key to continue -->     Select one of the following options  Press C to create a new account  press D to deposit  press W to withdraw  press B for Balance  Press Q to quit  Enter your choice ---> w  Enter the amount of the withdraw--> 51  Your balance cannot go below 100 dollars.   your balance after withdraw will be :99.0  The amount of the money that you have is-->150.0    Hit enter key to continue -->     Select one of the following options  Press C to create a new account  press D to deposit  press W to withdraw  press B for Balance  Press Q to quit  Enter your choice ---> q  Thanks for being our loyal customer.  Is there another user?yes/no yes    Select one of the following options  Press C to create a new account  press D to deposit  press W to withdraw  press B for Balance  Press Q to quit  Enter your choice ---> C  lets cretae an account for you.  Enter the initial amount of money--> 100  Your account has been cretaed successfully    Select one of the following options  Press C to create a new account  press D to deposit  press W to withdraw  press B for Balance  Press Q to quit  Enter your choice ---> q  Thanks for being our loyal customer.  Is there another user?yes/no no  The system is about to shut down   _____________________________________________________________________________________________________  */ 

Explanation / Answer

Here is the code for you:

import java.util.Scanner;
public class MiniTellerShell
{
/* in the main method you need to call the method validChoice
as long as the user's choice is not Q or q
based on the user's choice call the appropriate methods such as balance, depoist, withdraw and cretate
once the user select Q or q, prompt the user if there is another customer
*/
public static void main(String[] args)
{
Scanner kb = new Scanner(System.in);
String choice ="";
double balance = 0;
description();
boolean repeat = true;
String answer = "";
boolean account = false;
while (repeat) //as long as there is another user
{
balance = 0;
choice = "";
account = false;
while (!choice.equalsIgnoreCase("Q"))// as long as the user has not selected quit
{
//your code includes conditional statements
displayChoices();
choice = validChoice(kb);
switch(choice)
{
    case "C":   balance = create(kb);
                System.out.println("The amount of the money that you have is-->" + balance); break;
    case "D":   balance = deposit(kb, balance);
                System.out.println("The amount of the money that you have is-->" + balance); break;
    case "W":   balance = withdraw(kb, balance);
                System.out.println("The amount of the money that you have is-->" + balance); break;
    case "B":   System.out.println("Your balance is --> " + balance); break;
    case "Q":   break;
}
}
System.out.println("Thanks for being our loyal customer.");
System.out.print(" Is there another user?yes/no ");
String str = kb.next();
if(str.toUpperCase().equals("YES"))
   continue;
else
   break;     
}
System.out.println("The system is about to shut down");

}
/*This method accepts a Scanner object and the balance of the money that the person has as its parameter
prompt the user to enter the amount of the money to withdraw
call the method dataValiation to get the user's input
if the user's input is more than the balance display that the user cannot withdraw that amount
if the balance - the user's input is less than 100 then no withdraw can be done
otherwise the withdraw can be done therefore the user's input must be subtracted from the balance. then return the new balance
*/
public static double withdraw(Scanner kb, double balance)
{

double amount = dataValidation("Enter the amount of the withdraw--> ", kb);
if(amount > balance)
   System.out.println("You do not have enough money to withdraw");
else if(balance - amount < 100)
{
    System.out.println("Your balance cannot go below 100 dollars.");
    System.out.println(" your balance after withdraw will be : " + (balance-amount));
}  
else
{
    System.out.println("The amount of the money you have--> " + balance);
    balance -= amount;
}
return balance;
  
}
/*this method prompt the user for the amount to deposit
call the method dataValidation to get the user's input
add the amount to the balance, return the new balance*/
public static double deposit(Scanner kb, double balance)
{
double amount = dataValidation(" Enter the amount of the money to deposit--> ", kb);
balance += amount;
return balance;
}
/*
this method prompts the user to enter the initial amount of the money to cretae the account
call the method dataValidation
if the user's input is less than 100, the account cannot be cretaed
otherwise the account will be cretaed and a message will be displayed
indicating that the account has been cretaed, the initial amount of the money will be returned
*/
public static double create(Scanner kb)
{
while(true)
{
   double amount = dataValidation("Enter the initial amount of money--> ", kb);
   if(amount < 0)
   {
      System.out.println("You must enter a positive amount of money.");
      amount = dataValidation("Enter a valid amount: ", kb);
   }
   else if(amount < 100)
   {
      System.out.println("You must deposit 100 or more to create a new account");
      System.out.print("Do you want to cretae a new account? ");
      String str = kb.next();
      if(str.toUpperCase().equals("YES"))
          create(kb);
      else
          return 0;  
         
   }   
   else
       return amount;
}  
//return 0;
}

/*
This method outputs Welcome to the Bank of America message including all the back slashes
*/
public static void description( )
{
   System.out.println("\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");
   System.out.println("\\ Welcome to the Bank of America \\");
   System.out.println("\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");
}
/*
This method displays the choices that the user has*/
public static void displayChoices()
{
   System.out.println(" Select one of the following options");
   System.out.println(" Press C to create a new account");
   System.out.println(" press D to deposit");
   System.out.println(" press W to withdraw");
   System.out.println(" press B for Balance");
   System.out.println(" Press Q to quit");
}
/*this method prompts the user to enter the choice
as long as the user does not have a valid choice, it will keep prompting the user
for a valid choice*/   
public static String validChoice(Scanner kb)
{
while(true)
{
    System.out.print("Enter your choice ---> ");
String choice = kb.next().toUpperCase();
switch(choice)
    {
       case "C":
       case "D":
       case "W":
       case "B":
       case "Q":   return choice;
    }
}
//return "";
}
/*This method accepts the scanner object and a message to be displayed on the screen
Outputs the prompt on the screen asking the user to enter the amount
As long as the amount is less than zero and as long as the user is entering an invalid
double value, this method should keep prompting the user for a valid amount.
return the valid amount*/
  
public static double dataValidation(String prompt, Scanner kb)
{
while(true)
{
   System.out.print(prompt);
   double amount = kb.nextDouble();
   if(amount >= 0)
       return amount;
   }   

//return 0;
  

}
}
/*sample output
____________________________________________________________________________________________________

\\\\\\\\\\\\\\\\\\\\\\
\ Welcome to the Bank of America \
\\\\\\\\\\\\\\\\\\\\\\

Select one of the following options
Press C to create a new account
press D to deposit
press W to withdraw
press B for Balance
Press Q to quit
Enter your choice ---> r
Enter a valid choice ---> t
Enter a valid choice ---> c
lets cretae an account for you.
Enter the initial amount of money--> -20
You must enter a positive amount of money.
Enter a valid amount: 80
You must deposit 100 or more to create a new account
Do you want to cretae a new account? yes
Enter the initial amount of money--> 100
Your account has been cretaed successfully

Select one of the following options
Press C to create a new account
press D to deposit
press W to withdraw
press B for Balance
Press Q to quit
Enter your choice ---> w
Enter the amount of the withdraw--> 20
Your balance cannot go below 100 dollars.
your balance after withdraw will be :80.0
The amount of the money that you have is-->100.0

Hit enter key to continue -->

Select one of the following options
Press C to create a new account
press D to deposit
press W to withdraw
press B for Balance
Press Q to quit
Enter your choice ---> w
Enter the amount of the withdraw--> 100
Your balance cannot go below 100 dollars.
your balance after withdraw will be :0.0
The amount of the money that you have is-->100.0

Hit enter key to continue -->

Select one of the following options
Press C to create a new account
press D to deposit
press W to withdraw
press B for Balance
Press Q to quit
Enter your choice ---> d
Your balance is--> 100.0
Enter the amount of the money to deposit--> 200
Your new balance after deposit is: 300.0

Hit enter key to continue -->

Select one of the following options
Press C to create a new account
press D to deposit
press W to withdraw
press B for Balance
Press Q to quit
Enter your choice ---> w
Enter the amount of the withdraw--> 150
The amount of the money you have--> 300.0
The amount of the money that you have is-->150.0

Hit enter key to continue -->

Select one of the following options
Press C to create a new account
press D to deposit
press W to withdraw
press B for Balance
Press Q to quit
Enter your choice ---> c
You already have an account.

Hit enter key to continue -->

Select one of the following options
Press C to create a new account
press D to deposit
press W to withdraw
press B for Balance
Press Q to quit
Enter your choice ---> B
Your balance is --> 150.0

Hit enter key to continue -->

Select one of the following options
Press C to create a new account
press D to deposit
press W to withdraw
press B for Balance
Press Q to quit
Enter your choice ---> w
Enter the amount of the withdraw--> 200
You do not have enough money to withdraw
The amount of the money that you have is-->150.0

Hit enter key to continue -->

Select one of the following options
Press C to create a new account
press D to deposit
press W to withdraw
press B for Balance
Press Q to quit
Enter your choice ---> w
Enter the amount of the withdraw--> 51
Your balance cannot go below 100 dollars.
your balance after withdraw will be :99.0
The amount of the money that you have is-->150.0

Hit enter key to continue -->

Select one of the following options
Press C to create a new account
press D to deposit
press W to withdraw
press B for Balance
Press Q to quit
Enter your choice ---> q
Thanks for being our loyal customer.
Is there another user?yes/no yes

Select one of the following options
Press C to create a new account
press D to deposit
press W to withdraw
press B for Balance
Press Q to quit
Enter your choice ---> C
lets cretae an account for you.
Enter the initial amount of money--> 100
Your account has been cretaed successfully

Select one of the following options
Press C to create a new account
press D to deposit
press W to withdraw
press B for Balance
Press Q to quit
Enter your choice ---> q
Thanks for being our loyal customer.
Is there another user?yes/no no
The system is about to shut down

_____________________________________________________________________________________________________
*/