import java.util.*;
public class Exer04 {
public static void main(String[]args) {
Scanner teclado = new Scanner(System.in);
double b,h,A,B,C;
String tipo;
System.out.println("Informe o Tipo de área a ser calculada. Sendo T (triângulo) e (R) retângulo: ");
tipo = teclado.nextLine();
if(tipo == "R" || tipo == "r") {
System.out.println("Informe a base: ");
b = teclado.nextDouble();
System.out.println("Informe a altura: ");
h = teclado.nextDouble();
System.out.printf("A área do retângulo é %.2f",b*h);
}
else if (tipo == "T" || tipo == "t") {
System.out.println("Informe os 3 lados : ");
A = teclado.nextDouble();
B = teclado.nextDouble();
C = teclado.nextDouble();
if(A > B + C || B > A + C || C > A + B) {
System.out.println("Não é um triângulo. Insira uma valor válido.");
}
else{
System.out.println("Informe a base: ");
b = teclado.nextDouble();
System.out.println("Informe a altura: ");
h = teclado.nextDouble();
System.out.printf("A área do triâgulo é : %.2f", (b*h)/2);
}
}
}
}