Northcentral Technical College Introduction To Programming
10-152-310
Introduction to Programming with JavaScript NTC 10-152-310

Learning Plan 3 3.2 Lab 2

# 3.2 Lab 2

#### File: /Learning Plan 3/3.2lab2.html

### Student

- Name:
- Section:
- Email:

## Lab Steps, Part 1

1. Open this file in Firefox and Microsoft Visual Studio.
2. Add your name, section, and email.
3. Add code after the line: `// PART 1: YOUR CODE STARTS AFTER THIS LINE:` to complete this part.
4. Your output should look like the Part 1 Example Output below.
5. Variable declarations section
   1. Write a comment that identifies this coding section.
   2. Create the following variables:
      1. `totalPrice`
      2. `widgetPrice`
      3. `widgetQuantity`
      4. `dodadPrice`
      5. `dodadQuantity`
      6. `gadgetPrice`
      7. `gadgetQuantity`
      8. `currentValue`
      9. `averagePrice`
   3. You may add more variables if you would like to.
6. Assignments section
   1. Write a comment that identifies this coding section.
   2. Prompt the user for three prices, `widgetPrice`, `dodadPrice`, `gadgetPrice`.
   3. Assign the entered values to their variables.
   4. Prompt the user for quantities of each item.
   5. Assign the entered quantities to their variables.
   6. Convert all entered data to numbers.
7. Calculations section
   1. Write a comment that identifies this coding section.
   2. The item total is calculated by multiplying the quantity times the price for that item.
   3. Calculate the average price of all items.
8. Output section
   1. Write a comment that identifies this coding section.
   2. Display the entered items and their quantities and item total on the page.
   3. Display the total price of all items

- Note: Make sure you have a blank line between the coding sections.

### Part 1 Example Output

    Widgets: 5 @ $5.99 for $29.95
    Dodads: 2 @ $12.99 for $25.98
    Gadgets: 10 @ $1.75 for $17.5

    Total: $73.43

    Average Price of Items: $24.4766666666667

### Your Output for Part 1

### 3.2 Assignment 2

- Here are the exercises that go with this lab. Have the output printed and ready to turn in on the first day of class next week.
  - 3.2 Assignment 2