We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

www.vustudents.ning.com

 www.bit.ly/vucodes + Link For Assignments, GDBs & Online Quizzes Solution www.bit.ly/papersvu + Link For Past Papers, Solved MCQs, Short Notes & More

Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

# Assignment No. 02 Semester: Fall 2017 Introduction to Computing - CS101 Total Marks: 20 Due Date: 12-01-2018

Question Statement:

Note:  Students are required to submit HTML code file only with .html extension.Don’t upload word format file(.doc) etc.

### You are required to write HTML with Java Script code to create Weight Converter Calculator web page which can be used to convert values entered in Kilo Gram to Gram, Pounds, Milligrams, US tons and Ounces respectively.

Solution guidelines of this  web page are given as follow,

• You are required to create a text for taking input from the users in Kilo Grams. This text box can be labelled as Weight in KG.
• The users will be required to enter their input in Weight in Kg.
• Create one button labeled as Convert. On Mouse Click event the function “Converter” should be called to covert KG value to other units.
• If no value or less than 0 is entered in KG text box and Covert button is clicked then alert should be shown through window.alert() as:

• If the values is greater than 0 then your webpage will show converted values in Grams, Pounds, Milligrams, US tons and Ounces in the given text boxes as shown in sample output.
• Create another button labeled as Reset Form to clear text box values.
• You are required to use table so that items of the webpage will be shown in the arranged form.

Formula for KG to Grams conversion is:

Kilo Grams= KG*1000

Formula for KG to Pounds conversion is:

Pounds = KG* 2.2046

Formula for KG to Milligrams conversion is:

Milligrams = KG* 1000000

Formula for KG to Pounds conversion is:

US Ton = KG* 0.0011023

Formula for KG to Pounds conversion is:

Ounce = KG* 35.274

Sample Output (Snapshot): Color Scheme may be of your choice.

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?

Views: 8183

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

Attachments:

# Cs101 assignment solution

<html>

<title>Weight Calculator</title>

<script>

function check(){

var x;

x = document.getElementById('in_kg').value;

if (isNaN(x) || x <= 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>

<body>

<div align="center" style="margin-left: 35%; margin-right: 35%;">

<div style="font-size: 36px; background-color:; color: deepskyblue;">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="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>

</body>

</html>

thank u ab ak km or kr dy MGT301 ki quiz ha ans bta dy agr ksi or ki ho gi ha to

## Latest Activity

30 minutes ago
30 minutes ago
30 minutes ago
31 minutes ago
31 minutes ago
31 minutes ago
Hinna Muzammal joined + M.Tariq Malik's group

49 minutes ago
56 minutes ago
59 minutes ago
1 hour ago
1 hour ago

1

2

3