Java calculate repayments for student loan for a single year.

will calculate repayments on a student loan for a single year. Repayme

Page 1 of 1

0 Replies - 1128 Views - Last Post: 04 January 2009 - 02:13 PM Rate Topic: -----

#1 kavin123  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 04-January 09

Java calculate repayments for student loan for a single year.

Posted 04 January 2009 - 02:13 PM

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.

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

I tried that ...1.
First prompt and read the 2 inputs (loan and wages), store them in "double" variables.
2. Now I 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.
But just ................sick of ot
any example would be help full

I am trying different method

import java.io.IOException;
import java.text.DecimalFormat;
import java.util.Scanner;


public class Assignment2 {
private static final Scanner scan = new Scanner(System.in);


public static void main (String args[]) throws IOException

{

double loan_amount, interest_rate, interest_rate_month,interest,unpaid_amount;
double installment, principal;
double interests_rate = 3;
int loan_period, loan_period_month;
int payment_no = 0;
int a;


System.out.print("Enter total amount of student loan taken: "); //Input of loan amount
loan_amount = scan.nextDouble();
System.out.println("Loan amount is RM"+loan_amount);

System.out.print("Enter anticipated income:");
loan_period = scan.nextInt();
loan_period_month = loan_period * 12;
System.out.println("Loan period is " +loan_period_month+ " months");

interest_rate_month = interests_rate / (loan_period_month*100);
System.out.println("Interest rate is "+interests_rate);

installment = loan_amount * interest_rate_month / (1 - Math.pow(1 + interest_rate_month, - loan_period_month));
// calculates the monthly installment payment

Is This A Good Question/Topic? 0
  • +

Page 1 of 1