Saturday, 23 April 2016

21/4/2016

Today lab class is to do past year Final Exam Question STIV3013 sem 1 2015-2016 ^_^


Answer of Question: -
1.   //retrieve information from the Form
$name = $_POST (“name”);
$matric = $_POST (“matric”);
$stiv1023_mark = $_POST (“stiv1023_mark”);
$stiv2023_mark = $_POST (“stiv2023_mark”)
$stiv3013_mark = $_POST (“stiv3013_mark”);
$vkhb2031_mark = $_POST (“vkhb2031_mark”);


2.  //calculate grade for each course by calling calculateGred() function
$stiv1023_grade = calculateGred($stiv1023_mark);
$stiv2023_grade = calculateGred($stiv2023_mark);
$stiv3013_grade = calculateGred($stiv3013_mark);
$vkhb2031_grade = calculateGred($vkhb2031_mark);


3.  //calculate point for each course by calling calculatePoint() function
 $stiv1023_point = calculatePoint($stiv1023_grade);
$stiv2023_point = calculatePoint($stiv2023_grade);
$stiv3013_point = calculatePoint($stiv3013_grade);
$vkhb2031_point = calculatePoint($vkhb2031_grade);


4.  //calculate TotalPoint based on point for each course and credit
      $TotalPoint=($stiv1023_point*3)+($stiv2023_point*3)+($stiv3013_point*3)+          
                            ($vkhb2031_point*1);


5.  //calculate GPA based on Total Point and total credit
  $GPA = TotalPoint/10;


6.  //calculate final result by calling calculateResult() function
    $Final_Result = calculateResult($GPA);


7.  //function to calculate the grade based on mark
 calculateGred($mark)
 {
if ($mark >= 90)
$grade = ‘A’;
else if ($mark>=80)
$grade = ‘B’;
else if ($mark>=70)
$grade = ‘C’;
else if ($mark>=60)
$grade = ‘D’;
else if ($mark>=50)
$grade = ‘E’;
else
$grade = ‘F’;
return $grade
}


8.  //function to calculate the point based on grade
calculatepoint($grade)
{
if ($grade== ‘A’)
$point= 4.0;
else if ($grade== ‘B’)
$point=3.5;
else if ($grade==’C’)
$point=3.0;
else if ($grade= ‘D’)
$point= 2.5;
else if ($grade= ‘E’)
$point= 2.0;
else
$point= 1.0;
return $point


9.  //function to calculate the result based on GPA
calculateResult($GPA)
{
If  ($GPA >= 3.00)
$GPA = “Pass with distinction”;
else if ($GPA >= 2.00)
$GPA = “Pass”
else
$result= “Fail”;
Return result;


}

No comments:

Post a Comment