Skip to content

Instantly share code, notes, and snippets.

@pepet96
Created November 13, 2013 23:53
Show Gist options
  • Save pepet96/7458704 to your computer and use it in GitHub Desktop.
Save pepet96/7458704 to your computer and use it in GitHub Desktop.
CreditCard
import java.util.Scanner;
public class CreditCard {
public static void main (String [] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter the monthly payment: ");
double pay = input.nextDouble();
int month = 0;
double owed = 1000;
System.out.println("Month: " + month + " Balance: " + owed + " Total payed: " + "0.000");
while (owed > pay)
{
owed = owed * 1.015;
owed = owed - pay;
System.out.println("Month: " + (month = month + 1) + " Balance: " + owed + " Total payed: " + (pay * month));
}
System.out.println("Month: " + (month = month + 1) + " Balance: 0.0" + " Total payed: " + (pay * month - owed));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment