Question: JAVASCRIPT: Need help with this assignment - Please give scrreen shots showing indentation for working coding. Thank you - You will be developing two scripts.
JAVASCRIPT: Need help with this assignment - Please give scrreen shots showing indentation for working coding. Thank you -
You will be developing two scripts. Coding techniques will involve input, output, section and iteration. You will need to use variables and functions, but nothing more complex than was taught through the first 4 weeks of class.
Assessment of your productions will include the following dimensions:
Does the code meet functional requirements?
Does the code work when tested in a browser?
Is the code well organized and readable?
Does the code make effective use of comments and naming conventions?
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). Omit this part, now shown in red, unless you want to do it for a challenge: 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
Summary
Shopping list consists of 4 items Total should be about $20.26
Project Hints
Start with getting the project done with only the grocery item entered over and over, exiting when DONE is entered.
Then add a second prompt for the item price (these can't be in the same prompt; you'd have no easy way to pull them apart once you receive the data).
Then, using what you know about totals and counts (from the iteration slides), add in the total of prices and the count of items.
To add the requested input validation, remember that each of the prompt statements you want to validate must be replaced by a small input validation loop, which typically consists of "prompt, while (bad data), prompt again" logic.
Once you've gotten that far, see if you can make it so that after entering DONE, the user isn't prompted for the price, or at least that the price entered after DONE doesn't make it into the total or the item count.
If you can't get it all working, turn in a working version that does the most that you can. If you have non-working code, comment it out and tell me what you were trying to do there; that may be worth some credit.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
