first commit
This commit is contained in:
commit
6ad15af53b
8 files changed
+119
No files matched your search
+30
@@ -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
|
||||||
Generated
+8
@@ -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
|
||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_25" project-jdk-name="openjdk-26" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/AceptaElReto.iml" filepath="$PROJECT_DIR$/AceptaElReto.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
@@ -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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
|
||||||
|
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
|
||||||
|
void main() {
|
||||||
|
//TIP Press <shortcut actionId="ShowIntentionActions"/> 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 <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
|
||||||
|
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
|
||||||
|
IO.println("i = " + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user