<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class VolumeCon extends Controller
{
    public function vPrismaS3C(Request $request){
        $p = $request->input('panjang');
        $l = $request->input('lebar');
        $t = $request->input('tinggi');
        $result = 1/2 * $p * $l * $t;
        return redirect('/vPrismaS3')->with('info','Volume Prisma adalah = '.$result);
    }

    public function vKubusC(Request $request){
        $s = $request->input('sisi');
        $result = $s * $s * $s;
        return redirect('/vKubus')->with('info','Volume Kubus adalah = '.$result);
    }

    public function vLimasS4C(Request $request){
        $p = $request->input('panjang');
        $l = $request->input('lebar');
        $t = $request->input('tinggi');
        $result = 1/3 * $p * $l * $t;
        return redirect('/vLimasS4')->with('info','Volume Limas Segiempat adalah = '.$result);
    }

    public function vLimasS3C(Request $request){
        $as = $request->input('alass3');
        $ts = $request->input('tinggis3');
        $tl = $request->input('tinggilm');
        $result = 1/6 *$as * $ts * $tl;
        return redirect('/vLimasS3')->with('info','Volume Limas Segitiga adalah = '.$result);
    }

    public function vTabungC(Request $request){
        $r = $request->input('jarijari');
        $t = $request->input('tinggi');
        $result = M_PI * $r * $r * $t;
        return redirect('/vTabung')->with('info','Volume Tabung adalah = '.$result);
    }

    public function vBalokC(Request $request){
        $p = $request->input('panjang');
        $l = $request->input('lebar');
        $t = $request->input('tinggi');
        $result = $p * $l * $t;
        return redirect('/vBalok')->with('info','Volume Balok adalah = '.$result);
    }

    public function vKerucutC(Request $request){
        $r = $request->input('jarijari');
        $t = $request->input('tinggi');
        $result = 1/3 * M_PI * $r * $r * $t;
        return redirect('/vKerucut')->with('info','Volume Kerucut adalah = '.$result);
    }

    public function vBolaC(Request $request){
        $r = $request->input('jarijari');
        $result = M_PI * $r * $r * $r;
        return redirect('/vBola')->with('info','Volume Bola adalah = '.$result);
    }
}
