Single Control Break Algorithm “Movie” PROJECT Example

Project Information

You do not know the number of records in the input file, so you must check for end of file!

The input file is grouped by movie rating but in no particular order.

INPUT FILE RECORD LAYOUT:

§         Movie title – alphanumeric length 18

§         Production company – alphanumeric length 12

§         Movie Rating – alphanumeric length 5 (G, PG, PG-13, R, NR)

§         Date Released – mmddyyyy format

§         At the Box Office Week 1 rating – integer max length 2

§         At the Box Office Week 2 rating – integer max length 2

§         At the Box Office Week 3 rating – integer max length 2

§         At the Box Office Week 4 rating – integer max length 2

§         Gross Earnings – dollar amount max value less than 1 billion

 

Input Records:

The Black StallionMiramax     G    010120040106111200042501000

Finding Nemo      Pixar       G    070120030407101500025000000

Cheaper by the 12 Miramax     PG   120120030406121600020000000

Peter Pan         Disney      PG   122020030409102000015000000

The Haunted Man   Warner Bros PG   010120040307091700010000000

Scary Movie 3     Miramax     PG-13080120030204081000050000000

Matrix RevolutionsMiramax     R    111520030102030401452000000

Mystic River      Chances     R    122020030406101300085000000

 

 

OUTPUT report should look similar to the following; be sure to indent as shown; the movie rating order is designated by the input file order:                                                                                               

Line#1 = page heading, centered;

Line#2 = blank

Line#3-5 = column headers for each of the input data; each column header underlined individually and spaced neatly

Line#6, etc! = repeat input data under each column header for every record

For date, you must output the data in the following format: mm/dd/yyyy

For the cost, edit the output using a floating $ sign

                  Line #A = after each type of rating, output the following

§         Average rating for all movies in this rating category for all 4 weeks

§         Total number of movies in this rating category

§         Total Gross earnings for all movies in this category

                  Line #B = after all ratings are output with their totals, output the following:

§         Total number of movies

§         The rating category with the highest average rating

Last line = write “END OF REPORT” with a blank line above it

 


Sample Output Report:

(no blank line here! first line is the page header!)

02/09/04                                                  Mom and Dad’s Movie List                                                 11:04 AM

Rating:  G

Description: everyone

 

                              Production        Date        ***************At the Box Office****************

Movie Title             Company       Released     Week1     Week2     Week3     Week4     Gross Earnings

Black Stallion          Miramax        01/01/2004     3          6           11            12            bbbb$425,010.00 

Finding Nemo          Pixar             07/01/2003     4          7            10            15            bbbb$250,000.00

 

Average Rating:   b8.50

Total Number of Movies:   2

Total Gross Earnings:  bbbbb$675,010.00

 

Rating:  PG

Description: parental guidance suggested

 

                              Production        Date        ***************At the Box Office****************

Movie Title             Company       Released     Week1     Week2     Week3     Week4     Gross Earnings

Cheaper by the 12   Miramax        12/01/2003     4           6            12            16            bbbb$200,000.00 

Peter Pan                           Disney                                12/20/2003     4 9                  10            20               bbbb$150,000.00

The Haunted Man    Warner Bros 01/01/2004     3           7                9            17        bbbb$100,000.00

 

Average Rating:  b9.75

Total Number of Movies:   3

Total Gross Earnings:  bbbbb$450,000.00

 

Rating: PG-13

Description:  parental guidance for children under 13 suggested

 

                              Production        Date        ***************At the Box Office****************

Movie Title             Company       Released     Week1     Week2     Week3     Week4     Gross Earnings

Scary Movie 3         Miramax        08/01/2003     2          4              8          10            bbbb$500,000.00 

 

Average Rating:  b6.00

Total Number of Movies:   1

Total Gross Earnings:  bbbbb$500,000.00

 

 

Rating: R

Description:  restricted; children over 17 years of age only unless accompanied by an adult

 

                              Production        Date        ***************At the Box Office****************

Movie Title             Company       Released     Week1     Week2     Week3     Week4     Gross Earnings

Matrix Revolutions Miramax         11/15/2003     1           2                      3                   4           b$14,520,000.00 

Mystic River           Chances        12/20/2003     4           6           10            13            bbbb$850,000.00

 

Average Rating:  b6.62

Total Number of Movies:   2

Total Gross Earnings:  bbbbb$450,000.00

 

Total Number of Movies:  b8

Movie Category with the highest average rating:  PG

END OF REPORT