<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class KelilingCon extends Controller
{
    public function kPersegiC(Request $request){
        $s = $request->input('sisi');
        $result = 4 * $s;
        return redirect('/kPersegi')->with('info', 'Keliling Persegi adalah = '.$result);
    }

    public function kPersegiPC(Request $request){
        $p = $request->input('panjang');
        $l = $request->input('lebar');
        $result = 2 * ( $p + $l );
        return redirect('/kPersegiP')->with('info', 'Keliling Persegi Panjang adalah = '.$result);
    }

    public function kSegitigaC(Request $request){
        $a = $request->input('a');
        $b = $request->input('b');
        $c = $request->input('c');
        $result = $a + $b + $c;
        return redirect('/kSegitiga')->with('info', 'Keliling Segitiga adalah = '.$result);
    }

    public function kLingkaranC(Request $request){
        $d = $request->input('diameter');
        $result = M_PI * $d;
        return redirect('/kLingkaran')->with('info', 'Keliling Lingkaran adalah = '.$result);
    }

    public function kJajarGC(Request $request){
        $ab = $request->input('ab');
        $bc = $request->input('bc');
        $result = 2 * ($ab + $bc);
        return redirect('/kJajarG')->with('info', 'Keliling Jajar Genjang adalah = '.$result);
    }

    public function kTrapesiumC(Request $request){
        $ab = $request->input('ab');
        $bc = $request->input('bc');
        $cd = $request->input('cd');
        $da = $request->input('da');
        $result = $ab + $bc + $cd + $da;
        return redirect('/kTrapesium')->with('info', 'Keliling Trapesium adalah = '.$result);
    }
}
