
Convertir int a double
Publicado por Felipe (1 intervención) el 21/11/2016 12:51:14
Buenas, ¿me podeis decir donde fallo en este codigo? no logro localizar el fallo.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package practica.pkg3;
import java.util.Scanner;
public class ejercicio {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
double nota;
int x;
System.out.println("Introduce tu nota");
nota = s.nextDouble();
int x = (int) nota;
switch(x){
case 0:
case 1:
case 2:
case 3:
System.out.println("Insuficiente");
break;
case 4:
case 5:
System.out.println("Regular");
break;
case 6:
System.out.println("Bien");
break;
case 7:
case 8:
System.out.println("Notable");
break;
case 9:
case 10:
System.out.println("Sobresaliente");
break
default:
System.out.println("Nota no válida");
}
}
}
Valora esta pregunta


0