Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ExamPreparation;
- import java.util.Scanner;
- public class CourtesianTabletwo {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- double Ax = scan.nextDouble();
- double Ay = scan.nextDouble();
- double Bx = scan.nextDouble();
- double By = scan.nextDouble();
- double Cx = scan.nextDouble();
- double Cy = scan.nextDouble();
- double sumAB =Math.sqrt((Bx - Ax)*(Bx - Ax) + (By - Ay)*(By - Ay));
- double sumBC = Math.sqrt((Cx - Bx)*(Cx - Bx) + (Cy - By)*(Cy - By));
- double sumAC = Math.sqrt((Cx - Ax)*(Cx - Ax) + (Cy - Ay)*(Cy - Ay));
- if(sumAB + sumBC > sumAC && sumAC + sumBC > sumAB && sumAB + sumAC > sumBC ){
- double p = (sumAB + sumBC + sumAC)/2;
- double Area = Math.sqrt(p*(p-sumAB)*(p-sumBC)*(p-sumAC));
- System.out.println("Yes");
- System.out.printf("%.2f%n",Area);
- }
- else {
- System.out.println("No");
- System.out.printf("%.2f%n", sumAB);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment