Programming
Assignment 12
Write a C++ program
to produce a bar chart of gourmet popcorn production for a group of farms
called the POP COOP. The input file
looks like the following (DON'T type the headings in the file).
Farm Acres Jars
Orville's Acres 114.8 438011
Hartwick Hills 77.2 362292
Jiffy Quick Farm 89.4 248123
Jolly Good Giant's 183.2 1045703
Oliver's Organic 45.5 146832
The first item is
the name of the farm, the second is the number of acres of popcorn raised, and
the third is the number of jars of popcorn produced by the farm.
The output from
your program should look like the following:
POP COOP
Production in
Thousands of
Farm
Name Jars per Acre
1
2 3 4 5 6
----|----|----|----|----|----|
Orville's
Acres *******************
Hartwick
Hills ***********************
Jiffy
Quick Farm **************
Jolly
Good Giant's *****************************
Oliver's
Organic ****************
TOTAL
ACRES: 510.1
TOTAL
JARS: 2240961
AVERAGE
JARS PER ACRE: 4393
Your program should
do the following (using 2 functions):
(1) Print the appropriate header lines.
(2) Read and print the farm's name using a ReadWriteName
function (use infile.get). Then
read the number of acres, and number of jars.
(3) Print the appropriate number of stars
using a PrintStars function. (There is 1 star for every 200 jars per
acre. Be sure to round to the closest number of stars.)
(4) Print the total acres, total jars, and
average jars per acre.
Make sure your program works correctly.