Lesson 2 Challenge 2

by nathanesa

JavaScript

let cone = prompt('Which cone do you want? (plain, cup or waffle)');
if (cone == 'plain') {
  cost = 1;
} else if (cone == 'cup') {
  cost = 1.5;
} else {
  cost = 2;
}

let flavour = prompt('Which flavour? (chocolate, strawberry or vanilla)');

let topping = prompt('Which topping? (nuts, sprinkles or sauce)');
if (topping == 'nuts') {
  cost = cost + 0.5;
} else if (topping == 'sprinkles') {
  cost = cost + 0.5;
} else {
  cost = cost + 1;
}

document.write('Total cost is $' + cost);