Assignment 16 — problem solving
Due Monday, October 16 (extension)
- Produce a program that gives the cost of individually-supplied, user-specified commodities.
- The user will indicate with empty query that there are no more queries to process. If the user supplies an unknown commodity, then a warning should be issued.
- The commodity along with their current prices can be found at CSV web file.
- For your information, the commodities given in the web file are currently
cocoa cotton heating oil platinum sugar
coffee crude oil natural gas silver unleaded gas
copper gold orange juice soybeans wheat
- The location of the web file is
- The contents of the web file will change during our testing of your effort.
- Get contents of web file as a csv data sheet
- Create a dictionary for mapping commodities to cost
- Determine for the query responses whether a query is valid, empty (whitespace), or invalid
- If valid, determine its cost using the commodity dictionary and print result.
- If only whitespace, query processing is over
- If invalid, print an error message.
Enter commodity: natural gas
$2.88 (million BTUs)
Enter commodity: unleaded gas
Enter commodity: copper
Enter commodity: platinum
$932.00 (troy ounces)
Enter commodity: sea shells
Enter commodity: crude oil
Enter commodity: orange juice