Wednesday, March 19, 2014

CGPA Calculator PHP source Code

CGPA stands for Cumulative Grading Point Average.

Today, we are going to talk about making a cgpa calculator which will be made in PHP. I just used simple addition and multiplication in this code. Let's see the interface first:





Let's go through the php souce codes:

<?php

$s1val = $_POST['s1'];
$s2val = $_POST['s2'];
$s3val = $_POST['s3'];
$s4val = $_POST['s4'];
$s5val = $_POST['s5'];
$s6val = $_POST['s6'];


$c1val = $_POST['c1'];
$c2val = $_POST['c2'];
$c3val = $_POST['c3'];
$c4val = $_POST['c4'];
$c5val = $_POST['c5'];
$c6val = $_POST['c6'];




$suball = (( $s1val*$c1val ) + ( $s2val*$c2val ) + ( $s3val*$c3val )+ ( $s4val*$c4val ) + ( $s5val*$c5val ) + ( $s6val*$c6val ) );
$crall = $c1val + $c2val + $c3val+ $c4val+ $c5val+ $c6val;

$cgpa = $suball / $crall;

 $cgpaformated = number_format ($cgpa, 2);

echo "<p>Your CGPA: " . $cgpa . "</p>";
echo "<br/><p>" . " Your CGPA Formated: ". $cgpaformated . "</p>";


if ( $cgpaformated > 3.75 )
 echo "<p><br/>". " .. Oh Boy! You are awesome and outstanding! </p>";

else if ( $cgpaformated > 3.49 && $cgpaformated <= 3.75 )
  echo "<br/>". "<p>You are excellent!! :D Carry on!</p>";


?>


I'm pretty sure, you won't face much problem to understand the idea clearly of this codes. You can go through the full site  for other posts for knowing about other posts and source codes.

Contact with CarnivalBD team for more inquiry or ask me privately.

3 comments:

  1. I dont understand this code. THere is no database specified. There are no tables. I dont know how to implement this code. Please help explain into detail. I am new to PHp. Thanks alot in advance

    ReplyDelete
  2. And how did you specify the grading scale too(i want mine to be 5.0 scale) Please help out here please

    ReplyDelete