Question

In: Computer Science

There is a cost of money. When someone loans you money, they expect to profit (maybe...

There is a cost of money. When someone loans you money, they expect to profit (maybe just by your goodwill). Notice that car dealers and others who are financing what you buy will usually show you the monthly payments, and avoid talking about the full cost with interest. It would be helpful to calculate the monthly payments given the amount loaned, the interest rate, and the number of payments you are expected to make. In this assignment, you will implement one standard formula for computing monthly payments.

Set up and run java, javac, and an IDE (Eclipse) on your computer Create a class main method variables strings mathematical operators assignment operator input/output Eclipse IDE Develop a Loan Calculator (as a Java standalone application) to calculate and display the monthly payment for a loan. The user will be asked to enter the loan amount, the interest rate, and the number of payments. The formula used for such a calculation is: ??????? = ?????????? ∗ ( ( ???????????? ??.? ) (? − (? + ???????????? ??. ? ) −????????????????) ) For example, for a loan amount of $225,000 with the APR 10% and 360 payments, the monthly payment is: ??????? = ?????? ∗ ( ( ?? ??.? ) (?.? − (?.? + ?? ??.? ) −???) ) Payment, loan amount, APR, 12.0, and 1.0 are real numbers; whereas N=number of payments is an integer. If you wish to use other formulas, please feel free to use them.

Solutions

Expert Solution


import java.util.Scanner;

public class LoanCalculator {
   public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       // reading data from user
       double amount, interestRate;
       int payments;
       // loop so that ask user until they enter number greater than 0
       while (true) {
           System.out.println("Enter loan amount: ");
           amount = sc.nextDouble();
           if (amount > 0)
               break;
           System.out.println("The value must be greater than 0");
       }

       // loop so that ask user until they enter number greater than 0
       while (true) {
           System.out.println("Enter Interest rate: ");
           interestRate = sc.nextDouble();
           if (interestRate > 0)
               break;
           System.out.println("The value must be greater than 0");
       }
       // loop so that ask user until they enter number greater than 0
       while (true) {
           System.out.println("Enter number of payments: ");
           payments = sc.nextInt();
           if (payments > 0)
               break;
           System.out.println("The value must be greater than 0");
       }

       // using with given formula
       double payment = amount * ((interestRate / 12.0) / 1 - Math.pow((1 + interestRate / 12.0), -1 * payments));
       System.out.println("Payment is : " + payment);
   }
}

Note : If you like my answer please rate and help me it is very Imp for me


Related Solutions

when you need money and have to explain someone one why you need money
when you need money and have to explain someone one why you need money
Supply Chain Value Have you ever heard someone say (or maybe you’ve said it) that if...
Supply Chain Value Have you ever heard someone say (or maybe you’ve said it) that if you could just cut out the “middleman” the product would be so much cheaper? When is this true for the consumer? When is this not true for the consumer? How does a supply chain provide value for the consumer? Thinking about a product that you recently have purchased: What is the product? What "route" did it take through the supply chain - in other...
You expect to graduate with $18,957 in student loans. Theinterest rate on your loan is...
You expect to graduate with $18,957 in student loans. The interest rate on your loan is 7.3 percent compounded monthly and the loan calls for fixed monthly payments. If you repay the loan in 30 years how much are you paying in total interest over the life of the loan? (HINT: you need to calculate the monthly payment first).You are excited to buy your first house. Based on your credit history, the bank is willing to lend you money at...
You expect to graduate with $44200 in student loans. The interest rate on your loan is...
You expect to graduate with $44200 in student loans. The interest rate on your loan is 4.8 percent compounded monthly and the loan calls for fixed monthly payments. If you repay the loan in 21 years how much are you paying in total interest over the life of the loan? (HINT: you need to calculate the monthly payment first).
1. When talking about loans, who supplies loans and who demands loans? How do you know...
1. When talking about loans, who supplies loans and who demands loans? How do you know that? 2. When working with the money market graph or loanable funds graph, which interest rate are we focused on? 3. When dealing with whether or not to invest in a new project, what will businesses look for with regard to the rate of return? When will they invest and when will they not invest? 4. What happens to the demand for loans when...
Describe the construction financing process. How does the money flow and when/what types of loans are...
Describe the construction financing process. How does the money flow and when/what types of loans are needed for a project?
Forecasting Stock Value When buying stock, you can expect to earn money through future current income...
Forecasting Stock Value When buying stock, you can expect to earn money through future current income (from ________________ increases in stock price OR dividends) and future capital appreciation (from ________________ increases in stock price OR dividends). Together, your total earnings from a given investment can be expressed in terms of the approximate yield. This value makes it easier for you to compare investment options. The formula for the approximate yield of an investment can look intimidating, but it's really just...
Supply Chain Value (250 words total) Have you ever heard someone say (or maybe you’ve said...
Supply Chain Value (250 words total) Have you ever heard someone say (or maybe you’ve said it) that if you could just cut out the “middleman” the product would be so much cheaper? 1) When is this true for the consumer? 2) When is this not true for the consumer? 3) How does a supply chain provide value for the consumer? 4) Thinking about a product that you recently have purchased: A) What is the product? B) What "route" did...
1.  You expect to have $20,000 in one year. A bank is offering loans at 4% interest...
1.  You expect to have $20,000 in one year. A bank is offering loans at 4% interest per year. How much can you borrow? 2. Your friend’s mom is thinking of retiring. Her retirement plan will pay her either $225,000 immediately or $325,000 five years after the date of her retirement. Which alternative should she choose if the interest rate is a. 0% per year? b. 8% per year? c. 20% per year? a. 0% per year? b. 8% per year?...
You expect to receive $9,100 at graduation in 2 years. You plan on investing this money...
You expect to receive $9,100 at graduation in 2 years. You plan on investing this money at 9.03 percent per year until you have $50,000. How many years from today will it be until this occurs? Group of answer choices 19.7 years 25.3 years 23.3 years 21.7 years
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT