CSC1321 Programming Assignment
Write a program to read product inventory data from a data file here
and display in web page format. The data processing tasks include:
- Write a C++ program to read wine inventory data from the input file line by line (each line represents a wine indventory)
- Output the data into a HTML file in tabular format using HTML table tags. A sample of output file is
- View the HTML file in web browser to check if your program reads and outputs data correctly
- Calculate inventory value for each product (= Units in Stock x Unit Price) and sum them as the total inventory value of all products
- Find out which product (product name) has the most inventory value and its inventory value. A procedure of finding the max
value among a list of numbers is given below:
- Define a float variable named max for storing the max inventory value among all products
- Assume the inventory value of the first product is the max initially
- Use a loop to check each of the remaining products. If the inventory value of the product currently being checked is greater than max,
update max with it. Otherwise, ignore it and keep going until all products are checked.
- Upon the completion of the looping, max store the max inventory value among all products.
- To record product name with most inventory value, you need to define a string type variable, say, pName.
Whenever the value of variable max is updated, pName needs to be updated with the product name as well.
//Print table header
outData << "<table border=1>" << endl;
//Read the first product
inData >> ...
//Read next product
inData >> ...
outData << "</table>" << endl;
What to submit
Submit both C++ program and HTML output file to Blackboard by the midnight of the due day.