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
Differences between unions and structures
vovikov84 [41]

Answer:

A structure is a user-defined data type available in C that allows to combining data items of different kinds. Structures are used to represent a record. A union is a special data type available in C that allows storing different data types in the same memory location.

3 0
3 years ago
Sally needs to teach her class how to convert a decimal number to a binary number. What is the first step she should take to sta
Alborosie

<u>Answer:</u>

  • <em>A. divide the decimal number by the base value 2</em>
  • <em>C. note the remainder separately</em>
  • <em>D. divide by 2 until she gets 0 as the remainder</em>
  • <em>B. collect the digits in the reverse order</em>

<u>Explanation:</u>

When we want to convert decimal number to a binary number first we have divide the given number by 2. The next step is to note the reminder of the number in the side every division so that the reminder value is the binary value. Repeat this until an zero is encountered.

We have to collate all the remainders from last of first and then the collated number is the answer for the given problem.

<em>So the given option can be ordered as, </em>

  • <em>A</em>
  • <em>C</em>
  • <em>D</em>
  • <em>B</em>
6 0
4 years ago
This is the question
nikdorinn [45]

Answer:

I dont know it sorry

Explanation:

i would help u

4 0
3 years ago
Consider the playGame procedure below which calls on 3 other procedures: countFives, player1Move, and player2Move.
emmasim [6.3K]

Answer:

c. RETURN (count)

Explanation:

A typical return statement performs the function of terminating the execution of a function and returns control to the calling function.

Hence, there will execution resumed in the calling function at the point immediately following the call.

Another thing a return statement can do is to also return a value to the calling function.

The code RETURN (count) will

terminating the execution of a function and returns control to the calling function.

3 0
3 years ago
6.8 Code Practice<br> please can have some help please
babymother [125]
Sure what is the question though
7 0
3 years ago
Other questions:
  • intext:"The browser feature which enables tabs to work independently from one another so if one crashes, the others may continue
    12·1 answer
  • The feedforward part of the conversation should do all of the following except __________.a.identify the toneb.introduce the pur
    11·1 answer
  • PPE that should be used by every technician include all of the following, EXCEPT
    6·2 answers
  • Once a table is inserted into a publication, which two tabs become available?
    5·1 answer
  • Speculate on how students 25 years from now will answer, "What computing innovation has had a significant impact on your life?"
    11·1 answer
  • Which network component blocks status?
    9·1 answer
  • What is the maximum number of communication paths for a team of twenty people.
    14·1 answer
  • viewRatings(string, int) Takes a username and a minimum rating value. It prints all the books that the user has rated with a val
    10·1 answer
  • Questione
    6·1 answer
  • Edhesive 6.8 lesson practice answers
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!