Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package MethodsAndDebugging;
- import java.text.DecimalFormat;
- import java.util.Scanner;
- public class Lab06_TriangleArea {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- DecimalFormat df = new DecimalFormat("#.########");
- double width = Double.parseDouble(scanner.nextLine());
- double height = Double.parseDouble(scanner.nextLine());
- double area = calculateArea(width, height);
- System.out.printf("%s", df.format(area));
- }
- public static double calculateArea(double width, double height) {
- return (width * height) / 2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement