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