Created
January 28, 2018 20:44
-
-
Save santiago-tapia/99e2e5a0de86d27d65b2454f7ffdd628 to your computer and use it in GitHub Desktop.
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.*; | |
public class Main | |
{ | |
public static void main(String[] args) { | |
// Valores iniciales | |
double saldo, interes, cuota; | |
Scanner sc = new Scanner(System.in); | |
saldo = sc.nextDouble(); | |
interes = sc.nextDouble(); | |
cuota = sc.nextDouble(); | |
// Creamos la lista (vacía) | |
LinkedList<Double> lista = new LinkedList<>(); | |
// El bucle que añade elementos a la lista | |
while ( saldo > 0 ) { | |
lista.add( saldo ); | |
double pago_interes = interes * saldo / 100; // interes en % | |
double amortizacion = cuota - pago_interes; | |
saldo = saldo - amortizacion; | |
} | |
for ( double cuenta : lista ) { | |
System.out.println("El saldo es: " + cuenta); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment