JS exercise from my friends' 9th grade Computer Sci class

Instructions: A tipping calculator that asks for the bill total and your satisfaction rating then calculates the total cost. "Great" = 20% tip, "Good" = 15%, "Bad" = 0%

ex: Bill = \$10, Satisfaction rating = Great, Tip = \$2, Total = \$12

Output:

My code:
``````
<script>

function start() {
var tip;
var total;
var rate;

var askBill = window.prompt('Bill (number only, no symbol)');
return;
}

// turn askBill string into number
if (isNaN(bill) == true) {
bill = "null (Please enter a number)";
rate = "null";
tip = "null";
total = "null";
} else {

return;
}

// rating
switch (rate) {
case "GREAT":
tip = bill * 0.2;

total;
total = bill + tip;
break;

case "GOOD":
tip = bill * 0.15;

total;
total = bill + tip;
break;

tip = 0;

total;
total = bill + tip;
break;

default:
tip = "null";
total = "null";
}
} //end of else

// print
document.getElementById('demo').innerHTML =
"<b>Bill</b>: " + bill + "<br><b>Satisfaction rating</b>: " + rate +
"<br><br><b>Tip</b>: " + tip + "<br><b>Total</b>: " + total;
}
</script>
```
```

Author's notes:

lol! That was fun~ It seems my friends had a hard time with it. They told me they hated Javascript!