Question
In Javascript without using lists or arrays Assignment #1: Grocery List Create a program that lets users record their shopping list, and approximate the amount
In Javascript without using lists or arrays
Assignment #1: Grocery List
Create a program that lets users record their shopping list, and approximate the amount of money they'll owe at checkout.
First, ask for an item (e.g., "bananas"), then the price (e.g., 1.29). Ensure that only valid data is accepted: items must not be blank, and prices must neither be blank nor be zero or less; re-prompt until you get valid responses. Keep asking until the user for items and prices until she enters "DONE" (without the quotes) when asked for an item. In the DONE case, do not prompt the user for the price (there's no point in that). While data entry is happening, a list should be written to the document, under an attractive heading. Put an asterisk next to any item that is $10.00 or more.
After DONE is entered, display another heading for the summary. Then list the number of items to be purchased along with the total amount they'll spend on the shopping trip. Sample output is shown below.
List
Item: Bananas, Price: $1.29 Item: Milk, Price: $1.99 Item: Laundry detergent, Price: $12.99* Item: Salad mix, Price: $3.99
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started