Deliverables:
To complete this assignment you must --
1.) Write the HTML and JavaScript page described below and demonstrate to
the lab instructor that it operates correctly.
2.) Complete the lab during the time provided or email your results to your lab instructors.
3.) Demonstrate your program(s) to your lab instructor.
Introduction: : The goal of this assignment is to give you experience working with PROMPT DIALOG box and IF-THEN-ELSE blocks. The PROMPT DIALOG BOX accepts an input from the user and IF-THEN-ELSE blocks let you choose what parts of your code execute based on input data.
Procedures:
| Section | Pseudocode | Comments |
|---|---|---|
| INPUT: | var age = prompt('How old are you',' ') |
We ask the user his/her age |
| COMPUTATION AND OUTPUT: | IF (age > 55 ) THEN |
Convince yourself these comparisons provide the correct result. |
Train Fare calculator Part II
| Section | Pseudocode | Comments |
|---|---|---|
| INPUT: | var age = prompt('How old are you',' ') |
We ask the user his/her age |
| COMPUTATION AND OUTPUT: | IF (age > 0 && age <=12 ) THEN Display 'You pay child`s fare!' ELSE IF (age > 12 && age < 60) Display 'You pay the regular adult fare' ELSE Display 'You pay the senior fare' ENDIF ENDIF | Note the use of the "nested" IF-THEN-ELSE structures. It may be easier to do one at a time, then view it. |