-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculadora_Area_Volume.java
More file actions
44 lines (31 loc) · 1.29 KB
/
Copy pathCalculadora_Area_Volume.java
File metadata and controls
44 lines (31 loc) · 1.29 KB
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 calculadora_volume;
import java.util.Scanner;
public class Calculadora_volume {
public static void main(String[] args) {
Scanner leitor = new Scanner(System.in);
double opcao,b,a,h,v;
System.out.println("Informe o que deseja calcular: area(1) ou volume(2)");
opcao=leitor.nextDouble();
if(opcao==1){
System.out.println("Informe o comprimento da lateral A centimetros(cm): ");
a=leitor.nextDouble();
System.out.println("Informe a largura em centimetros(cm): ");
b=leitor.nextDouble();
v=b*a;
System.out.println("A area do objeto e de: "+v);
}
else if(opcao==2){
System.out.println("Informe o comprimento em centimetros(cm): ");
b=leitor.nextDouble();
System.out.println("Informe a largura em centimetros(cm): ");
a=leitor.nextDouble();
System.out.println("Informe a altura em centimetros(cm): ");
h=leitor.nextDouble();
v=a*b*h;
System.out.println("O volume e de: "+v+" cm3");
}
else{
System.out.println("Digite somente 1 ou 2");
}
}
}