import java.io.*; public class Trampolin { public static void main(String[] args) throws IOException { int cs = 1; double h = 0.60; int seguir = 1; double sep,aumento; BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); do { h = 0.6; cs = 1; System.out.print("\n\nseparacion entre trampolines : "); sep = Double.parseDouble(in.readLine()); System.out.print("porcentaje de aumento (0..1) : "); aumento = Double.parseDouble(in.readLine()); aumento += 1.0; System.out.println("\n\tcs\taltura"); System.out.println("\t--\t------"); while ( h < sep ) { System.out.println("\t" + cs + "\t" + h); cs++; h *= aumento; } System.out.println("\n\tCantidad de saltos : " + cs); System.out.println("\tAltura maxima alcanzada : " + h); System.out.print("\n\t\tseguir(1)/salir(0) : "); seguir = Integer.parseInt(in.readLine()); } while (seguir == 1); } }