1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
velikii [3]
3 years ago
12

Write a Java program that can compute the interest on the next monthly mortgage payment. The program reads the balance and the a

nnual percentage interest rate from the console.
The interest rate should be entered as a percentage value and not as a floating-point number (e.g.: for an interest rate of 4.25%, the user should enter 4.25, and not 0.0425). The program should check to be sure that the inputs of balance and the interest rate are not negative. The program should then compute and display the interest amount as a floating-point number with 2 digits after the floating point.
Formula: the interest on the next monthly mortgage payment can be computed using the following formula: Interest = balance x (annualInterestRate / 1200)
Computers and Technology
1 answer:
kherson [118]3 years ago
3 0

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

   

    double balance, rate, interest;

   

 System.out.print("Enter the balance: ");

 balance = input.nextDouble();

 

 System.out.print("Enter the annual percentage interest rate [%4.25 must be entered as 4.25]: ");

 rate = input.nextDouble();

 

 if(balance < 0 || rate < 0)

     System.out.println("The balance and/or interest rate cannot be negative!");

 else{

     interest = balance * (rate / 1200);

     System.out.printf("The interest amount $%.2f", interest);

 }

}

}

Explanation:

Ask the user to enter the balance

Ask the user to enter the interest rate as given format

Check the balance and rate. If any negative value is entered, print an error message. Otherwise, calculate the interest using the given formula and print the interest in required format

You might be interested in
Lacking in movement, action, or change, especially in a way viewed as undesirable or uninteresting�
Elenna [48]

Answer:

Static

Explanation:

I just took the test man!

5 0
3 years ago
Unscramble the words <br><br> A: ESUOM RETUPOC <br><br> B: KSID EVIRD
Mrrafil [7]
A. Mouse coputer
B. Disk drive
5 0
4 years ago
Read 2 more answers
PLz answer I really need the answer
zlopas [31]

Answer:

a

Explanation:

job leads

4 0
3 years ago
Read 2 more answers
Bukod sa nakasulat na impormasyon ay makakakita rin ng larawan sa internet.​
faltersainse [42]

i woud love to help but i dont understand the language

7 0
2 years ago
• Why does a lunar eclipse last longer than a solar eclipse?
Wittaler [7]
The shadow cast by the earth is quite a bit larger than the moon
5 0
4 years ago
Other questions:
  • Which of the following techniques has to do with how the people who make the commercial manipulate the way it looks?
    8·1 answer
  • The ___________ process transforms new memories from a fragile state, in which they can be disrupted, to a more permanent state,
    10·1 answer
  • Assume that an array of Integers named a that contains exactly five elements has been declared and initialized. In addition, an
    12·1 answer
  • the command prompt window should be avoided because it is dangerous to do commands there? True or false
    14·1 answer
  • Now tell me how be rich like Bill Gates
    6·1 answer
  • As a project manager, why is analysis an important aspect of the job?
    10·1 answer
  • Information systems cannot solve some business problems. Give three examples and explain why technology cannot help
    11·1 answer
  • Importance of professional education​
    15·1 answer
  • Why is making a model, or prototype, important in the design process?
    6·1 answer
  • What are some potential challenges that society will face given the digital revolution? You may want to think particularly of th
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!