lab5 - Exercise 1 <20 points> CMSC 152001 Intro to...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Intro to Computer Science 2 Summer 2009 Lab #5 (8/26/2009) Exercise 1 <<20 points>> You are provided with an XML file with information about products in the store. This is a sample file: <?xml version="1.0"?> <shop name="Uncle SNAFU's Computer Store"> <item id="1" stock="7" discounted="y"> <name>FOOBAR keyboard</name> <price>39.99</price> </item> <item id="2" stock="15" discounted="y"> <name>Grouchobyte hard drive</name> <price>149.99</price> </item> <item id="3" stock="81"> <name>Wumpus repellant</name> <price>49.99</price> </item> </shop> For each product, the following information is stored: . Product ID : Each product is assigned a unique id. Items in stock : The number of products immediately available in the store. Name : The product's name. Price : The product's price. Discounted product : Indicates whether this product is currently offered at a discounted price ('15% discount). Write a Python program that reads an inventory file and determines the total value of all the items in stock. In other words, for each product, multiply its price by the stock (applying a discount if necessary), and sum all the values. The program's output should be the total value. The output for the above sample file should be:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/10/2009 for the course CMSC 15200 taught by Professor Paolocodenotti during the Summer '09 term at UChicago.

Page1 / 4

lab5 - Exercise 1 &lt;20 points&gt; CMSC 152001 Intro to...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online