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

I need the functions such as (variables) of this code to be changed and add comm

ID: 3574511 • Letter: I

Question

I need the functions such as (variables) of this code to be changed and add comments! it is to be displayed in GUI java.

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

import java.text.DecimalFormat;

public class Y_methods{

   public static double balanceCheck=3000;

   public static double balanceSav=3000;

   public static double loanPayment=10000;

   static DecimalFormat fmt=new DecimalFormat("'$'0,000.00");

  

   public static double withdrawCheck(double a){

       balanceCheck=balanceCheck-a;      

       return balanceCheck;

   }

  

   public static double depositCheck(double a){

       balanceCheck=balanceCheck+a;

       return balanceCheck;

   }

  

   public static String displayCheck(){

       return("Your checking balance is: "+ fmt.format(balanceCheck));

   }

   public static double withdrawSav(double a){

       balanceSav=balanceSav-a;      

       return balanceSav;

   }

  

   public static double depositSav(double a){

       balanceSav=balanceSav+a;

       return balanceSav;

   }

  

   public static String displaySav(){

       return("Your savings balance is: "+ fmt.format(balanceSav));

   }

  

   public static double makeLoanPayment(double a){

       loanPayment=loanPayment-a;

       return loanPayment;

   }

  

   public static String displayLoan(){

       return("After payment, your loan is down to "+ fmt.format(loanPayment));

   }

}

Explanation / Answer

import java.text.DecimalFormat;
public class Y_methods{
public static double balChk=3000;
public static double balSav=3000;
public static double loanPay=10000;
static DecimalFormat fmt=new DecimalFormat("'$'0,000.00");
  
public static double withdrawCheck(double a){
balChk=balChk-a;
return balChk;
} // After withdraw amount it returns the remaining balance.
  
public static double depositCheck(double a){
balChk=balChk+a;
return balChk;
} // After deposited amount it returns the balance in your account.
  
public static String displayCheck(){
return("Your checking balance is: "+ fmt.format(balChk));
}
public static double withdrawSav(double a){
balSav=balSav-a;
return balSav;
}
  
public static double depositSav(double a){
balSav=balSav+a;
return balSav;
}
  
public static String displaySav(){
return("Your savings balance is: "+ fmt.format(balSav));
}
  
public static double makeLoanPayment(double a){
loanPay=loanPay-a;
return loanPay;
}
  
public static String displayLoan(){
return("After payment, your loan is down to "+ fmt.format(loanPay));
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote