UDACITY quiz help

hi guys I am stucked in a udacity quiz,and no one helps me around their forum.

Quiz: Out to Dinner (2-10)

Create a variable called bill and assign it the result of 10.25 + 3.99 + 7.15 (don’t perform the calculation yourself, let JavaScript do it!). Next, create a variable called tip and assign it the result of multiplying bill by a 15% tip rate. Finally, add the bill and tip together and store it into a variable called total.

Print the total to the JavaScript console.

Hint: 15% in decimal form is written as 0.15.

TIP: To print out the total with a dollar sign ( $ ) use string concatenation. To round total up by two decimal points use the toFixed() method. To use toFixed() pass it the number of decimal points you want to use. For example, if total equals 3.9860, then total.toFixed(2) would return 3.99.


var bill = (10.25 + 3.99 + 7.15);

var tip =(10.25 + 3.99 + 7.15) * (0.15);

var total= (“bill”) + (“tip”);


Javascript treats text inside quotes as strings, so if you wanna add bill and tip variable just specify the variable names( quotes arent needed).
also console.totatl() is invalid

You don’t have to recompute the sum in the tip; you can just use the value stored in bill (that’s one point of using variables):

var bill = 10.25 + 3.99 + 7.15;
var tip = bill * 0.15;

You don’t wrap variable names in quotes. That’ll give you an entirely different value that have nothing to do with the variables themselves. Also the parentheses around the variable names are not necessary.

There’s no function called console.total. You instead want console.log.

Hi there! I initially ran into some issues with this one too. Below is my solution to the quiz.

var bill = 10.25 + 3.99 + 7.15;
var tip = bill * .15;
var total = bill + tip;
console.log("$" + total);

var bill = 10.25+3.99+7.15;
var tip = bill*0.15;
var total = bill+tip;

console .log(’$’+total.toFixed(2)); //use toFixed() method and pass the number of decimal points you want to use

1 Like

var bill = 10.25 + 3.99 + 7.15;
var tip = bill * 0.15;
var total = bill + tip;