Monday 8 January 2018

CS101 Assignment no 2 Solution

Dear Student,
Here is the solution of the Assignment CS101 code written here make some changes and submit to the instructor  
Also Comment about your opinion.
if you comment i will make more posts. 



Out Put of the Program






<html>
<head>
<title>Weight Calculator</title>
<script>
function check(){
var x;
x = document.getElementById('in_kg').value;
if (isNaN(x) || x <= 0) {
window.alert("Enter value grater than 0");
}else{
var num;
num = x * 2.2046 ;
document.getElementById('pounds').value = num;
        num = x * 1000 ;
document.getElementById('grams').value = num;
                        num = x * 1000000 ;
document.getElementById('mg').value = num;
num = x * 0.0011023 ;
document.getElementById('Us_ton').value = num;
num = x * 35.274 ;
document.getElementById('ounce').value = num;
}
}
</script>
</head>

<body>
<div align="center" style="margin-left: 35%; margin-right: 35%;">
<div style="font-size: 36px; background-color: deepskyblue; color: gainsboro;">Weight Converter</div>
<p style="font-size: 20px; background-color: blueviolet; margin: 5px;">Welcome to the online converter</p>
</div>
<form align="center">
<table align="center">
<tr>
<td>
<label>Weight in KG:</label>
</td>
<td>
<input type="number" name="kg" id="in_kg">
<input type="button" name="submit" value="Convert" onclick="check()">
</td>
</tr>
<tr>
<td>
<label>Weight In Poundss:</label>
</td>
<td>
<input type="number" name="in_g" id="pounds">
</td>
</tr>
<tr>
<td>
<label>Grams:</label>
</td>
<td>
<input type="number" name="in_p" id="grams">
</td>
</tr>
<tr>
<td>
<label>MilliGram:</label>
</td>
<td>
<input type="number" name="in_m" id="mg">
</td>
</tr>
<tr>
<td>
<label>US Ton:</label>
</td>
<td>
<input type="number" name="in_t" id="Us_ton">
</td>
</tr>
<tr>
<td>
<label>Ounces:</label>
</td>
<td>
<input type="number" name="in_o" id="ounce">
</td>
</tr>
</table>
<div id="grams"></div>
<input type="reset" name="reset" value="Reset Form">

<p>You can press Reset Button for another conversion</p>
</form>
        <footer>
  <p>Writen by: Muhammad Hamza Baig</p>
        </footer>
</body>
</html>

Featured Post

All Answers of Quiz regarding to this course on Fiverr "Online Freelancing Essentials: Be A Successful Fiverr Seller"

To Clear All quiz of mentioned Course you can have a look on or check questions answers as well. Course name:  Online Freelancing Essentials...

Popular Posts