import java.io.*; public class Anillo { private static double redondear(double num) { double aux = num * 1000; int tmp = (int) aux; return (double) tmp / 1000; } public static void main(String[ ] args) throws IOException { double distancia = 0.0; double tiempo = 0.0; double tiempoAcum = 0.0; double radio; int k; double velocidad; int seguir = 1; BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); do { tiempoAcum = 0.0; /* en vcada ciclo se debe inicializar en cero */ System.out.print("\n\ningrese numero de anillos : "); k = Integer.parseInt(in.readLine()); System.out.print("ingrese radio inicial : "); radio = Double.parseDouble(in.readLine()); System.out.print("ingrese velocidad inicial : "); velocidad = Double.parseDouble(in.readLine()); System.out.println("\n\nk\tradio\t\tDistancia\tVelocidad\tTiempo"); System.out.println("---\t-----\t\t---------\t---------\t------"); while (k > 0) { distancia = 2.0 * Math.PI * radio; tiempo = distancia / velocidad; tiempoAcum = tiempoAcum + tiempo; System.out.println(k + "\t" + redondear(radio) + "\t\t" + redondear(distancia) + "\t\t" + redondear(velocidad) + "\t\t " + tiempo); velocidad *= 1.12; radio = radio * 0.65; k--; } velocidad = 2.0 * velocidad * Math.pow(1.0 + radio, 2.0) ; System.out.println("\n\tVelocidad disparo : " + redondear(velocidad)); System.out.println("\n\ttiempo total : " + tiempoAcum); System.out.print("\n\n\tseguir(1)/salir(0) : "); seguir = Integer.parseInt(in.readLine()); } while (seguir == 1); } }