Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head> Javascript Tip Calculator </head>
- <body>
- <script type="text/javascript">
- <!--
- document.write("");
- var Total = 0;
- var NineTip = 1.09;
- var SevenTip = 1.07;
- var MealPrice = 0;
- while (MealPrice != -1) {
- MealPrice = parseFloat(prompt("Please Enter Meal Price"));
- while (MealPrice < -1){
- alert("Meal Price wasnt more than 0");
- MealPrice = prompt("Enter Meal Price");
- }
- if (MealPrice <= 100){
- Total = Total + (MealPrice * NineTip);
- }
- else{
- Total = Total + (MealPrice * SevenTip);
- }
- }
- Total = Total + 1.09
- document.write("<h2>");
- document.write("Total is "+ Total);
- //-->
- </script>
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement