I need some help with the following instructions because I find it so hard that I'm so desperately want to solve it:   These are the instructions: The program will also include entry of the name(s) for the mortgagee (person taking out the loan for the mortgage) and the date the calculations were made. The program will also ask if the client wants to run the program again [that way the Smiths' will be able to see what their monthly mortage payment will be if they take out a 30-year, 20-year, or 10-year mortgage.     (I have implemented this part already but please check it again maybe my code is incorrect) The formula to calculate the monthly payment is as follows:  Fixed Monthly Mortgage Repayment Calculation = P * r * (1 + r)n / [(1 + r)n - 1] where P = Outstanding loan amount, r = Effective monthly interest rate (divide r by 12), n = Total number of periods (i.e., years x 12 months)     This is my Code it's working already but I need to add some features and corrections.   import java.util.Scanner; public class Main {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);   String a=" ";   do{   System.out.println(java.time.LocalDateTime.now());    System.out.println("Enter name");   String name=sc.nextLine();   System.out.println("Enter the purchase price");   int pp=sc.nextInt();   System.out.println("Enter the downpayment");   int dp=sc.nextInt();   /* if down payment is in percentage then convert it to amount   int amount=(dp/100)*pp   System.out.println(amount);   */   System.out.println("Loan amount");   float la=pp-dp;   System.out.println(la);   System.out.println("Interest rate");   float ir=sc.nextFloat();   System.out.println("No of years of mortage");   float time=sc.nextInt();   float r=ir/12;   float n=time*12;      float x = dp * r * (1 + r)*n;      float y =  (1 + r)*n - 1;      float montlyrate=x/y;      System.out.println(montlyrate);        System.out.println("do you want to continue?then type Yes");         a=sc.next(); } while(a=="Yes"); } }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I need some help with the following instructions because I find it so hard that I'm so desperately want to solve it:

 

These are the instructions:

The program will also include entry of the name(s) for the mortgagee (person taking out the loan for the mortgage) and the date the calculations were made. The program will also ask if the client wants to run the program again [that way the Smiths' will be able to see what their monthly mortage payment will be if they take out a 30-year, 20-year, or 10-year mortgage.

 

 

(I have implemented this part already but please check it again maybe my code is incorrect)

The formula to calculate the monthly payment is as follows: 

Fixed Monthly Mortgage Repayment Calculation = P * r * (1 + r)n / [(1 + r)n - 1]

where P = Outstanding loan amount, r = Effective monthly interest rate (divide r by 12), n = Total number of periods (i.e., years x 12 months)

 

 

This is my Code it's working already but I need to add some features and corrections.

 

import java.util.Scanner;
public class Main
{
 public static void main(String[] args) {
  Scanner sc=new Scanner(System.in);
  String a=" ";
  do{
  System.out.println(java.time.LocalDateTime.now()); 
  System.out.println("Enter name");
  String name=sc.nextLine();
  System.out.println("Enter the purchase price");
  int pp=sc.nextInt();
  System.out.println("Enter the downpayment");
  int dp=sc.nextInt();
  /* if down payment is in percentage then convert it to amount
  int amount=(dp/100)*pp
  System.out.println(amount);
  */
  System.out.println("Loan amount");
  float la=pp-dp;
  System.out.println(la);
  System.out.println("Interest rate");
  float ir=sc.nextFloat();
  System.out.println("No of years of mortage");
  float time=sc.nextInt();
  float r=ir/12;
  float n=time*12;
     float x = dp * r * (1 + r)*n;
     float y =  (1 + r)*n - 1;
     float montlyrate=x/y;
     System.out.println(montlyrate);
 
     System.out.println("do you want to continue?then type Yes");
        a=sc.next();

}
while(a=="Yes");

}
}

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education