You are on page 1of 2

 

String Borrowers_name;
            Double  annual_loan, term, i_rate, interest, total_loan, annual_amort,monthly_amort;
            
            DecimalFormat df = new DecimalFormat("#.##");
            Scanner mar = new Scanner (System.in);
                
                System.out.println("Borrower's Name: ");
                        Borrowers_name = mar.nextLine();
                        
                        System.out.println("Amount of Loan: ");
                        annual_loan = mar.nextDouble();
                        
                        System.out.println("Term: ");
                        term = mar.nextDouble();
            
                        if (term >= 16){
                    i_rate = .12 ;     
                }
                else if (term >= 12 && term <= 15){
                    i_rate = .10 ;              
                }
                else if (term >= 10 && term <= 11){
                    i_rate = .08 ;
                }
                else if (term >= 8 && term <= 9){
                    i_rate = .07 ;
                }
                else if (term >= 5 && term <= 7){
                    i_rate = .06 ;
                }
                else if (term >= 3 && term <= 4){
                    i_rate = .05 ;
                }
                else {
                    i_rate = .03 ;
                }
               
           interest = annual_loan * i_rate * term ;
           total_loan = annual_loan + interest ;
           annual_amort = total_loan / term ;
           monthly_amort = annual_amort / 12 ;
           
           System.out.println("Interest:"  + df.format (interest));
           System.out.println("Total Loan:"  + df.format (total_loan));
           System.out.println("Annual Amortization:"  + df.format (annual_amort));
           System.out.println("Monthly Amortization:"+ df.format (monthly_amort));
            
             System.exit(0);
    }
    
}

You might also like