Ask Question
17 January, 10:29

Jasmine is writing a shopping app. She has created a variable to keep track of the number of items in the shopping cart. Every time someone clicks the "addItemButton", she would like the variable to increase by 1.

What code should Jasmine insert where it says in order for her app to work? a) cart total = 1;

b) cartTotal + 1;

c) cartTotal = cartTotal + 1;

d) var cartTotal = cartTotal + 1;

+4
Answers (1)
  1. 17 January, 11:43
    0
    C. carTotal=carTotal + 1;

    Explanation:

    Option 'c' is the correct answer, because when some click on the "additembutton" the variable cartTotal should increment by 1. As jasmine want to track the record of no. of items in cart, each time customer will click "additembutton" the variable "cartTotal" increment by 1 and also update the value of that variable. e. g

    If initially

    cartTotal=0

    When 1st time additembutton pressed

    CartTotal = CartTotal + 1 = => will make it as CartTotal=0+1 = => CartTotal = 1

    Now CartTotal=1;

    When customer 2nd time press "additembutton"

    CartTotal = CartTotal + 1 = => will make it as CartTotal=1+1 = => CartTotal = 2

    This process will continue and update the cartTotal till the customer add items into the cart.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Jasmine is writing a shopping app. She has created a variable to keep track of the number of items in the shopping cart. Every time someone ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers