package algorithmsample6;
import java.util.Scanner;
/**
*
* @author Nurhak
*/
public class AlgorithmSample6 {
public static void main(String[] args) {
int base = 0;
int height = 0;
double area = 0;
String data = "";
try {
Scanner scan = new Scanner(System.in);
System.out.println("Please enter the base value(mm).");
data = scan.nextLine();
base = Integer.parseInt(data);
System.out.println("Please enter the height value(mm).");
data=scan.nextLine();
height = Integer.parseInt(data);
area = (base * height) / 2;
System.out.println("Area of the triangle is: " + area + " mm2");
} catch (Exception e) {
System.err.println("Please enter an integer value!");
}
}
}
Comments
Post a Comment