-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.java
More file actions
55 lines (37 loc) · 1.13 KB
/
Program.java
File metadata and controls
55 lines (37 loc) · 1.13 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
45
46
47
48
49
50
51
52
53
54
55
package application;
import java.util.Locale;
import java.util.Scanner;
import entities.Triangle;
public class Program {
public static void main(String[] args) {
Locale.setDefault(Locale.US);
;
// entrada de dados por parte do usuário
Scanner sc = new Scanner(System.in);
// criação de variaveis e instanciando classe
Triangle x, y;
x = new Triangle();
y = new Triangle();
// Solicitação dos dados para o usuário
System.out.println("Enter the measures of triangle x: ");
x.a = sc.nextDouble();
x.b = sc.nextDouble();
x.c = sc.nextDouble();
System.out.println("Enter the measures of triangle Y: ");
y.a = sc.nextDouble();
y.b = sc.nextDouble();
y.c = sc.nextDouble();
// CALCULO DA AREA DOS TRIANGULOS
double areaX = x.area();
double areaY = y.area();
System.out.printf("Triangle X area: %.4f%n", areaX);
System.out.printf("Triangle Y area: %.4f%n", areaY);
// TESTE PARA IDENTIFICAR QUAL AREA É MAIOR
if (areaX > areaY) {
System.out.println("Larger area: X");
} else {
System.out.println("Larger area: Y");
}
sc.close();
}
}