Page 365 - Webapplication11_C11_Flipbook
P. 365

When you click on the “OK” button, with the message “This page says”. Then a new window appears as shown below:



















                                                 Lab Assignment ‘n Activity                   #Computational Thinking



                   1.  Write JavaScript code for the following:
                       •  Accept three numbers from the user and display the largest number.
                       •  Accept principal amount and rate from the user. Calculate simple interest as follows:
                             Principal Amount                           Time
                             >=25000                                    10 years, 5 years otherwise
                       •  Accept salary of an employee from the user. Deduct the income tax from the salary on the following basis
                         and finally display income tax and net salary.
                             Salary                                     Income Tax
                             >  `15000                                  30%
                             Between `7000 – `15000                     20%
                             <`7000                                     10%
                       •  Calculate discount price base on total amount. If amount is less than 10000 then no discount. If amount is
                         less than 20000 then discount is 5%. If amount is less than 30000 then discount is 10%. If amount is more
                         than 50000 then discount is 15%.                                             [CBSE Handbook]
                   2.  Predict the output of the following code:
                       <HTML>
                       <BODY>
                       <SCRIPT>

                       var num1=prompt("Enter a number");
                       document.write("Number entered is :"+num1);
                       document.write("<br> <br>");
                       if (num1%2==0) {
                         document.write(num1+" is an even number");}
                       else {
                         document.write(num1+" is an odd number");}
                       </SCRIPT>

                       </BODY>
                       </HTML>





                                                                                                  JavaScript Part 1  363
   360   361   362   363   364   365   366   367   368   369   370