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;


}

4/4/2016

Today our class Lecturer ask us to mark the Lab Tutorial Exercise that has given in last week. Lecturer also teach our calculate BMI by using PHP. 

The below is the BMI formula:



31/3/2016

In the lab class 31/3/2016, a test about PHP was given by our lecturer, Dr.Syamsul. 
Here are the output for this week lab:

Question 1

Question 2
Question 2(b)
Question 3
Question 4







Server Side Script (PHP)


28/3/2016 we learned about PHP.

What is PHP?

  • PHP is one of the server-side scripting languages.
  • PHP was originally called Personal Home Page.
  • PHP is an open source and eventually the name changed to PHP Hypertext Pre-processor.
  • PHP scripts can be embedded within HTML to create dynamic and interactive web pages (e-commerce or application web-based system).

Advantage of PHP:
  • Capable
  • Secure
  •  Easy to use
  •   Free of cost
  • Large communities
  •  Faster development
  • Platform independent
  • Supports all major web servers
  • Supports all major databases
  •   Proven and trusted  
What is a PHP file??
  • PHP file can contain text, HTML, CSS, JavaScript, and PHP code
  • PHP code are executed on the server, and the result is returned to the browser as plain HTML
  • PHP file fave extension ".php"

What can PHP do??
  • Evaluate form data sent from a browser.
  • Build a custom web content to serve the browser.
  • Talk to a database.
  •  generate dynamic page content
  •  create, open, read, write, delete, and close files on the server
  • send and receive cookies
  •  add, delete, modify data in database
  •  be used to control user- access
  •  encrypt data

Operators
PHP supports several different types of operators that can be used in simple or complex expressions.

Arithmetic Operators
Comparison Operators

 Logical Operator