•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 392,037 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,285 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 1592 | Replies: 1
![]() |
•
•
Join Date: Aug 2004
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hello,
I am new member here I need help with my program.
I am trying to calculate interst for a loan I am not able to calculate last payment for loan like if loan amount is 1000 and interst rate is 18% which come up 1.5% for every month and if there is fix payment of 5% of the starting amount (1000) .
It was running and calculating all other then last payment but now its not even running some one cane help me I realy appreciate thanks.
import javax.swing.JOptionPane;
import java.awt.Container;
import javax.swing.*;
public class payment1 {
// main method begins execution of Java application
public static void main( String args[] )
{
float Interst,Payment,MonthInterst,TotalInterst=0,MonthlyNetPay,FinalPayment=0;
float monthlypay ,MonthsInterst;
String output,interstvalue,paymentvalue;
int months=0;
paymentvalue =
JOptionPane.showInputDialog( "Please enter the amount:" );
interstvalue =
JOptionPane.showInputDialog( "Please enter the interst rate" );
Payment = Float.parseFloat( paymentvalue);
Interst = Float.parseFloat( interstvalue );
output="The payment amount:"+Payment+"\nThe Interst is:"+Interst;
monthlypay= (5/100) * Payment;
while(Payment > 0) {
MonthsInterst = Interst/12;
MonthInterst= ((MonthsInterst/100)* Payment);
TotalInterst = TotalInterst + MonthInterst;
MonthlyNetPay = monthlypay - MonthInterst;
Payment = Payment - MonthlyNetPay;
if (MonthlyNetPay >= Payment) {
FinalPayment = Payment;
System.out.println("FinalPayment");
}
months++;
}
output +="\nTotal Interst:"+TotalInterst+"\nThe Last Payment:"+FinalPayment;
JTextArea outputArea = new JTextArea();
outputArea.setText( output);
JOptionPane.showMessageDialog( null, outputArea,
"Grade Printing Program",
JOptionPane.INFORMATION_MESSAGE );
System.exit( 0 );
}
}
I am new member here I need help with my program.
I am trying to calculate interst for a loan I am not able to calculate last payment for loan like if loan amount is 1000 and interst rate is 18% which come up 1.5% for every month and if there is fix payment of 5% of the starting amount (1000) .
It was running and calculating all other then last payment but now its not even running some one cane help me I realy appreciate thanks.
import javax.swing.JOptionPane;
import java.awt.Container;
import javax.swing.*;
public class payment1 {
// main method begins execution of Java application
public static void main( String args[] )
{
float Interst,Payment,MonthInterst,TotalInterst=0,MonthlyNetPay,FinalPayment=0;
float monthlypay ,MonthsInterst;
String output,interstvalue,paymentvalue;
int months=0;
paymentvalue =
JOptionPane.showInputDialog( "Please enter the amount:" );
interstvalue =
JOptionPane.showInputDialog( "Please enter the interst rate" );
Payment = Float.parseFloat( paymentvalue);
Interst = Float.parseFloat( interstvalue );
output="The payment amount:"+Payment+"\nThe Interst is:"+Interst;
monthlypay= (5/100) * Payment;
while(Payment > 0) {
MonthsInterst = Interst/12;
MonthInterst= ((MonthsInterst/100)* Payment);
TotalInterst = TotalInterst + MonthInterst;
MonthlyNetPay = monthlypay - MonthInterst;
Payment = Payment - MonthlyNetPay;
if (MonthlyNetPay >= Payment) {
FinalPayment = Payment;
System.out.println("FinalPayment");
}
months++;
}
output +="\nTotal Interst:"+TotalInterst+"\nThe Last Payment:"+FinalPayment;
JTextArea outputArea = new JTextArea();
outputArea.setText( output);
JOptionPane.showMessageDialog( null, outputArea,
"Grade Printing Program",
JOptionPane.INFORMATION_MESSAGE );
System.exit( 0 );
}
}
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
- Sound Programming ?? Need your help (C++)
- Java project (Java)
- Help with java prog...! (Java)
- Java 3D (Java)
- Java Expert (Needed) (Java)
- Java Chat Reboots (Java)
Other Threads in the Java Forum
- Previous Thread: Pass XML file contents to a hash table.
- Next Thread: Adapting a Java Application to JSP/Servlets



Linear Mode