Lesson 8 Tinker Task
by nathanesa
JavaScript
var total = 0;
price = prompt('Welcome! Enter your first price: ');
while (price != 'STOP') {
total = total + parseInt(price); // Note, parseInt is needed to interpret price as a number.
alert('The total so far is $' + total + '.');
price = prompt('Enter another price, or enter STOP to finish: ');
}
alert('Thank you for using this program.');