Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Project: Exam_101_January_2016 - created by borkins on 2017-05-03.
- */
- import java.text.DecimalFormat;
- import java.util.Scanner;
- public class _01_TriangleArea
- {
- public static void main(String[] args)
- {
- Scanner console = new Scanner(System.in);
- DecimalFormat df = new DecimalFormat("0.##");
- int x1 = Integer.parseInt(console.nextLine());
- int y1 = Integer.parseInt(console.nextLine());
- int x2 = Integer.parseInt(console.nextLine());
- int y2 = Integer.parseInt(console.nextLine());
- int x3 = Integer.parseInt(console.nextLine());
- int y3 = Integer.parseInt(console.nextLine());
- double base = Math.abs(x2 - x3);
- double height = Math.abs(y1 - y3);
- double area = base * height / 2;
- System.out.println(df.format(area));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment