CS101 Assignment 2 Solution Fall 2018
#1
CS101 - Introduction to Computing

Assignment 2 Solution

Semester: Fall 2018

Solution

Code:
<html>
<html>
    <head>
    
    
    </head>
    <style>
        
        h1{
            background-color: #007FFF;
            text-align: center;
        }
        h3{
            background-color: #32a96c;
            text-align: center;
        }
    
    </style>
<body>


    <h1>Employee Salary Calculator</h1>
    <h3>Welcome to Online Salary Calculator</h3>
    <center>
    <table>
        
        <tr>
            <td><label>Employee ID:</label></td>
            <td><input type="text" value="BC180403203"></td>
            
        </tr>
        <tr>
            <td><label>Employee Name:</label></td>
            <td><input type="text" value="AYAN MALIK"></td>
            
        </tr>
        <tr>
            <td><label>Father Name:</label></td>
            <td><input type="text" value="MALIK AKBAR"></td>
            
        </tr>
        <tr>
            <td><label>Gender:</label></td>

        </tr>
        <tr>
            <td><label>Male</label></td>
            <td><input type="radio" checked></td>
            
        </tr>
        <tr>
            <td><label>Female</label></td>
            <td><input type="radio"></td>
            
        </tr>
        <tr>
            <td><label>CNIC:</label></td>
            <td><input type="text" value="36301-8899900-1"></td>
            
        </tr>
        <tr>
            <td><label>Basic Salary*:</label></td>
            <td><input type="text" id="basic"></td>
            
        </tr>
        <tr>
            <td><label>Utilities*:</label></td>
            <td><input type="text" id="utilities"></td>
            
        </tr>
        <tr>
            <td><label>House Rent*:</label></td>
            <td><input type="text" id="house_rent"></td>
            
        </tr>
        <tr>
            <td><label>Tax Percentage*:</label></td>
            <td><input type="text" id="tax_percentage"></td>
            
        </tr>
        <tr>
            <td><label>Total Salary*:</label></td>
            <td><input type="text" id="total_salary"></td>
            
        </tr>
        <tr>
            <td><label>Tax Year:</label></td>
            <td><select>
                <option>2014</option>
                <option>2015</option>
                <option>2016</option>
                <option>2017</option>
                <option>2018</option>
            </select></td>
            
        </tr>
        <tr>
            <td><input type="submit" onclick="SalCal();" value="Calculate"</td>
            <td><input type="reset" onclick="reset()" value="Clear"></td>
        </tr>
    </table>
    </center>


<script>
    // reset button with pure javascript
    function reset(){
        location.reload();
    }
    
    function SalCal(){
        var basic_salary = document.getElementById('basic').value;
        if(basic_salary == ''){
            alert('Basic salary is missing');
        
        }else{
            
            var utilities_input = basic_salary * 10 / 100;
            utilities.value = utilities_input;
            
            var house_rents = basic_salary * 8 / 100;
            house_rent.value = house_rents;
            
            var tax_percentages = basic_salary * 2/ 100;
            tax_percentage.value =  tax_percentages;
            
            var total_salaries = (utilities_input + house_rents) + (basic_salary - tax_percentages);
            total_salary.value = total_salaries;
            }
        
    
    }
    
    

</script>
</body>
</html>
  


Possibly Related Threads…
Thread Author Replies Views Last Post
  CS101 Assignment 2 Solution Spring 2020 Ayra Suleman 0 174 06-11-2020, 06:28 AM
Last Post: Ayra Suleman
  CS101 GDB Solution Fall 2020 Ayra Suleman 0 1,958 01-31-2020, 08:19 PM
Last Post: Ayra Suleman
  CS101 GDB Solution Mishi Khan 1 2,549 01-25-2020, 04:59 PM
Last Post: adsvoo
  CS001 Assignment 3 Solution Fall 2020 Ayra Suleman 0 1,648 01-20-2020, 12:30 AM
Last Post: Ayra Suleman
  CS101 Assignment 1 Solution Fall 2019 Ayra Suleman 0 1,061 11-11-2019, 02:02 AM
Last Post: Ayra Suleman
  CS001 Assignment 1 Solution Fall 2019 Ayra Suleman 0 1,346 11-11-2019, 01:55 AM
Last Post: Ayra Suleman
  IT430 Assignment 1 Solution Fall 2019 Ayra Suleman 0 1,217 11-11-2019, 01:33 AM
Last Post: Ayra Suleman
  CS101 GDB Solution Spring 2019 Ayra Suleman 0 1,581 08-05-2019, 03:42 AM
Last Post: Ayra Suleman
  CS101 Assignment 2 Solution Spring 2019 Mishi Khan 0 717 05-23-2019, 03:03 AM
Last Post: Mishi Khan
  CS101 Assignment Solution Spring 2019 Mishi Khan 0 470 05-11-2019, 09:28 PM
Last Post: Mishi Khan



Users browsing this thread:
1 Guest(s)