<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[CS310 Assignment 2 Solution and Discussion]]></title><description><![CDATA[<p dir="auto">Assignment No. 02<br />
Semester: Fall 2019<br />
CS310: Open Source Web Application Development	Total Marks: 15<br />
Due Date: December 02, 2019<br />
Topics Covered: Topics of Weeks 1 to 5</p>
<p dir="auto">Instructions:</p>
<p dir="auto">Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:</p>
<p dir="auto">	The assignment is submitted after due date.<br />
	The submitted assignment does not open or file is corrupt.<br />
	Assignment is copied (partial or full) from any source (websites, forums, students, etc)</p>
<p dir="auto">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.</p>
<p dir="auto">Objective:</p>
<p dir="auto">The objectives of this assignment are:</p>
<p dir="auto">•	Understanding the use of if-else statements</p>
<p dir="auto">Note:</p>
<p dir="auto">•	This assignment is a Graded Assignment.<br />
•	The assignment submitted through email will not be accepted.<br />
•	This assignment is covering all topics of weeks 1 to 5.</p>
<p dir="auto">Guidelines:</p>
<p dir="auto">	Code should be properly indented.<br />
	You can use the following tools/software:<br />
o	Adobe Dreamweaver, Notepad<br />
o	XAMP, WAMP, Vertrigo Server</p>
<p dir="auto">For any query about the assignment, contact at <a href="mailto:cs310@vu.edu.pk" target="_blank" rel="noopener noreferrer nofollow ugc">cs310@vu.edu.pk</a>.</p>
<p dir="auto">Assignment Statement:</p>
<p dir="auto">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.</p>
<p dir="auto">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.</p>
<p dir="auto">Number of Units	Rate per Unit<br />
First 50 units	0.50/unit<br />
Next 100 units	0.75/unit<br />
Next 100 units	1.00/unit<br />
units above 250	1.50/unit<br />
Additional taxes on Cost of Gas is 18%.<br />
Late payment surcharge 5% payable bill.</p>
<p dir="auto">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.</p>
<p dir="auto">Sample Web Page:</p>
<p dir="auto"><img src="https://i.imgur.com/R1qXcyf.png" alt="79e578d4-c79f-4e20-90ee-1237013913e6-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Submission Instructions:</p>
<p dir="auto">You have to submit single PHP file which will have all the code provided by us and PHP code you will write.</p>
<p dir="auto">BEST OF LUCK!</p>
]]></description><link>https://community.secnto.com//topic/727/cs310-assignment-2-solution-and-discussion</link><generator>RSS for Node</generator><lastBuildDate>Mon, 08 Jun 2026 19:59:52 GMT</lastBuildDate><atom:link href="https://community.secnto.com//topic/727.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 03 Dec 2019 13:28:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CS310 Assignment 2 Solution and Discussion on Wed, 15 Jan 2020 09:10:25 GMT]]></title><description><![CDATA[<p dir="auto"><strong>Idea Solution</strong></p>
<pre><code>&lt;?php

if(!isset($_GET['customer_id']) || !isset($_GET['units'])){
$customer_id = 0;
$units = 0;
}
else{
	$customer_id = $_GET['customer_id'];
$units = $_GET['units'];
}
$amount = 0;

if($units &gt; 0 &amp;&amp; $units &lt;= 50)
    {
        $amount = $units * 0.50;
    }
    else if($units &lt;= 150)
    {
        $amount = 50 * 0.5 + (($units - 50) * 0.75);
    }
    else if($units &lt;= 250)
    {
        $amount = 50 * 0.5 + 100 * 0.75 + (($units - 150) * 1.00);
    }
    else
    {
        $amount = 50 * 0.5 + 100 * 0.75 + 100 * 1.0 + (($units - 250) * 1.50);
    }


$tax = $amount * 0.18;
$payable = $amount + $tax;
$lp_surcharge = $payable * 0.05;

$late_payable = $payable + $lp_surcharge;
?&gt;

&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Assignment No. 2 (Solution) - Fall 2019&lt;/title&gt;
&lt;/head&gt;

&lt;body bgcolor="#CCCCCC"&gt;
&lt;table width="1800" border="0" align="center" cellpadding="20" cellspacing="0"&gt;
  &lt;tr&gt;
    &lt;td height="200" colspan="2" align="center" valign="middle" bgcolor="#CC6633"&gt;&lt;h1&gt;Natural Gas Company Pakistan&lt;/h1&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td width="300"  align="center" valign="top" bgcolor="#FF9966"&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="20"&gt;
  &lt;tr&gt;
    &lt;td align="right"&gt;&lt;strong&gt;Customer ID&lt;/strong&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td align="right"&gt;&lt;strong&gt;Units Consumed&lt;/strong&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td align="right"&gt;&lt;strong&gt;Cost of Gas&lt;/strong&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td align="right"&gt;&lt;p&gt;&lt;strong&gt;Taxes (18%)&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td align="right"&gt;&lt;strong&gt;Payable within Due Date&lt;/strong&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td align="right"&gt;&lt;strong&gt;Late Payment Surcharge (5%)&lt;/strong&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td align="right"&gt;&lt;strong&gt;Payable after Due Date&lt;/strong&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
&lt;/td&gt;
  &lt;td height="500" align="left" valign="top" bgcolor="#FFDECE"&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="20"&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;&lt;?php echo $customer_id; ?&gt;&lt;/strong&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;?php echo $units; ?&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;?php echo $amount; ?&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;?php echo intval($tax*100) / 100; ?&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;?php echo intval($payable * 100) / 100; ?&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;&lt;?php echo intval($lp_surcharge * 100) / 100; ?&gt;&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;&lt;?php echo intval($late_payable * 100) / 100; ?&gt;&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;
    &lt;td height="140" colspan="2" align="center" valign="middle" bgcolor="#CC6633"&gt;&lt;h4&gt;Copy Rights: NGCP&lt;/h4&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;

</code></pre>
<p dir="auto">Ideas 2</p>
<pre><code>&lt;?php

if (isset($_POST[‘submit’])) {

$salary = $_POST[‘salary’];

if ($salary&gt;50000) {

$insurance = (20/100)*$salary;

echo “Your salary is “.$salary . ” And Calculated insurance is “. $insurance;

}elseif($salary&gt;40000){

$insurance = (15/100)*$salary;

echo “Your salary is “.$salary . ” And Calculated insurance is “. $insurance;

}elseif($salary&gt;30000){

$insurance = (10/100)*$salary;

echo “Your salary is “.$salary . ” And Calculated insurance is “. $insurance;
</code></pre>
]]></description><link>https://community.secnto.com//post/2141</link><guid isPermaLink="true">https://community.secnto.com//post/2141</guid><dc:creator><![CDATA[zareen]]></dc:creator><pubDate>Wed, 15 Jan 2020 09:10:25 GMT</pubDate></item><item><title><![CDATA[Reply to CS310 Assignment 2 Solution and Discussion on Tue, 03 Dec 2019 13:30:28 GMT]]></title><description><![CDATA[<p dir="auto"><a href="https://youtu.be/eHuHOGyGD7E" target="_blank" rel="noopener noreferrer nofollow ugc">https://youtu.be/eHuHOGyGD7E</a></p>
]]></description><link>https://community.secnto.com//post/2140</link><guid isPermaLink="true">https://community.secnto.com//post/2140</guid><dc:creator><![CDATA[zareen]]></dc:creator><pubDate>Tue, 03 Dec 2019 13:30:28 GMT</pubDate></item></channel></rss>