I'm trying to create a method for the display interest and I'm struggling with how to come up with how to get it to work. Any help would be great!
import java.util.Scanner; public class InterestCalculator4 { public static void main(String[] args ) { Scanner input = new Scanner(System.in); String strAnsYesNo; char ansYesNo = 0; do{ //Prompt user to enter loan amount System.out.print("Enter Loan Amount: "); double principle = input.nextInt(); //Prompt user to enter interest rate System.out.print("Enter Yearly Interest Rate (1 to 100 percent): "); double interest = input.nextDouble(); //Prompt user to enter term System.out.print("Enter the Term (in months): "); double term = input.nextInt(); if (principle > 0) { if (interest >= 0 && interest <= 100) { if(term > 0) { int type = 0; //Prompt user to enter calculation type do{System.out.print("Enter Interest Calculation Type (1 – Simple, 2 – Monthly Compounded, 3 – Daily Compounded):"); type = input.nextInt(); switch(type) { case 1: break; case 2: break; case 3: break; default: System.out.println("Calculation Type Error: You must select 1, 2 or 3. You entered " +type); break; } }while(type<1||type>3); } else { System.out.println("Data Error: Term must be greater than zero. You entered " +term); } } else { System.out.println("Data Error: Interest rate must be greater than or equal to zero and less than or equal to 100. You entered " +interest); } } else { System.out.println("Data Error: Loan amount must be greater than zero. You entered " +principle); } // Clear out buffer input.nextLine(); do{ System.out.println("Calculate another loan interest (Yes/No)?"); strAnsYesNo = input.nextLine(); // Make sure user entered in data if (strAnsYesNo.length() > 0) ansYesNo = strAnsYesNo.charAt(0); if(ansYesNo!='y'&& ansYesNo!='Y'&& ansYesNo!='n'&& ansYesNo!='n') { System.out.println("Please enter 'Yes' or 'No'?"); } }while(ansYesNo!='y'&& ansYesNo!='Y'&& ansYesNo!='n'&& ansYesNo!='n'); }while (ansYesNo =='y' || ansYesNo =='Y'); System.out.println("Thank you for using Interest Calculator!"); } /** Round **/ public static double round(double numb1, double numb2) { double round = ((double) Math.round(numb1*(Math.pow(10, numb2)))/(Math.pow(10, numb2)));; return round; } /** Calculate Simple **/ public static double calculateSimpleInterest(double numb1, double numb2, double numb3) { double calculateSimpleInterest = ((numb1)*(numb2/100.0)*(numb3/12.0)); return calculateSimpleInterest; } /** Calculate Compounded Daily **/ public static double calculateCompoundInterest(double numb1, double numb2, double numb3, double numb4 ) { double calculateCompoundInterest = (numb1*Math.pow((1.0+((numb2/100.0)/numb4)),(numb4*(numb3/12.0))))-numb1; return calculateCompoundInterest; } /** display interest **/ public static char displayInterest(double numb1, double numb2, double numb3, char word1, double numb4, double numb5 ) { numb5 = numb1 + numb4; System.out.println("Principal Amount Interest Rate Term Calculation Type Calculated Interest Total Repayment"); System.out.println("---------------- ------------- ---- ---------------- ------------------- ---------------"); System.out.println("+numb1", "+numb2", "numb3", "+word1", "+numb4", "+numb5"); } }