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

I need some help with the pseudocode for the following problem please. I need so

ID: 3771033 • Letter: I

Question

I need some help with the pseudocode for the following problem please.

I need some help with the pseudocode for the problem below.

Design a generic class tohold the following information about a bank account: Balance,Number of deposits this month, Number of withdrawals, Annualinterest rate, Monthly service charges. The class should havethe following member functions: The class should have thefollowing member functions:

constructor: Accepts arguments for the balance and annual interestrate.

deposit: A function that accepts an argument for the amount of thedeposit. The function should add the argument to the accountbalance. It should also increment the variable holding the numberof deposits.

withdraw: A function that accepts an argument for the amount of thewithdrawal. The function should subtract the argument from thebalance. It should also increment the variable holding the numberof withdrawals.

calcInt: A function that updates the balance by calculating themonthly interest earned by the account, and adding this interest tothe balance. This is performed by the following formulas:
Monthly Interest Rate = (Annual Interest Rate /12)
Monthly Interest = Balance * Monthly Interest Rate
Balance = Balance + Monthly Interest

monthlyProc: A function that subtracts the monthly service chargesfrom the balance, calls the calcInt function, and then sets thevariables that hold the number of withdrawals, number of deposits,and monthly service charges to zero.

Next, design a savings account class, derived from the genericaccount class. The savings account class should have the followingadditional member:

status (to represent an active or inactive account)

If the balance of a savings account falls below $25, it becomesinactive. The status member could be a flag variable. No morewithdrawals may be made until the balance is raised above $25, atwhich time the account becomes active again. The savings accountclass should have the following member functions:

withdraw: a function that checks to see if the account is inactivebefore a withdrawal is made. (No withdrawal will be allowed if theaccount is not active). A withdrawal is then made by calling thebase class version of the function.

deposit: a function that checks to see if the account is inactivebefore a deposit is made. If the account is inactive and thedeposit brings the balance above $25, the account becomes activeagain. The deposit is then made by calling the base class versionof the function.

monthlyProc: before the base class function is called, thisfunction checks the number of withdrawals. If the number ofwithdrawals for the month is more than 4, a service charge of $1for each withdrawal above 4 is added to the base class variablethat holds the monthly service charges. (Don’t forget tocheck the account balance after the service charge is taken. If thebalance falls below $25, the account becomes inactive).

The program should display statistics of the month, includingbeginning balance, total amount of deposits, total amount ofwithdrawals, service charges, and ending balance.

Explanation / Answer

Psuedo Code:

class BankAccount

   Declare public balance as float
   Declare public no_deposits_month as int
   Declare public no_witthdrawls as int
   Declare public annual_int_rate as float
   Declare public monthly_service_charges as float
  
   //For statistics purpose
   Declare public opening_balance as float and set to 0
   Declare public deposit_amounts as float and set to 0
   Declare public withdraw_amounts as float and set to 0
   Declare public closing_balance as float and set to 0
  
   //The BankAccount Constructor
   BankAccount(float o_balance, float o_annual_int_rate)
  
       set balance = o_balance
       set annual_int_rate = o_annual_int_rate
       set opening_balance = balance
      
   End Constructor
  
   public Function deposit(float deposit_amt) returns void
  
       set balance = balance + deposit_amt
       set no_deposits_month = no_deposits_month + 1
       set deposit_amounts = deposit_amounts + deposit_amt
      
   End Function
  
   public Function withdraw(float withdraw_amt) returns void
  
       set balance = balance - withdraw_amt
       set no_witthdrawls = no_witthdrawls + 1
       set withdraw_amounts = withdraw_amounts + withdraw_amt
  
   End Function
  
   public Function calcInt() returns void
  
       declare monthly_int_rate as float
       set monthly_int_rate = annual_int_rate / 12
      
       declare monthly_intrest as float
       set float monthly_intrest = balance * monthly_int_rate
      
       set balance = balance + monthly_intrest
  
   End Function
  
   public Function monthlyProc() returns void
  
       set balance = balance - monthly_service_charges
       set closing_balance = opening_balance + deposit_amounts - withdraw_amounts
       set no_deposits_month = 0
       set no_witthdrawls = 0
       set monthly_service_charges = 0
       set opening_balance = 0
       set withdraw_amounts = 0
       set deposit_amounts = 0
       set closing_balance = 0
  
   End Function
  
End Class


class SavingsAccount derived from base class BankAccount

   declare public account_status as int //1 - Active 0 - Inactive
  
  
   public Function get_status(float current_balance) returns integer
  
       if current_balance less than 25
           return 0
       else
           return 1
       End if
  
   End Function
  
  
   public Function withdraw(float withdraw_amt) returns void
  
       set account_status = get_status(balance)
      
       if account_status is equal to 1
           call base class function withdraw(withdraw_amt)
       else
           print "Account is Inactive... Due to insufficient funds in your account ...."
       End if
  
   End Function
  
  
   public Function deposit(float deposit_amt) returns void
  
       set account_status = get_status(balance)
      
       if account_status is equal to 1
           call base class function deposit(deposit_amt)
       else
           set account_status = get_status(balance + deposit_amt)
           if account_status is equal to 1
               call base class function deposit(deposit_amt)
           else
               print "Account is Inactive... Due to insufficient funds in your account ...."
           End if
       End if
      
   End Function
  
  
   public Function monthlyProc() returns void
  
       if no_witthdrawls is greater than 4
      
           set monthly_service_charges = 1
           call base class function monthlyProc()
           set account_status = get_status(balance)
      
       End if
  
   End Function
  
  
   public Function display_statistics() returns void
  
       print "***************** Monthly Statistics *******************"
       print " Beginning Balance: " + opening_balance
       Print " Total Amount of deposits: " + deposit_amounts
       Print " Total Amount of withdraws: " + withdraw_amounts
       Print " Service Charges: " + monthly_service_charges
       Print " Ending Balance: " + closing_balance
  
   End Function

End Class

---------------------------------------------------------------------------------------------------------------------------------------------------------

Java Code:

class BankAccount
{

   public float balance;
   public int no_deposits_month;
   public int no_witthdrawls;
   public float annual_int_rate;
   public float monthly_service_charges;
  
   //For statistics purpose
   public float opening_balance = 0;
   public float deposit_amounts = 0;
   public float withdraw_amounts = 0;
   public float closing_balance = 0;

   BankAccount(float balance, float annual_int_rate)
   {
       this.balance = balance;
       opening_balance = balance;
   }
  
   public void deposit(float deposit_amt)
   {
       this.balance = this.balance + deposit_amt;
       this.no_deposits_month = this.no_deposits_month + 1;
       deposit_amounts = deposit_amounts + deposit_amt;
   }
  
   public void withdraw(float withdraw_amt)
   {
       this.balance = this.balance - withdraw_amt;
       this.no_witthdrawls = this.no_witthdrawls + 1;
       withdraw_amounts = withdraw_amounts + withdraw_amt;
   }
  
   public void calcInt()
   {
       float monthly_int_rate = annual_int_rate / 12;
       float monthly_intrest = balance * monthly_int_rate;
       balance = balance + monthly_intrest;
   }
  
   public void monthlyProc()
   {
       balance = balance - monthly_service_charges;
       closing_balance = opening_balance + deposit_amounts - withdraw_amounts;
       no_deposits_month = 0;
       no_witthdrawls = 0;
       monthly_service_charges = 0;
       opening_balance = 0;
       withdraw_amounts = 0;
       deposit_amounts = 0;
       closing_balance = 0;
   }
  
}

class SavingsAccount extends BankAccount
{

   public int account_status; //1 - Active 0 - Inactive
  
   public int get_status(float current_balance)
   {
       if(current_balance < 25)
           return 0;
       else
           return 1;
   }
  
   public void withdraw(float withdraw_amt)
   {
       account_status = get_status(balance);
       if(account_status == 1)
           super.withdraw(withdraw_amt);
       else
           System.out.println("Account is Inactive... Due to insufficient funds in your account ....");
   }
  
   public void deposit(float deposit_amt)
   {
       account_status = get_status(balance);
       if(account_status == 1)
           super.deposit(deposit_amt);
       else
       {
           account_status = get_status(balance + deposit_amt);
           if(account_status == 1)
               super.deposit(deposit_amt);
           else
               System.out.println("Account is Inactive... Due to insufficient funds in your account ....");
       }
   }
  
   public void monthlyProc()
   {
       if(no_witthdrawls > 4)
       {
           monthly_service_charges = 1;
           super.monthlyProc();
           account_status = get_status(balance);
       }
   }
  
   public void display_statistics()
   {
       System.out,println("***************** Monthly Statistics *******************");
       System.out,println(" Beginning Balance: " + opening_balance);
       System.out,println(" Total Amount of deposits: " + deposit_amounts);
       System.out,println(" Total Amount of withdraws: " + withdraw_amounts);
       System.out,println(" Service Charges: " + monthly_service_charges);
       System.out,println(" Ending Balance: " + closing_balance);
   }
}