Created
November 13, 2013 23:53
-
-
Save pepet96/7458704 to your computer and use it in GitHub Desktop.
CreditCard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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