| | |
Need help with java prog
![]() |
•
•
Join Date: Aug 2004
Posts: 1
Reputation:
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 );
}
}
![]() |
Similar Threads
- Calculate Dialed/Received call timer logs(cellphone) (Java)
- Help in writing a litle program for a friend (Java)
- jdb run time input needed (Java)
- how to add swf file as JButton (Java)
- Need Help >> I Give Up , Cant Do This Program :'((( (Java)
- how to access variable outside awk and spliting the string in array (Shell Scripting)
- Sound Programming ?? Need your help (C++)
- Help with java prog...! (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
| Thread Tools | Search this Thread |
911 addball addressbook android api append applet application apps array arrays automation binary bluetooth businessintelligence button card chat class client code collision component crashcourse css csv database eclipse ee error fractal free game gis givemetehcodez graphics gui html ide image integer integration j2me japplet java javaarraylist javadoc javafx javaprojects jni jpanel julia jvm linux list loan machine map method methods migrate mobile netbeans newbie objects oriented output panel phone physics problem program programming project projects radio recursion replaydirector reporting scanner se server service set sms socket software sort sql string swing test textfield threads transfer tree trolltech ubuntu utility windows






