import java.io.*; class Cv05Pr4 { static double a,b,c, maleS, S; public static void main (String [] arg){ System.out.println("Program na zjisteni obsahu S trojuhelnika a, b, c."); System.out.println(); // Zadani hodnot a,b,c System.out.println("Hodnoty velikosti stran trojuhelnika"); System.out.print(" Strana a: "); a = VstupData.ctiDouble(); System.out.print(" Strana b: "); b = VstupData.ctiDouble(); System.out.print(" Strana c: "); c = VstupData.ctiDouble(); System.out.println(); // Zjisteni, zda trojuhelnik existuje, pokud ano pokracujeme ve vypoctu obsahu if ((a+b>c) && (b+c>a) && (c+a>b)) { // Vypocet obsahu podle Heronova vzorce maleS = (a+b+c)/2; S = Math.sqrt(maleS*(maleS-a)*(maleS-b)*(maleS-c)); System.out.println("Obsah trojuhelnika je " + S + " cm ctvercnych."); } else { System.out.println("Trojuhelnik neexisuje."); } } }