-
Lenguaje
Java usando Scanner
-
Descripción
Dado un radio mayor (R) y el radio menor (r) de un trapecio circular de amplitud en grados igual a g grados, calcule el área del trapecio circular. La ecuación representativa del área (A) del trapecio circular es:
A = π(R2 − r2)g / 360°
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import java.util.Scanner;
public class AreaDeUnTrapecioCircular {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double area, g, radio_mayor, radio_menor;
System.out.print("Ingresa el valor de g: ");
g = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de radio mayor: ");
radio_mayor = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de radio menor: ");
radio_menor = in.nextDouble();
in.nextLine();
area=Math.PI*(radio_mayor*radio_mayor-radio_menor*radio_menor)*g/360;
System.out.println("Valor de area: " + area);
}
}
public class AreaDeUnTrapecioCircular {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double area, g, radio_mayor, radio_menor;
System.out.print("Ingresa el valor de g: ");
g = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de radio mayor: ");
radio_mayor = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de radio menor: ");
radio_menor = in.nextDouble();
in.nextLine();
area=Math.PI*(radio_mayor*radio_mayor-radio_menor*radio_menor)*g/360;
System.out.println("Valor de area: " + area);
}
}