Question

In: Computer Science

Calculate Interest in a Java program. If you know the balance and the annual percentage interest...

Calculate Interest in a Java program.

If you know the balance and the annual percentage interest rate, you can compute the interest on the next monthly payment
using the following formula: interest = balance * (annualInterestRate/1200)

Write a program that reads the balance and the annual percentage interest rate and
displays the interest for the next month.

Create a scanner
Prompt the user to enter a name and create variable for scanner
Prompt the user to enter a balance and the annual percentage interest rate
Create variable double balance for scanner
Create variable double annual for interest rate for scanner

Create variable double interest which is equal to annual for interest rate divided by 1200

Display result of balance

Solutions

Expert Solution

Here is the solution to above problem in Java. Please read the code comments for more information

JAVA CODE

import java.util.*;
public class Main
{
   public static void main(String[] args) {
   //create the Scanner variable
   Scanner sc = new Scanner(System.in);
   //Create variable to take input and result
   double balance,annual,interest;
   //prompt user for balance
       System.out.print("Enter Balance: ");
       balance = sc.nextDouble();
       //prompt user for annual interest rate
       System.out.print("Annual Percentage Interest Rate: ");
       annual = sc.nextDouble();
       //calculate the Interest
       interest = balance *(annual/1200);
       System.out.println("Interest is: " + interest);
      
   }
}


Related Solutions

In java Create a program to calculate interest rate and total balance - the program consists...
In java Create a program to calculate interest rate and total balance - the program consists of (a) A class that encapsulates the interest rate and total balance calculation Constructor should accept initial balance and interest rate Methods: Returns interest rate Returns total balance Set interest rate Set initial balance (b) A test program that uses class from step (A) to perform the following: Set interest rate to 5% and initial balance to 1000 Print interest amount and total balance...
Problem 1: In java Create a program to calculate interest rate and total balance - the...
Problem 1: In java Create a program to calculate interest rate and total balance - the program consists of (a) A class that encapsulates the interest rate and total balance calculation Constructor should accept initial balance and interest rate Methods: Returns interest rate Returns total balance Set interest rate Set initial balance (b) A test program that uses class from step (A) to perform the following: Set interest rate to 5% and initial balance to 1000 Print interest amount and...
Calculate the Annual Percentage Yield (APY) on an account that has a stated interest rate of...
Calculate the Annual Percentage Yield (APY) on an account that has a stated interest rate of 6.21% . Presume your account you deposit 5,875 a year for the next 42 years. Calculate the value of your portfolio when the interest is compounded yearly, quarterly, monthly, and daily.
Calculate the Annual Percentage Yield (APY) on an account that has a stated interest rate of...
Calculate the Annual Percentage Yield (APY) on an account that has a stated interest rate of 5.1% . Presume your account you deposit 6,900 a year for the next 45 years. Calculate the value of your portfolio when the interest is compounded yearly, quarterly, monthly, and daily.
IN JAVA PLEASE Program 4: Is there a Prius version? Did you know that the average...
IN JAVA PLEASE Program 4: Is there a Prius version? Did you know that the average Boeing 747 airplane uses approximately 1 gallon of fuel per second? Given the speed of the airplane, that means it gets 5 gallons to the mile. No, not 5 miles to the gallon, 5 gallons to the mile. You may be questioning why such a horribly inefficient machine is allowed to exist, but you’ll be happy to find out that, because this airplane hold...
Java Write a program to record the GPAs of a class and find the percentage of...
Java Write a program to record the GPAs of a class and find the percentage of students in each GPA. The program first allows the user to enter the number of students enrolled in the class, and then to enter the GPA of all students one by one. For each student, the input must be between 1 and 4 inclusively. Otherwise, the software displays a message as “Invalid number!” and asks for a new GPA for the same student Enter...
Java Using NetBean Calculate the interest for a bank account. Your program should use Scanner to...
Java Using NetBean Calculate the interest for a bank account. Your program should use Scanner to collect account balance and interest rate (input 2.5 for 2.5%), and then output the interest should be paid. interest = balance * interest_rate;
You deposit $175,000 in a savings account. The APR (Annual Percentage Rate) is 6%. Calculate the...
You deposit $175,000 in a savings account. The APR (Annual Percentage Rate) is 6%. Calculate the following: a. Assuming that the interest is compounded once a year, what is the amount accumulated after ten years? b. Assuming that the interest is compounded every month, what is the amount accumulated after ten years? c. Assuming that the interest is compounded every day, what is the amount accumulated after ten years? d. What is the observed effect of compounding at a higher...
Determine the actual annual interest rate on a $100,000 line of credit with an annual percentage...
Determine the actual annual interest rate on a $100,000 line of credit with an annual percentage rate of 10% compounded monthly. The bank requires that a 5% compensating balance be placed in an interest-bearing account that pays an annual percentage rate of 1.5% compounded monthly. The average daily balance is anticipated to be $75,000, excluding the compensating balance and interest due on the line of credit.
JAVA please Program 4: Is there a Prius version? Did you know that the average Boeing...
JAVA please Program 4: Is there a Prius version? Did you know that the average Boeing 747 airplane uses approximately 1 gallon of fuel per second? Given the speed of the airplane, that means it gets 5 gallons to the mile. No, not 5 miles to the gallon, 5 gallons to the mile. You may be questioning why such a horribly inefficient machine is allowed to exist, but you’ll be happy to find out that, because this airplane hold 568...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT