Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
24 lines (24 loc) · 973 Bytes

File metadata and controls

24 lines (24 loc) · 973 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.util.Scanner;
import java.text.DecimalFormat;
public class ForRam{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
DecimalFormat ft=new DecimalFormat("0,000.00");
System.out.print("Enter the number of terms : ");
int term=(sc.nextInt()*12)/12+1;
System.out.print("Enter the payments : ");
double payments=sc.nextDouble();
double termOfP=0;
double interest=0;
double total=0;
System.out.println("Terms\t\tTerm of payments\tInterest\tTotal of terms\t\tPayments");
System.out.println("0\t\t"+ft.format(termOfP)+"\t\t"+ft.format(interest)+"\t"+ft.format(total)+"\t\t"+ft.format(payments));
termOfP=payments/(term-1);
for(int i=1;i<term;i++){
interest=(payments*(0.05/12));
payments=payments-termOfP;
total=termOfP+interest;
System.out.println(i+"\t\t"+ft.format(termOfP)+"\t\t"+ft.format(interest)+"\t"+ft.format(total)+"\t\t"+ft.format(payments));
}
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.