CS12, Program 1

 

Assigned: January 15th, 2002

 

Due: January 22nd, 2002, 11pm

 

 

 

Topics

 

·      Using classes

·      Writing methods

·      Review of miscellaneous CS10 topics

·      Adhering to program specifications

 

 

 

Background

 

The Far west Computing Conference has 6 programming teams, each identified by a number between 0 and 5, inclusive.  Each Monday of the Computing season, which last 20 weeks, the current standings of the teams are calculated, using a complicated method that would put sportswriters to shame.

 

 

The Program

 

Write a program that will keep track of how many times each team was ranked #1 during the season.

Your program should use an array of 6 counter objects.  Please use the Counter class from this week’s lab.  A counter is incremented whenever that corresponding team ranks #1.  When all the input has been processed, the program should report how many weeks each team was ranked first.

 

 

The Input

 

20 numbers between 0 and 5, entered from the keyboard, representing the #1 ranked team for each of the 20 weeks.

 

 

The Output

 

Six lines, one for each team, each having the following format:

 

         Number of weeks team _ was ranked first: _

 

(The first blank will contain a team number; the second blank the number of weeks)

 

 

What to turn in

 

·      counter.h

 

·      counter.cpp

 

·      main.cpp

 

Please use these names for your files.

Please make sure that main.cpp includes your name, login and lab section.  Each is worth 1 point on this program.