This problem concerns the production of a java program that will calculate repayments on a student loan for a ?
-
Problem Specification: This problem concerns the production of a java program that will calculate repayments on a student loan for a single year. Repayments are based upon the ex-student’s income and 3% interest that will be added to the loan every year by HM Government (nice people). NOTE: You are required to also submit a flow chart and pseudo code to your tutor! Method 1. First prompt and read the 2 inputs (loan and wages), store them in "double" variables. 2. Now calculate the net income by subtracting 10,000 pounds from the wages (that is the free threshold amount which you can keep and will not be used for repaying the loan). 3. Add 3% interest to the loan amount. 4. Finally calculate the new balance of the loan by subtracting the 9% deductions (calculated in step 2. above) from the current loan balance. Here are three examples that show how the system works: Example 1 Example 2 Example 3 Earned income £13,000 £9,000 £12,000 keyboard input 1 Less threshold £10,000 £10,000 £10,000 Net income £3,000 Nil £2,000 output in response to input 1 Deductions 9% £270 Nil £180 Loan £4,000 £8,000 £2,000 keyboard input 2 Interest 3% £120 £240 £60 output in response to input 2 New balance £3,850 £8,240 £1,880 Typical Input / output Input: Enter total amount of student loan taken: 4000 Enter anticipated income: 13000 Corresponding Output: Loan taken out: 4000, anticipated income 13000 Total plus interest: 4120 Amount Re-paid: 270 New balance: 3850 any help Please --------------------------------------… import java.io.*; import java.text.DecimalFormat; import java.util.Scanner; public class MortgageCalculator2 { static int months = 360; static double rate = .0575; public static void main(String[] args) throws IOException { // declare variables double orignialLoan = 200000; double newLoan = 200000; String str = ""; double payment; double loanPayment = 0; double interestPayment = 0; int i; // print to display monitor System.out.println("\t McBride Mortgage Payment Calculator"); System.out.println(); System.out.println("\t $200,000.00 Loan"); System.out.println(); System.out.println("\t at 5.75% for 30 year term"); Scanner input = new Scanner(System.in); System.out.println(); DecimalFormat twoDigits = new DecimalFormat("$##,###.##");// Format how it will be displayed. // For Statement. for (i = 1; i <= months; i ++) { orignialLoan = newLoan; double interest = getInterest (rate); // Interest rate for the month. payment = getPayment (interest, orignialLoan); // Payment per month. newLoan = getNewLoan (interest, payment, orignialLoan); // Balance after payment. loanPayment = orignialLoan - newLoan; // Amount of monthly loan. interestPayment = payment - loanPayment;// Amount of monthly interest. // Print to display moniter. System.out.println("The monthly payment on " + twoDigits.format(orignialLoan) + " at 5.75% rate is " + twoDigits.format(payment)); System.out.println(); System.out.println("New Balance " + twoDigits.format(newLoan)); System.out.println("Loan Payment " + twoDigits.format(loanPayment)); System.out.println("Interest Payment " + twoDigits.format(interestPayment)); if (i % 3 == 0){ System.out.println("Continue? (Y or N)"); str = input.nextLine(); if(str.equals("N") || str.equals("n")) System.exit(0); } } } // End For } // end of main // Get Interest Method public static double getInterest(double rate) { double interest = rate / (12 * 100); return interest; } // End of Interest Method // Get Payment Method public static double getPayment (double interest, double orignialLoan) { double payment = (orignialLoan * getInterest(rate)) / (1 - Math.pow(1 + getInterest(rate), - months)); return payment; } // End of Payment Method // Get New Loan Amount public static double getNewLoan (double interest, double payment, double orignialLoan) { double newLoan = orignialLoan * (1 + interest) - payment; return newLoan; } // End New Loan Amount } // end program
-
Answer:
OK, you've given us the background, but what is your question?
Tracy-UK at Yahoo! Answers Visit the source
Related Q & A:
- Should I take a student loan?Best solution by Yahoo! Answers
- How can I apply for a student loan?Best solution by Yahoo! Answers
- Where is a good place online to get a student loan for college?Best solution by Yahoo! Answers
- How long will it take to process a student loan?Best solution by Yahoo! Answers
- Does taking 3 hours at one school and another 3 at a diff. school, qualify me for deferment on a student loan?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.