For the formula to compute monthly payment, see Listing 2.9, ComputeLoan.java.
**5.22 (Financial application: loan amortization schedule) The monthly payment for a given loan pays the principal and the interest. The monthly interest is computed by multiplying the monthly interest rate and the balance (the remaining principal). The principal paid for the month is therefore the monthly payment minus the monthly interest. Write a
Note
The balance after the last payment may not be zero. If so, the last payment should be the normal monthly payment plus the final balance.
Hint: Write a loop to display the table. Since the monthly payment is the same for each month, it should be computed before the loop. The balance is initially the loan amount. For each iteration in the loop, compute the interest and principal, and update the balance. The loop may look as follows:
for (i = 1 ; i <= numberOfYears * 12 ; i++) {
interest = monthlyinterestRate * balance;
principal = monthlyPayment - interest;
balance= balance- principal;
System.out.println(i + "\t\t" + interest
+ "\t\t" +principal+ "\t\t" +balance);
}
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version, Student Value Edition (11th Edition)
Additional Engineering Textbook Solutions
Introduction To Programming Using Visual Basic (11th Edition)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Starting Out with Python (3rd Edition)
Modern Database Management (12th Edition)
Starting Out with C++ from Control Structures to Objects (9th Edition)
Starting Out with C++ from Control Structures to Objects (8th Edition)
- **CODE IS IN JAVA** Modify the BarChart program from Chapter 6 Exercise 13 to accept the number of points scored by each player in a season. The bar chart displays one asterisk for each 10 points scored by a player. For example, if a player has scored 48 points, then display 4 asterisks. An example of the program is shown below: Enter points earned for the season by Art >> 10 by Bob >> 20 by Cal >> 30 by Dan >> 40 by Eli >> 50 Points for Season (each asterisk represents 10 points) Art * Bob ** Cal *** Dan **** Eli ***** The code to modify: Scanner input = new Scanner(System.in); int artPoints; int bobPoints; int calPoints; int danPoints; int eliPoints; final int AMT_EACH_ASTERISK = 10; System.out.println("Enter points earned for the season"); System.out.print(" by Art >> "); artPoints = input.nextInt(); System.out.print(" by Bob >> "); bobPoints =…arrow_forwardnbm.m//,//arrow_forward17. Redo Programming Exercise 16 so that the user can also input the cost of producing one liter of milk and the profit on each carton of milk.arrow_forward
- *** Complete in Java Program** Use Gambler's Ruin Example Gambler's ruin. Suppose a gambler makes a series of fair $1 bets, starting with $50, and continue to play until she either goes broke or has $250. What are the chances that she will go home with $250, and how many bets might she expect to make before winning or losing? Gambler.java is a simulation that can help answer these questions. It takes three command-line arguments, the initial stake ($50), the goal amount ($250), and the number of times we want to simulate the game. Implement and modify Gambler's ruin simulation from the textbook or textbook website. Modify, to show the results from several simulations not only one, in a formatted table. Compute the average over all simulations.arrow_forwarduse a while loop to solve this problem. This is a Java programarrow_forwardHow do I do this in Java language?arrow_forward
- ***Microsoft Visual Studios (C++)*** Write a program that given two coordinate pairs and a third single coordinate will linearly interpolate or extrapolate the third second coordinate. For example, let's say at 50 degrees Celsius the length of a metal rod is 5.4 cm and at 60 degrees Celsius the length is 5.5cm. I can interpolate the length at 53 degrees Celsius by doing 5.4cm + 3*(.1/10)=5.43cm. Your program does not need to continuously run, but should prompt the user for two coordinate pairs, the third first coordinate and return the extrapolated or interpolated third second coordinate.arrow_forward** Java Programming ** Please do not copy from other sources. Write a multithreading java program where three people are talking ( conversation between 3 people) in a systematic way until taking “STOP” string as input. The conversation of three people all are user input. When one person types “STOP”, he will stop chatting, the other two persons will continue the conversation and again when another person types “STOP”, then the program will exit because one cannot chat with himself. You must use the multithreading concept along with the Synchronized method and runnable interface. You should provide a flowchart and enough explanation for this program. Use comment lines as much as you can and please keep the code as basic as possible because I am a beginner on java. Thank you.arrow_forwardImplement programs involving the use of while, do..while and for loop statement. Objectives: Topics Covered: Implementing programs using loops. Description FRIDAY THE 13TH When will Friday the 13th occur in 1990? Write a program that will find all months in 1990 in which the 13th falls on a Friday. You need to know the following. 1. January 1, 1990 was on a Monday. 2. September, April, June, and November have thirty days, all the rest have 31 except for February which has 28 except in leap years when it has 29. 3. 1990 is not a leap year. Note: To make it fair for everyone, you may not use any built-in date functions from your computer language. Sample Output if Applicable Sample Run In 1990, Friday the 13th occurs in the months: APRILarrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning