CS101 Assignment No 2 Solution Fall 2017 | Virtual Study Solutions

Adsetra Ads

 

CS101 Assignment No 2 Fall 2017

Dear Students, Here you can read or Download CS101 -Introduction to Computing Assignment No 2 Solution and Discussion of Semester Fall 2017. CS101 Assignment Solution has been added. Assignment Due Date is 12 January, 2018. Total Marks are 20. We are here to facilitate your learning and we do not appreciate the idea of copying or replicating solutions. CS101 Assignment No 1 Solution Fall 2017.

CS101 Assignment No 2 Solution Fall 2017
CS101 Assignment No 2 Solution Fall 2017

CS101 Assignment Objectives:

After solving this assignment, students will learn about,
  • HTML tags and handling of HTML tags. 
  • Table creation and handling in HTML. 
  • Knowledge about JAVA SCRIPT functions and JAVA SCRIPTS events. 

CS101 Assignment 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 assignment is submitted via email.
  • The assignment is copied from Internet or from any other student.
  • The submitted assignment does not open or file is corrupt.
  • It is in some format other than .html.
Please Note: All types of plagiarism are strictly prohibited.

For any query about the assignment, contact at cs101@vu.edu.pk

CS101 Assignment Question Statement:

Please 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.

CS101 Assignment Solution Guidelines :

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:

CS101 Assignment Question figure (a)

  • 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


CS101 Assignment Question figure (b)

CS101 Assignment No 2 Solution Fall 2017

You will see the sample Solution file page preview below. and You can easily Download CS101 Assignment Solution File from the Download Button given below:

Scroll to Right witht the Bar below to read complete Code:


<html>
 <head>
  <title>homepage</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 * 1000 ;
      document.getElementById('grams').value = num;
      num = x * 2.2046 ;
      document.getElementById('pounds').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: Yellow; color: Red;">Weight Converter</div>
  <p style="font-size: 20px; background-color: gray; 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 Grams:</label>
    </td>
    <td>
     <input type="number" name="in_g" id="grams">
    </td>
   </tr>
   <tr>
    <td>
     <label>Pounds:</label>
    </td>
    <td>
     <input type="number" name="in_p" id="pounds">
    </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>

CS101 Assignment Solution Download Link


Download 

If Assignment Solution provided by (Virtual Study Solutions) was helpful. Please Share it with your friends. You can also like our Facebook Page or Subscribe Us below for Updates. Thank You.

Post a Comment

  1. solution not working sir in my pc

    ReplyDelete
  2. Thanks for it But I am confused that That's right

    ReplyDelete
  3. Dear copy the HTML code from Word File And paste it in Notepad then save the NotePad File with name ( index.html )
    And then open that file. You will see the output.

    ReplyDelete
    Replies
    1. i did above procedure now let me know what to do next

      Delete
  4. Bro Its not really working,something wron with this formula

    ReplyDelete
  5. sir i used the html coding but it doesnt show converted value in pounds and grams.please guide

    ReplyDelete
  6. Dear sir i used the html code but it doesnt show the converted value of kg in pounds and other .please guide.

    ReplyDelete
  7. True, the output is not working. Pasted in TXT and opened as HTML. The calculation does not work but the reset button works.

    ReplyDelete
  8. SIR,THIS SOLUTION SHOWS ONLY WEIGHT IN KG AND WEIGHT IN GRAMS

    ReplyDelete
  9. Yes all is true but output is not working

    ReplyDelete
  10. All is true but output is not working that is main aim of assignment

    ReplyDelete
  11. Only one correction is need in this code that is space between var num after else

    ReplyDelete
  12. Remove varnum; in else statement to work this code.

    ReplyDelete

 

Top