CS310 Assignment 2 Solution and Discussion


  • Cyberian's Gold

    Assignment No. 02
    Semester: Fall 2019
    CS310: Open Source Web Application Development Total Marks: 15
    Due Date: December 02, 2019
    Topics Covered: Topics of Weeks 1 to 5

    Instructions:

    Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:

     The assignment is submitted after due date.
     The submitted assignment does not open or file is corrupt.
     Assignment is copied (partial or full) from any source (websites, forums, students, etc)

    Note: You have to upload .php file which will have code of PHP. Assignment in any other format (extension) will not be accepted and will be awarded with zero marks.

    Objective:

    The objectives of this assignment are:

    • Understanding the use of if-else statements

    Note:

    • This assignment is a Graded Assignment.
    • The assignment submitted through email will not be accepted.
    • This assignment is covering all topics of weeks 1 to 5.

    Guidelines:

     Code should be properly indented.
     You can use the following tools/software:
    o Adobe Dreamweaver, Notepad
    o XAMP, WAMP, Vertrigo Server

    For any query about the assignment, contact at [email protected].

    Assignment Statement:

    Suppose, you joined NGCP (Natural Gas Company Pakistan) as a developer. The first task is given to you is create a web-based application in PHP to generate the bill of customer.

    User of your application will give customer id as customer_id and number of units as units through URL. Your application will read customer id and units from URL and generate the bill according to table given below.

    Number of Units Rate per Unit
    First 50 units 0.50/unit
    Next 100 units 0.75/unit
    Next 100 units 1.00/unit
    units above 250 1.50/unit
    Additional taxes on Cost of Gas is 18%.
    Late payment surcharge 5% payable bill.

    The code to reach customer_id and units from URL is already given PHP file attached with assignment. You need work on provided file and complete and missing requirements.

    Sample Web Page:

    79e578d4-c79f-4e20-90ee-1237013913e6-image.png

    Submission Instructions:

    You have to submit single PHP file which will have all the code provided by us and PHP code you will write.

    BEST OF LUCK!


  • Cyberian's Gold

    Idea Solution

    <?php
    
    if (isset($_POST[‘submit’])) {
    
    $salary = $_POST[‘salary’];
    
    if ($salary>50000) {
    
    $insurance = (20/100)*$salary;
    
    echo “Your salary is “.$salary . ” And Calculated insurance is “. $insurance;
    
    }elseif($salary>40000){
    
    $insurance = (15/100)*$salary;
    
    echo “Your salary is “.$salary . ” And Calculated insurance is “. $insurance;
    
    }elseif($salary>30000){
    
    $insurance = (10/100)*$salary;
    
    echo “Your salary is “.$salary . ” And Calculated insurance is “. $insurance;
    

  • Cyberian's Gold



    Recent Topics


|