//Pythagoras
function pyth(a,b){
    c = Math.pow(a,2)+Math.pow(b,2);
    c = Math.sqrt(c);
    return c;
}

//Fläche des Rechtecks
function rectArea(a,b){
    f = a*b;
    alert("Fläche = a x b\n= "+f);
}

//Umfang Rechteck
function rectRound(a,b){
    u = 2*(parseFloat(a)+parseFloat(b));
    alert("Umfang = 2x(a+b)\n= "+u);
}

//Fläche des Dreiecks
function triArea(c,h){
    f = c*h/2;
    alert("Fläche = c x h/2\n= "+f);
}

//Umfang gleichschenkl. Dreieck
function triRound(c,h){
    cf = parseFloat(c);
    hf = parseFloat(h);
    u = Math.sqrt((Math.pow((cf/2),2)+Math.pow(hf,2)))*2+cf;
    alert("Umfang = "+u);
}

//Umfang Dreieck
function triaRound(c,e,h){
    cf = parseFloat(c);
    hf = parseFloat(h);
    ef = parseFloat(e);
    u = Math.sqrt((Math.pow(ef,2)+Math.pow(hf,2)))+Math.sqrt((Math.pow((cf-ef),2)+Math.pow(hf,2)))+cf;
    alert("Umfang = "+u);
}

//Seite a des Dreiecks
function triA(c,e,h){
    cf = parseFloat(c);
    hf = parseFloat(h);
    ef = parseFloat(e);
    a = Math.sqrt((Math.pow((cf-ef),2)+Math.pow(hf,2)));
    alert("Seite a = "+a);
}

//Seite b des Dreiecks
function triB(c,e,h){
    cf = parseFloat(c);
    hf = parseFloat(h);
    ef = parseFloat(e);
    b = Math.sqrt((Math.pow(ef,2)+Math.pow(hf,2)));
    alert("Seite b = "+b);
}

//Fläche Kreis
function circArea(d){
    f = Math.PI*Math.pow((parseFloat(d)/2),2);
    alert("Fläche = PI x d²/4\n= "+f);
}

//Umfang Kreis
function circRound(d){
    u = Math.PI*parseFloat(d);
    alert("Umfang = PI x d\n= "+u);
}

//Volumen Quader
function volQuad(a,b,h){
    v = parseFloat(a)*parseFloat(b)*parseFloat(h);
    alert("Volumen = a x b x h \n= "+v);
}

//Volumen Quader
function surQuad(a,b,h){
    af = parseFloat(a);
    bf = parseFloat(b);
    hf = parseFloat(h);
    s = ((af*bf)+(af*hf)+(bf*hf))*2;
    alert("Oberfläche = (a*b+a*h+b*h)*2 \n= "+s);
}

//Volumen Zylinder
function volZyl(d,h){
    v = Math.PI*(Math.pow(parseFloat(d),2)/4)*parseFloat(h);
    alert("Volumen = PI x (d²/4) x h\n= "+v);
}

//Oberfläche Zylinder
function surZyl(d,h){
    df = parseFloat(d);
    hf = parseFloat(h);
    s = Math.PI*(Math.pow(df,2)/4)*2+df*Math.PI*hf;
    alert("Oberfläche = PI*(d²/4)*2+PI*d*h\n= "+s);
}

//Volumen Kugel
function volSphere(d){
    v = Math.PI*Math.pow((parseFloat(d)/2),3)*4/3;
    alert("Volumen = PI*(3/4)*(d/2)³\n= "+v);
}

//Oberfläche Kugel
function surSphere(d){
    s = Math.PI*Math.pow((parseFloat(d)/2),2)*4;
    alert("Oberfläche = 4*PI*(d/2)²\n = "+s);
}

//Volumen Pyramide
function volPyr(a,h){
    af = parseFloat(a);
    hf = parseFloat(h);
    v = af*af*hf/3;
    alert("Volumen = a²*h/3\n= "+v);
}

//Oberfläche Pyramide
function surPyr(a,h){
    af = parseFloat(a);
    hf = parseFloat(h);
    s = (af*af)+(pyth((af/2),hf)*af*2);
    alert("Oberfläche = "+s);
}

//Volumen Kegel
function volKeg(d,h){
    v = Math.PI*(Math.pow(parseFloat(d),2)/4)*parseFloat(h)/3;
    alert("Volumen = PI x (d²/4) x h/3\n= "+v);
}

//Oberfläche Kegel
function surKeg(d,h){
    df = parseFloat(d);
    hf = parseFloat(h);
    s = Math.PI*pyth((d/2),h)*d/2+d*d*Math.PI/4;
    alert("Oberfläche = "+s);
}

