From 6ad15af53b37679d0035ce3e49c6d1a898caef83 Mon Sep 17 00:00:00 2001 From: PC de clase Date: Mon, 21 Sep 2026 12:36:00 +0200 Subject: [PATCH] first commit --- .gitignore | 30 +++++++++++++++++++++++++++++ .idea/.gitignore | 8 ++++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ AceptaElReto.iml | 11 +++++++++++ src/P112_RadaresDeTramo.java | 37 ++++++++++++++++++++++++++++++++++++ src/P164_AreaRectangulo.java | 13 +++++++++++++ 8 files changed, 119 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 AceptaElReto.iml create mode 100644 src/P112_RadaresDeTramo.java create mode 100644 src/P164_AreaRectangulo.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..13275f1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +### IntelliJ IDEA ### +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ +.kotlin + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..3c4bdcc --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..83e5e6c --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/AceptaElReto.iml b/AceptaElReto.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/AceptaElReto.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/P112_RadaresDeTramo.java b/src/P112_RadaresDeTramo.java new file mode 100644 index 0000000..8117fdf --- /dev/null +++ b/src/P112_RadaresDeTramo.java @@ -0,0 +1,37 @@ +import java.util.Scanner; + +public class RadaresDeTramo { + public static void main() { + Scanner sc = new Scanner(System.in); + int distancia = 0; // Distancia entre las cámaras (metros) + int velPermitida = 0; // Velocidad máxima permitida (Km/h) + int tiempo = 0; // Tiempo que tarda el coche en pasar entre las cámaras (segundos) + + while(true) { // Condición de salida después de obtener datos + System.out.print("Introduce los datos: "); + distancia = sc.nextInt(); + velPermitida = sc.nextInt(); + tiempo = sc.nextInt(); + sc.nextLine(); // Limpiar stdin + // Salir del bucle + if (distancia == 0 && velPermitida == 0 && tiempo == 0) { + System.out.println("SALIR"); + break; + } + // Calcular + double velocidad = (distancia / 1000.0) / (tiempo / 3600.0); // m/s => Km/h + if (velocidad > velPermitida){ + // indicará "MULTA" si se superó esa velocidad en menos de un 20% de la velocidad máxima permitida, + // y "PUNTOS" si la velocidad fue superada en un 20% o más de esa velocidad; + double rangoMulta = velPermitida * 20 / 100; // Rango que decide si te multan o te quitan puntos + if(velocidad < velPermitida + rangoMulta){ + System.out.println("MULTA"); + } else { + System.out.println("PUNTOS"); + } + } else { + System.out.println("OK"); + } + } + } +} \ No newline at end of file diff --git a/src/P164_AreaRectangulo.java b/src/P164_AreaRectangulo.java new file mode 100644 index 0000000..3267d67 --- /dev/null +++ b/src/P164_AreaRectangulo.java @@ -0,0 +1,13 @@ +//TIP To Run code, press or +// click the icon in the gutter. +void main() { + //TIP Press with your caret at the highlighted text + // to see how IntelliJ IDEA suggests fixing it. + IO.println(String.format("Hello and welcome!")); + + for (int i = 1; i <= 5; i++) { + //TIP Press to start debugging your code. We have set one breakpoint + // for you, but you can always add more by pressing . + IO.println("i = " + i); + } +}