Code Wars V
     

Program / Task Name:

   Movie Time Popcorn

Level:

 

 Intermediate

Point Value:

 

 7

 

Task Description

The “Movie Time Popcorn” farm cooperative is about to sign a deal to supply all of the popcorn for a nationwide movie theatre chain.  If the deal goes through, it would make the farm cooperative a major success.  The last holdup to the deal is that the movie theatre wants proof that the farm cooperative can deliver the popcorn it needs.  The farm cooperative has hired you to create a program to produce a bar chart of the popcorn production for a cooperative farm group on a farm-by-farm basis.

The cooperative has supplied you with a data file containing the information on each farm (name, number of acres, and number of pints of popcorn produced).

You can assume that:

  • No farm name will be longer than 25 characters,
  • Each line will contain only 1 set of data, and
  • Each farm will have a full set of data (name, number, pints of popcorn)

Each item of data for a farm will be separated a comma and a space.

Program Input

The data for the farms can be found in prob09.in, and will look as follows:

Orville's Acres, 114.8, 438010
Hoffman's Hills, 77.2, 362290

Jiffy Quick Farm, 89.4, 248120

Jolly Good Plantation, 183.2, 1045700

Organically Grown Inc., 45.5, 146830

Program Output

Produce a single bar chart for all of the farms in the cooperative and write it to prob09.out.  For each farm, create a single line on the bar chart containing the name of the farm and it’s production of popcorn per acre.  Mark the bar chart with a ‘*’ for every 250 pint jars of popcorn per acre. The production goal for each farm is 5000 pint jars per acre.  Since the name of the farm can’t be longer than 25 characters, start the bar chart in column 30. 

                   Pop Co-Op

Farm Name                    Production in
                             Thousands of
                             Pint Jars per Acre
                                1   2   3   4   5   6
                             ---|---|---|---|---|---|
Orville's Acres              ***************    |
Hoffman's Hills              ****************** |
Jiffy Quick Farm             ***********        |
Jolly Good Plantation        *******************#**
Organically Grown Inc        ************       |

 

hp Code Wars
Hello -- Dominos?...
   
  (c) 2004 Hewlett-Packard Company