- #1
jai6638
- 263
- 0
Hey I hava a java programming assignment for my intro to java class... I've written my program but I don't know how to make the "new balance" my balance for the second time it runs and so on..
Q)Save the programs as ccard1. Take a credit card balance of $500. Calculate the 5 months the payment based on .05 of the balance and the interest usign .15. The program should use the for loop. This program will print out in the following format 5 times:
Payment xxx
Balance xxx
Interest xxx
New Balance xxx
Program:
Any help is much appreciated.. thanks
Q)Save the programs as ccard1. Take a credit card balance of $500. Calculate the 5 months the payment based on .05 of the balance and the interest usign .15. The program should use the for loop. This program will print out in the following format 5 times:
Payment xxx
Balance xxx
Interest xxx
New Balance xxx
Program:
Code:
class ccard1
{
public static void main(String[] args) {
for (int i=1;i<=10;i++ ) {
double m=i*500
double p=m*.05;
double r=500-p;
double e=r * .15;
double d=p+e;
System.out.println("Payment " + p +"Balance "+ r + "Interest " + e + "New Balance " + d) ; }
}
}
Any help is much appreciated.. thanks