-
Lenguaje
Java usando Scanner
-
Descripción
Determine el grado de un acero bajo las siguientes condiciones de temperatura (T): el acero se considera de grado 1 si T1 excede a 0.95 y T2 excede a 0.75; de grado 2 si T1 excede a 0.95 pero T2 no excede a 0.75; y de grado 3 si T1 no es mayor que 0.95.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.util.Scanner;
public class GradoDeUnAcero {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double T1, T2, grado;
System.out.print("Ingresa el valor de T1: ");
T1 = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de T2: ");
T2 = in.nextDouble();
in.nextLine();
grado=0;
if(T1>0.95&&T2>0.75)
grado=1;
if(T1>0.95&&T2<=0.75)
grado=2;
if(T1<=0.95)
grado=3;
System.out.println("Valor de grado: " + grado);
}
}
public class GradoDeUnAcero {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double T1, T2, grado;
System.out.print("Ingresa el valor de T1: ");
T1 = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de T2: ");
T2 = in.nextDouble();
in.nextLine();
grado=0;
if(T1>0.95&&T2>0.75)
grado=1;
if(T1>0.95&&T2<=0.75)
grado=2;
if(T1<=0.95)
grado=3;
System.out.println("Valor de grado: " + grado);
}
}