Question: need a java structure chart for my below java program import java.util.Scanner; public class Problem_5_22 { public static void main(String[] args) { boolean run =

need a java structure chart for my below java program

import java.util.Scanner;

public class Problem_5_22 { public static void main(String[] args) { boolean run = true; while(run) { //Creates a Scanner to take in user input Scanner input = new Scanner(System.in);

//Prompts the user to enter the loan amount, the number of years //and the annual interest rate System.out.printf(" Loan Amount: "); double loanAmount = input.nextDouble(); System.out.printf("Number of Years: "); int years = input.nextInt(); System.out.printf("Annual Interest Rate: "); double annualRate = input.nextDouble();

//Calculates the monthly interest rate double monthlyRate = annualRate/1200;

//Calculates the monthly payment amount double monthlyPayment = loanAmount * monthlyRate / (1-1/Math.pow(1 + monthlyRate, years * 12));

//Displays the monthly payment amount System.out.printf("Monthly Payment: %.2f ", monthlyPayment);

//Displays total payments made YTD System.out.printf("Total Payment: %.2f ", (monthlyPayment * 12) * years);

//Creates the amortization/payment schedule and displays by month double balance = loanAmount, principal, interest; System.out.println("Payment# Interest Principal Balance"); for (int i = 1; i <= years * 12; i++) { interest = monthlyRate * balance; principal = monthlyPayment - interest; balance = balance - principal; System.out.printf("%-13d%-13.2f%-13.2f%.2f ", i, interest, principal, balance); } } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!