Question: Java- I need help calling the method I don't know how to update my code to calling method below is in our main() method, where
Java- I need help calling the method
I don't know how to update my code to calling method
below is in our main() method, where within main() we make a call to methods getInterestRate() and displayAccounts()




Hint:
When Defining your methods (section 6.2, Figures 6.1) the method headers (signatures) should be as follows - you will code the logic within each module:
public static double getInterestRate(double deposit)
public static double calcFutureBalance(double deposit, double interest)
public static void displayAccounts(String name, int ckAccount, double ckdeposit, int svAccount, double svdeposit, double interestRate).
**hint: CALL the calcFutureBalance() module FROM displayAccounts() ****
Here is my current code:
import java.util.Scanner;
public class Loop
{ public static void main(String[] args) {
Scanner sc = new Scanner(System.in); String ch = "y"; do { System.out.println("Enter your first name"); String fName = sc.nextLine().toUpperCase(); System.out.println("Enter your last name"); String lName = sc.nextLine().toUpperCase(); System.out.println("Enter the type of account you want to open: Savings or Checking? "); String accType = sc.nextLine(); String checkingAc = ""; double checkingDeposit = 0; if (accType.equalsIgnoreCase("Savings")) { checkingAc = checkingAc + 0; } else if (accType.equalsIgnoreCase("Checking")) { int randomNum = (int) (Math.round(Math.random() * 10000) + 1); checkingAc = randomNum + " " + "Checking"; System.out.println("Enter the initial deposit in checking account: "); checkingDeposit = sc.nextDouble(); } String savingsAc = (Math.round(Math.random() * 10000) + 1) + " " + "Savings"; System.out.println("Enter the initial deposit in savings account: "); double savingDeposit = sc.nextDouble(); if (savingDeposit 100 && savingDeposit 500 && savingDeposit
}
A Yes name = "STOP" NO "Enter accounttype (Checking or Savings)" GET acct Type ...... acctType = "Checking" Yes No "If opening a checking account, you are required to open a Savings account with minimum $100.00 depost Cofinue?" GET continue ckAcct - 0 Yes No continue yes ckDeposit - 0 "Enter Deposit for Savings" GET say Deposit "Enter Deposit for Savings" GET sav Deposit savAcct random SavAcct random Yes No B Yes sav Deposit 100 No sav Deposit 100 ........... Yes No Yes NO PUT "no accounts opened initial depostrequirements not met PUT "no accounts opened initial depost requirements not met sav Deposit 500 sav Deposit = 500 YOS No savDeposit 1000 Yes No interestRate-035 interest Rate .035 savDeposit 1000 V. interest Rate .045 interestRate .045 interestRate .045 interestRate .045 future Balance sav Deposit * (1 + interestRate) 12_ "Enter Deposit for Checking" futureBalance sav Deposit + (1 - interestRate) 12 HOT POT FORMATTED DATAAS DECRIBED IN LABS GET ckDeposit ckAcct random PUT "OUTPUT FORMATTED DATAAS DECRIBED IN LABT getinterestRate calcFuture Balance displayAccounts Start Yes No sav Deposit = 100 Yes No interestRate - 0 sav Deposit = 500 interestRate .035 sav Deposit = 1000 interestRate .045 interestRate -.045 End main getinterestRate calcFutureBalance display Accounts Start futureBalance sav Deposit * - interestRate) 12 End main getinterestRate calcFutureBalance displayAccounts Start calcFuture Balance PUT "Output fomstad information for custom Accounts End A Yes name = "STOP" NO "Enter accounttype (Checking or Savings)" GET acct Type ...... acctType = "Checking" Yes No "If opening a checking account, you are required to open a Savings account with minimum $100.00 depost Cofinue?" GET continue ckAcct - 0 Yes No continue yes ckDeposit - 0 "Enter Deposit for Savings" GET say Deposit "Enter Deposit for Savings" GET sav Deposit savAcct random SavAcct random Yes No B Yes sav Deposit 100 No sav Deposit 100 ........... Yes No Yes NO PUT "no accounts opened initial depostrequirements not met PUT "no accounts opened initial depost requirements not met sav Deposit 500 sav Deposit = 500 YOS No savDeposit 1000 Yes No interestRate-035 interest Rate .035 savDeposit 1000 V. interest Rate .045 interestRate .045 interestRate .045 interestRate .045 future Balance sav Deposit * (1 + interestRate) 12_ "Enter Deposit for Checking" futureBalance sav Deposit + (1 - interestRate) 12 HOT POT FORMATTED DATAAS DECRIBED IN LABS GET ckDeposit ckAcct random PUT "OUTPUT FORMATTED DATAAS DECRIBED IN LABT getinterestRate calcFuture Balance displayAccounts Start Yes No sav Deposit = 100 Yes No interestRate - 0 sav Deposit = 500 interestRate .035 sav Deposit = 1000 interestRate .045 interestRate -.045 End main getinterestRate calcFutureBalance display Accounts Start futureBalance sav Deposit * - interestRate) 12 End main getinterestRate calcFutureBalance displayAccounts Start calcFuture Balance PUT "Output fomstad information for custom Accounts End
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
