Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a flow chart for the following code import java.util.Scanner; public class ComputeLoan { public static void main(String[] args) { // Create a Scanner Scanner

Create a flow chart for the following code

import java.util.Scanner;

public class ComputeLoan {

public static void main(String[] args) {

// Create a Scanner

Scanner input = new Scanner(System.in);

// Enter annual interest rate in percentage, e.g., 7.25%

System.out.print("Enter annual interest rate, e.g., 7.25%: ");

double annualInterestRate = input.nextDouble();

// Obtain monthly interest rate

double monthlyInterestRate = annualInterestRate / 1200;

// Enter number of years

System.out.print(

"Enter number of years as an integer, e.g., 5: ");

int numberOfYears = input.nextInt();

// Enter loan amount

System.out.print("Enter loan amount, e.g., 120000.95: ");

double loanAmount = input.nextDouble();

//Calculate payment

double monthlyPayment = loanAmount * monthlyInterestRate / (1

- 1 / Math.pow(1 + monthlyInterestRate, numberOfYears * 12));

double totalPayment = monthlyPayment * numberOfYears * 12;

// Display results

System.out.println("The monthly payment is $" +

(int)(monthlyPayment * 100) / 100.0);

System.out.println("The total payment is $" +

(int)(totalPayment * 100) / 100.0);

}

}

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

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions

Question

=+Ha : concealed weapons laws reduce crime Explain.

Answered: 1 week ago