Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions

Question

1. Define the nature of interviews

Answered: 1 week ago

Question

2. Outline the different types of interviews

Answered: 1 week ago