FLORIDA HIGH SCHOOLS COMPUTING COMPETITION '92


1.1  Write a program to display the following company name:

            GGGGG   TTTTT   EEEEE
            G         T     E
            G GGG     T     EEEEE   DATA SERVICES
            G   G     T     E
            GGGGG     T     EEEEE 



1.2  GTE became a corporate entity in 1918 in Wisconsin and was 
named:  RICHLAND CENTER TELEPHONE COMPANY.  Over the years this 
company has taken on various names as a result of its mergers and 
to reflect its current focus:

      1920     COMMONWEALTH TELEPHONE COMPANY
      1926     ASSOCIATED TELEPHONE UTILITIES COMPANY
      1935     GENERAL TELEPHONE CORPORATION
      1959     GENERAL TELEPHONE & ELECTRONICS CORPORATION
      1982     GTE CORPORATION

Write a program to print the name of the organization in a given 
year from 1918 to 1992.  Examples:

     INPUT: Enter year: 1950
    OUTPUT: GENERAL TELEPHONE CORPORATION

     INPUT: Enter year: 1982
    OUTPUT: GTE CORPORATION



1.3  In 1990, GTE ranked 13th in the Forbes Super 50 1990 list of 
companies.  The list ranks the biggest U.S. companies on a 
composite of revenue, net income, assets and market value.  The 
following year GTE ranked 7th in the Forbes Super 50 1991 list of 
companies, rising up 6 places.  Write a program to display a 
company's projected 1992 ranking after accepting a company's rank 
for 1991 and the number of places the company rises the following 
year.  Examples:

     INPUT: Enter 1991 rank: 40
            Enter number of places: 8

    OUTPUT: 32


     INPUT: Enter 1991 rank: 21
            Enter number of places: 13

    OUTPUT: 8


1.4  GTE is the largest U.S.-based local-telephone company, with 
more than 20.2 million access lines, and the second largest 
cellular-mobile company.  Its consolidated revenues and sales from 
continuing operations for 1991 totaled $19.6 billion with a 
consolidated net income of $1.8 billion.  GTE's world headquarters 
is located in Stamford, Connecticut.  The corporation employs 
approximately 160,000 people in various telephone and 
manufacturing operations in 48 states and 41 countries.  GTE 
consists of the following operations:

GTE TELEPHONE OPERATIONS
GTE GOVERNMENT SYSTEMS
GTE MOBILE COMMUNICATIONS
GTE INFORMATION SERVICES
GTE SPACENET
GTE AIRFONE

Write a program to indent each GTE operation a specified number of 
spaces more than the previously displayed operation.  The first 
line displayed is not to be indented.  Example:

     INPUT: Enter number of spaces: 2

    OUTPUT: GTE TELEPHONE OPERATIONS
              GTE GOVERNMENT SYSTEMS
                GTE MOBILE COMMUNICATIONS
                  GTE INFORMATION SERVICES
                    GTE SPACENET
                      GTE AIRFONE


1.5  GTE Data Services is a wholly owned subsidiary of GTE 
Corporation based in Stamford, Connecticut.  GTEDS is one of the 
largest software development and information processing service 
companies in the United States, using 15 large mainframes to 
support approximately 125 major software systems.  With corporate 
headquarters in Temple Terrace, Florida (next to Tampa), GTEDS is 
a part of GTE's Telephone Operations Group.  More than 2,600 
employees are located in the Tampa area, while approximately 5,000 
are employed at four regional processing centers in the United 
States.  The company was formed in October 1967 to provide 
information management and systems development services to 
customers nationwide.  Since that time GTE Data Services has been 
providing low-cost, high-quality data processing, office 
automation and internal telecommunications product and services to 
GTE telephone operations in the United States, Canada and the 
Dominican Republic.  Don A. Hayes was appointed president of GTE 
Data Services in July of 1988.  Write a program to input a month 
and a year (of the form MM, YYYY) and display the number of WHOLE 
YEARS GTEDS has been operating.  Examples:

     INPUT: Enter M, Y: 5, 1992       INPUT: Enter M, Y: 10, 1987
 
    OUTPUT: 24 YEARS                 OUTPUT: 20 YEARS


1.6  Write a program to center a person's title and last name 
within a box of asterisks with dimensions 24 by 5.  Input will be 
given on two separate lines, but both the title and the name must 
appear centered on the same line separated by one space.  If one 
side must have one extra space, it must appear on the right side. 
 Examples:

     INPUT: Enter title: COMMISSIONER
            Enter name: CASTOR

    OUTPUT: ************************
            *                      *
            * COMMISSIONER CASTOR  *
            *                      *
            ************************

     INPUT: Enter title: PRESIDENT
            Enter name: HAYES

    OUTPUT: ************************
            *                      *
            *   PRESIDENT HAYES    *
            *                      *
            ************************


1.7  GTE Data Services selects qualified candidates to participate 
in the Information Systems Orientation Program (ISOP).  Selection 
is made from all individuals whose current position is at least a 
Salary Grade Level 5 and who have the potential and desire to 
occupy at least the positions of Systems Supervisor and Systems 
Manager.  Write a program to accept the NAME of a selected 
candidate, their TITLE, and the GROUP that they represent, and 
then display the information in the form of a four-line statement 
as illustrated below.  Examples:

     INPUT: Enter name: SCOTT
            Enter title: PROJECT LEADER
            Enter group: SERVICE ORDER DEVELOPMENT

    OUTPUT: SCOTT IS A PROJECT LEADER WITHIN THE
            SERVICE ORDER DEVELOPMENT GROUP AND
            HAS BEEN SELECTED TO PARTICIPATE IN
            THE ISOP.


     INPUT: Enter name: RICK
            Enter title: PROJECT LEADER
            Enter group: CONVERSION

    OUTPUT: RICK IS A PROJECT LEADER WITHIN THE
            CONVERSION GROUP AND
            HAS BEEN SELECTED TO PARTICIPATE IN 
            THE ISOP.


1.8  One of the many benefits of working at GTEDS is the Personal 
Computer Purchase Program which allows employees to buy a personal 
computer through interest-free payroll deductions.  At most 
$2000.00 may be borrowed.  Write a program to display the dollar 
amount to be borrowed (preceded by a "$"), given the cost of the 
computer in dollars (without the dollar sign).  Examples:

     INPUT: Enter amount: 1255.70    INPUT: Enter amount: 2543.23
    OUTPUT: $1255.70                OUTPUT: $2000.00


1.9  Debra, Lori, Sherry, Sue, and Tom all occupy the position of 
BIA (Business Information Analyst) in the SERVICE ORDER/TREATMENT 
Sub-application groups within CBSS at GTEDS.  BIAs are 
knowledgeable in both the Telephone Operations business functions 
and the support of Data Processing systems.  Write a program for 
the BIAs to display an acronym for a given set of business words 
separated by a space.  The acronym is formed by concatenating the 
first letter of each word entered.  Examples:

     INPUT: Enter words: BUSINESS INFORMATION ANALYST
    OUTPUT: BIA

 
     INPUT: Enter words: CUSTOMER BILLING SERVICES SYSTEM
    OUTPUT: CBSS


1.10  "Quality begins with U" is Scott's slogan for the SERVICE 
ORDER/TREATMENT SUPPORT group that he is supervising.  His vision 
is to establish easy procedures for the technicians to follow 
enabling them to fit "quality" into their busy work schedule at 
GTEDS.  One way in which Scott is implementing "quality" is by 
allowing all the technicians to meet together on a daily basis to 
enlighten one another about their critical day-to-day maintenance 
activities and how they responded to achieve a solution.  These 
meetings help new technicians learn quicker and standardizes the 
way work is done by hearing how some of the more experienced 
programmers solve problems.  Write a program to determine how many 
HOURS and MINUTES are devoted to implementing "quality" after 1 
year (50 weeks) if N technicians meet 5 days a week for M minutes, 
given that N and M are input as positive integers.  Examples:

     INPUT: Enter number of technicians, N: 10
            Enter number of minutes, M: 15

    OUTPUT: 625 HOURS 0 MINUTES


     INPUT: Enter number of technicians, N: 7
            Enter number of minutes, M: 5

    OUTPUT: 145 HOURS 50 MINUTES



2.1  Write a program to display several input lines of a speech in 
an indented outline format.  The last line entered will be 
followed by a blank line.  Each line that begins with a Roman 
numeral (I, II, III, IV) is displayed without any indentation.  
Each line that begins with a letter (A through H) is indented 4 
spaces.  Each line that begins with a number (1 through 9) is 
indented 8 spaces.  Example:

     INPUT: Enter line: I. THE CROSS
            Enter line: A. HISTORY
            Enter line: 1. THE PERSIANS
            Enter line: 2. THE CARTHEAGANS
            Enter line: 3. THE ROMANS
            Enter line: B. MEDICAL PERSPECTIVE
            Enter line: C. HIS PERSONAL SUFFERING
            Enter line: II. THE LAST 7 STATEMENTS
            Enter line: III. 3 DAYS LATER
            Enter line: (press the return key)

    OUTPUT: I. THE CROSS
                A. HISTORICAL PERSPECTIVE
                    1. THE PERSIANS
                    2. THE CARTHEAGANS
                    3. THE ROMANS
                B. MEDICAL PERSPECTIVE
                C. HIS PERSONAL SUFFERING
            II. THE LAST 7 STATEMENTS
            III. 3 DAYS LATER



2.2  Bob is the project leader for the REPORTS SUPPORT group 
within CBSS.  The Customer Billing Services System utilizes a 
utility called the REPORT FORMATTER GENERATOR (RFG) to create its 
reports.  The RFG is a table driven utility which processes one to 
an infinite number of reports from a singe job-step.  Write a 
program to display in words, the number of reports that the CBSS 
Director, Mick, is requesting.  Input will be any integer between 
1 and 99, inclusive.  Examples:

     INPUT: Enter number: 25
    OUTPUT: TWENTY-FIVE

     INPUT: Enter number: 91
    OUTPUT: NINETY-ONE

     INPUT: Enter number: 16
    OUTPUT: SIXTEEN
 
     INPUT: Enter number: 3
    OUTPUT: THREE



2.3  GTE Data Services hires talented college graduates into their 
New Recruit Development Program.  This is an intensive, innovative 
14 week training program designed to develop individuals in the 
state-of-the-art technologies of GTE Data Services.  Trainees will 
enter into the program as Programmers - New Recruit Associates and 
take part in lectures, lab session, and on-line training exercises 
in the areas of:  COBOL, CICS, JCL, MVS/XA, VSAM Files, TSO/ISPF, 
C, Case Tools, DB2/SQL, Telecommunications, and Database Concepts. 
Recruiters generally hire those individuals with a BA/BS or higher 
degree in Computer Science, Math, Business, Engineering, 
Management Information Systems or Computer Information Systems.  
Other considerations are also reviewed as shown below.  Write a 
program to accept as input the name of a potential recruit and 
his/her degree, and then display a menu of 7 other considerations 
as shown below.  The computer then prompts the user to select up 
to 7 of the items listed (as a "string" in any order).  Next, the 
computer is to clear the screen and display the name of the 
recruit followed by his/her degree followed by all the other 
considerations selected.  Considerations are to be separated by a 
blank line and renumbered consecutively in the order they appear 
within the menu.  Example:

     INPUT: Enter name: DOUG
            Enter degree: BS IN COMPUTER SCIENCE

    OUTPUT: 1. DEMONSTRATED INTEREST IN INFORMATION MANAGEMENT.
            2. DEMONSTRATED LEADERSHIP SKILLS.
            3. STRONG GPA/PERFORMANCE HISTORY.
            4. AT LEAST TWO COURSES IN ANY PROGRAMMING LANGUAGE.
            5. INTERNSHIP OR WORK EXPERIENCE.
            6. EFFECTIVE ORAL AND WRITTEN COMMUNICATION SKILLS.
            7. CAREER DEVELOPMENT POTENTIAL.

     INPUT: Select up to 7 items: 17265

    OUTPUT: (screen is cleared)
            DOUG
            BS IN COMPUTER SCIENCE
  
            1. DEMONSTRATED INTEREST IN INFORMATION MANAGEMENT.

            2. DEMONSTRATED LEADERSHIP SKILLS.

            3. INTERNSHIP OR WORK EXPERIENCE.

            4. EFFECTIVE ORAL AND WRITTEN COMMUNICATION SKILLS.

            5. CAREER DEVELOPMENT POTENTIAL.



2.4  Shelley has served as president of the Toastmasters Club at 
GTE Data Services.  Each week the club meets to provide its 
members with a friendly atmosphere in which they can present 
effective speeches that inform, persuade, inspire, and entertain. 
 Each meeting includes open evaluation, in which the speaker 
learns the audience's reaction to his or her presentation.  One 
person is assigned the task of formally evaluating another 
person's speech.  The speech is judged in regards to seven 
categories: speech value (interesting, meaningful), preparation 
(research, rehearsal), manner (direct, confident, sincere), 
organization (purposeful, clear), opening (attention-getting, led 
into topic), body of speech (logical flow; ideas supported by 
facts), and conclusion (effective, climatic).  Write a program to 
accept an evaluator's verbal rating for the seven categories and 
to output the numerical value of each category, the average 
numerical rating (rounded to the nearest tenth), and the overall 
verbal rating, given the following rating scale:

                         1 = EXCELLENT
                         2 = ABOVE AVERAGE
                         3 = SATISFACTORY
                         4 = SHOULD IMPROVE
                         5 = MUST IMPROVE

The program then must display the equivalent overall verbal rating 
after rounding the displayed average numerical rating to the 
nearest whole number.  Examples:

     INPUT: Enter rating for speech value: ABOVE AVERAGE
            Enter rating for preparation: ABOVE AVERAGE
            Enter rating for manner: SHOULD IMPROVE
            Enter rating for organization: SATISFACTORY
            Enter rating for opening: MUST IMPROVE
            Enter rating for body of speech: ABOVE AVERAGE
            Enter rating for conclusion: EXCELLENT

    OUTPUT: SPEECH VALUE: 2
            PREPARATION: 2
            MANNER: 4
            ORGANIZATION: 3
            OPENING: 5
            BODY OF SPEECH: 2
            CONCLUSION: 1

            AVERAGE NUMERICAL RATING = 2.7
            SPEECH RATING = SATISFACTORY



2.5  Write a program to display GTEDS MISSION statement formatted 
with at most N characters per line, where N is input as a number 
between 20 and 40 inclusive.  Words in the following statement end 
with a space, dash, or period:  "Be the customer-oriented leader 
and provider-of-choice of quality information products and 
services in the telecommunications marketplace and selected other 
related markets in support of GTE'S TELOPS goals."   The last word 
displayed on a line may end with a dash.  Example:

     INPUT: Enter N: 28

    OUTPUT: BE THE CUSTOMER-ORIENTED
            LEADER AND PROVIDER-OF-
            CHOICE OF QUALITY
            INFORMATION PRODUCTS AND
            SERVICES IN THE
            TELECOMMUNICATIONS
            MARKETPLACE AND SELECTED
            OTHER RELATED MARKETS IN
            SUPPORT OF GTE'S TELOPS
            GOALS.



2.6  Write a program to enter a paragraph with no commas, and 
change all periods to question marks if the sentence begins with 
WHAT, WHY, HOW, WHO, or WHERE.  All sentences end with one of 
three characters: period (.), question mark (?), or exclamation 
point (!).  Note: Input will be at most 125 characters; Output 
does not need to be formatted and may wrap around the end of the 
screen to the next line.  Example:

     INPUT: Enter paragraph: WHAT IS TODAY'S DATE.  MAY 2ND.  
WHERE ARE WE.  IN TAMPA.  WHY ARE WE HERE!  WHOM ARE YOU.  IS THIS 
FUN OR WHAT.

    OUTPUT: WHAT IS TODAY'S DATE?  MAY 2ND.  WHERE ARE WE?  IN 
TAMPA.  WHY ARE WE HERE!  WHOM ARE YOU.  IS THIS FUN OR WHAT.



2.7  Employees at GTEDS usually spend their time either in 
development work or in support work.  Development builds a new 
system or adds new features to an existing system.  Support, or 
maintenance, fixes functionality that currently is producing 
undesired results.  Dan is the project leader for the SERVICE 
ORDER/TREATMENT SUPPORT sub-application group within CBSS at 
GTEDS. In order to respond promptly to the customers' needs, a 
beeper is carried by one person in the support group at all times. 
The primary beeper person is responsible for providing support to 
the customer and is the customer's primary contact for emergency 
situations.  Write a program to display an alphabetical listing of 
all the employees that are in the office at a given time when the 
beeper "goes off".  If no one is in the office at the given time, 
then display: NONE.  Since the employees are on "flex time", their 
schedules may differ among themselves but will be consistent on a 
day to day basis.   The following is a list of support personnel 
and their core hours (24-hour clock time), Monday through Friday 
unless otherwise indicated by a day off:

               David        0700 - 1600
               Don          0800 - 1700
               Doug         0730 - 1630
               Grandville   1230 - 2100
               James        1130 - 2200  off on Monday
               Jim          0900 - 1800
               John         0700 - 1600
               Linda        1230 - 2300  off on Friday
               Marie        0700 - 1600
               Matt         1230 - 2300  off on Monday
               Paula        0700 - 1600
               Robert       0800 - 1700
               Shelley      0630 - 1530
               Tom          1100 - 1930 

Examples:

     INPUT: Enter time: 0730
            Enter day: FRIDAY

    OUTPUT: DAVID, DOUG, JOHN, MARIE, PAULA, SHELLEY



     INPUT: Enter time: 1930
            Enter day: MONDAY

    OUTPUT: GRANDVILLE, LINDA, TOM



     INPUT: Enter time: 1230          INPUT: Enter time: 0650
            Enter day: SUNDAY                Enter day: THURSDAY

    OUTPUT: NONE                     OUTPUT: SHELLEY


2.8  Anita is the Supervisor of the TREATMENT DEVELOPMENT 
sub-application within the Customer Billing Services System (CBSS) 
at GTEDS.  To insure the development of a high-quality product, 
Anita asks her project leader, Val, to conduct a formal inspection 
of their work, in accordance with company procedures.  A formal 
inspection is a "rigorous structured review of a product to find 
defects."  Val has designated that five of her co-workers will 
function as inspectors.  Each inspector is assigned one of five 
titles and performs its function accordingly: moderator, reader, 
recorder, author, and inspector.  The MODERATOR leads and guides 
the inspection.  The READER sets the pace and paraphrases the 
material.  The RECORDER lists the defects as they are detected.  
The AUTHOR provides clarification and explanation of the material 
when requested.  Although everyone participates as an inspector, 
one person has the title of INSPECTOR.  The seven co-workers that 
Val can choose from are Darlene, Jeff, Liz, Lori, Mary, Ping, and 
Will.  Only Darlene and Will may function as a moderator.  If 
Darlene or Will is the author, then the other person serves as the 
moderator; otherwise, there is a 50% chance that Val will select 
either person to serve as the moderator.  The positions of reader, 
recorder, and inspector are chosen randomly (with equal 
probability) from among the remaining five co-workers.  Write a 
program to simulate Val's selections for her inspection team given 
that one of the seven co-workers is input as the author.  The 
following are POSSIBLE examples:

     INPUT: Enter author's name: WILL

    OUTPUT: AUTHOR - WILL
            MODERATOR - DARLENE
            READER - LIZ
            RECORDER - JEFF
            INSPECTOR - LORI


     INPUT: Enter author's name: WILL

    OUTPUT: AUTHOR - WILL
            MODERATOR - DARLENE
            READER - JEFF
            RECORDER - LIZ
            INSPECTOR - PING


     INPUT: Enter author's name: MARY

    OUTPUT: AUTHOR - MARY
            MODERATOR - WILL
            READER - JEFF
            RECORDER - DARLENE
            INSPECTOR - PING



2.9  The Customer Billing Services System (CBSS) was developed at 
GTE Data Services during a five year period from 1986 to 1990. 
With the help and commitment of GTE Telephone Operations, this 
tremendously complex billing system, consisting of approximately 5 
million lines of code, was first installed in the summer of 1990 
in Bethel, Pennsylvania.  GTE was the first company in the 
telephony industry to introduce a new billing system that provides 
the extensive bill format and pricing flexibility.  GTEDS is in 
the process of converting from the previous billing system, CRB, 
and the TOLL message system.  These two large systems are 
converted to CBSS by the CONVERSION SYSTEM group under Bonnie's 
supervision.  This group supports the conversion process to ensure 
the quality of data movement from the old systems to the new CBSS. 
 The CONVERSION SYSTEM group, has been responsible for converting 
customer telephone numbers when an area code splits due to various 
reasons, such as an increase in population.  Some telephone 
numbers remain the same while other telephone numbers take on a 
new area code.  Write a program to enter two 3-digit area code 
numbers from a split, the number of names to be entered, and a 
list of names in the CONVERSION SYSTEM group that will be assigned 
to one of these two areas.  After sorting the list of names 
alphabetically, the program will fictitiously assign the first 
half of the names to the smaller area code number and the last 
half to the larger area code number.  If there is an odd number of 
people in the list, then the person in the middle of the list is 
assigned the smaller area code number.  Examples:  

     INPUT: Enter two area codes: 813, 811
            Enter number of names: 4
            Enter name: JENNIFER
            Enter name: JACKIE
            Enter name: BYRON
            Enter name: ESTHER

    OUTPUT: 811 - BYRON
            811 - ESTHER
            813 - JACKIE
            813 - JENNIFER


     INPUT: Enter two area codes: 305, 307
            Enter number of names: 5
            Enter name: MARCELLE
            Enter name: MIKE
            Enter name: THERESA
            Enter name: CHARLOTTE
            Enter name: RICK

    OUTPUT: 305 - CHARLOTTE
            305 - MARCELLE
            305 - MIKE
            307 - RICK
            307 - THERESA



2.10  Approximately 250 employees play in the GTE Data Services 
Golf League.  Each week two teams of two golfers plays nine-holes 
against each other on one of four courses in the Tampa area.  Tom, 
a supervisor for the REPORTS DEVELOPMENT sub-application in CBSS, 
is on the Rules Committee.  The committee has determined that each 
player's handicap shall be calculated using USGA rules.  A 
player's gross score is adjusted for handicap purposes by not 
counting any score over a triple bogey, (3 strokes over par).  A 
player's current handicap determines the number of double or 
triple bogeys allowed:  If the handicap is 9 or less, then the 
handicap indicates the number of scores that are limited to a 
double bogey (2 strokes over par), while the rest of the scores 
are limited to a bogey (1 stroke over par); otherwise, the scores 
are limited to a triple bogey for every handicap score over 9, and 
double bogeys for the rest of the scores.  A handicap of 4 allows 
four double bogeys and 5 single bogeys.  A handicap of 16 allows 7 
triple bogeys and 2 double bogeys.  The higher bogey limits are 
used up as they are needed from hole to hole.  The handicap for 
the round is calculated by subtracting the course rating (par 
total in this case) from the adjusted total score.  Write a 
program to display the adjusted score, the round handicap, and 
other statistics as shown below, given a golfer's current handicap 
(1 through 18) and gross scores for nine-holes of golf.  Use the 
following pars for the nine holes:

           Hole #:  1   2   3   4   5   6   7   8   9
           Par:     5   4   4   4   3   4   4   3   5
Examples:

     INPUT: Enter handicap: 11
            Enter gross scores: 6,7,4,10,4,5,7,6,4

    OUTPUT: HOLE #:   1   2   3   4   5   6   7   8   9
            PAR:      5   4   4   4   3   4   4   3   5
            GROSS:    6   7   4  10   4   5   7   6   4
            ADJUST:   6   7   4   7   4   5   6   5   4

            PAR TOTAL: 36
            GROSS TOTAL: 53
            ADJUST TOTAL: 48
            ROUND HANDICAP: 12


     INPUT: Enter handicap: 5
            Enter gross scores: 7,4,7,6,7,8,7,6,7

    OUTPUT: HOLE #:   1   2   3   4   5   6   7   8   9
            PAR:      5   4   4   4   3   4   4   3   5
            GROSS:    7   4   7   6   7   8   7   6   7
            ADJUST:   7   4   6   6   5   6   5   4   6

            PAR TOTAL: 36
            GROSS TOTAL: 59
            ADJUST TOTAL: 49
            ROUND HANDICAP: 13


3.1  Write a program to move a triangle, made up of the acronym 
GTEDS, around the screen using the keys I, J, K, and M to move the 
triangle up, left, right, and down respectively.  The triangle 
must initially appear in the approximate center of the screen.  
Once a valid directional key is pressed the triangle continuously 
shifts one column (or row) in the designated direction until 
either: 1) another valid directional key is pressed, causing the 
triangle to shift in another direction, or 2) the triangle's edge 
is about to go past the perimeter of the screen, in which case the 
triangle is to remain stationary until another directional key is 
pressed to send it away from (or along) the perimeter.  The 
following triangle is to be displayed:

                                  G
                                 T T
                                E   E
                               D     D
                              SDETGTEDS



3.2  Patricia is a wonderful manager over 5 sub-groups at CBSS.  
Each year she coordinates a Christmas party for her department 
that livens up the season.  This past year each person bought and 
wrapped a small gift to play in the "Chinese gift exchange".     
After Derril picked a gift, his desirable Far-Side calendar gift 
was taken from him.  Having been a biologist, he is knowledgeable 
of animal behavior and human behavior and able to enjoy the humor 
in interchanging animals with human roles.  Fortunately, Santa 
Claus had placed another 1992 Far-Side calendar in his stocking.  
His calendar contains 314 pages of hilarious animal illustrations, 
1 weekday of the year on each page with Saturdays and Sundays 
being combined on one page.  If Derril has read X hilarious pages 
and torn them from his calendar, write a program to determine what 
day(s) of the year now appear(s) on his desk calendar.      
January 1, 1992 was a Wednesday.  The program must display the day 
of the week, the month, and the day.  Examples:

     INPUT: Enter X: 5                INPUT: Enter X: 100

    OUTPUT: TUESDAY JANUARY 7        OUTPUT: MONDAY APRIL 27



     INPUT: Enter X: 309              INPUT: Enter X: 51

    OUTPUT: SATURDAY DECEMBER 26     OUTPUT: SATURDAY FEBRUARY 29
            SUNDAY DECEMBER 27               SUNDAY MARCH 1



3.3  Russ is the Supervisor of the SERVICE ORDER DEVELOPMENT sub-
application within CBSS at GTEDS.  His team uses the Programmer 
Work Station (PWS) to manage and coordinate enhancements made to 
their programs.  PWS allows team members to communicate among 
themselves about their changes to the code for a particular 
module.  After enhancements have been made in the TEST library 
environment of PWS, a request is made to release the changes to 
the BASE library environment, which will eventually be used in 
production.  Write a program to accept the name of a person on the 
Service Order Development team, the program being enhanced, a flag 
(Y/N) indicating that changes are complete, and a flag (Y/N) to 
request release.  If release is requested (Y), the computer will 
automatically mark the person's program as "completed", even if 
"N" was entered for this field. Release to base can only occur if 
everyone thus far has finished their enhancements on that program 
and at least one person has requested release.  When a module is 
properly released, display the message MODULE XXXX HAS BEEN 
RELEASED, where XXXX is the four character program name.  The 
program ends when all modules input have been released.  Each 
module will be RELEASED only once.  Examples:

     INPUT: Enter name, program: MIKE,TU03
            Enter completed, release: N,N

     INPUT: Enter name, program: PATRICK,TU03
            Enter completed, release: Y,Y

     INPUT: Enter name, program: MIKE,TU03
            Enter completed, release: Y,N

    OUTPUT: MODULE TU03 HAS BEEN RELEASED

 ------------------------------------------------
     INPUT: Enter name, program: LARRY,TU01
            Enter completed, release: Y,N

     INPUT: Enter name, program: DERRIL,TT00
            Enter completed, release: Y,N

     INPUT: Enter name, program: DERRIL,TU01
            Enter completed, release: Y,Y

    OUTPUT: MODULE TU01 HAS BEEN RELEASED

     INPUT: Enter name, program: DOUG,TT00
            Enter completed, release: N,N

     INPUT: Enter name, program: LARRY,TT00
            Enter completed, release: Y,Y

     INPUT: Enter name, program: DOUG,TT00
            Enter completed, release: Y,N

    OUTPUT: MODULE TT00 HAS BEEN RELEASED


3.4  A company would like to use an acronym as a phone number that 
is easy for the public to remember.  They would like a word that 
can be used for the last several digits of their number, where 
each letter corresponds to a particular digit.  Each possible word 
will be 4 or 5 letters long.  Write a program to display all 
possible acronym phone numbers (alphabetically by the acronyms 
used) for an input number of the format XXX-XXXX.  Assume that at 
least one word will satisfy the requirements given the following 
word list options:

  AGENT  SOAP   MONEY  JEWEL  BALL   LOANS  CARE   SAVE   CALL
  PAVE   KEEP   KINGS  KNIFE  KNOCK  JOINT  JUICE  LOBBY  RATE

Use the following letters to correspond to the digits 2 to 9:

  A B C   D E F   G H I   J K L   M N O   P R S   T U V   W X Y
    2       3       4       5       6       7       8       9

Examples:

        INPUT: Enter phone #: 555-3935

    OUTPUT: 55J-EWEL


     INPUT: Enter phone #: 555-2255

    OUTPUT: 555-BALL
            555-CALL




3.5  Write a program to display seven 7-digit squares which 
contain no duplicate digits in the octonary (base 8) system.  One 
such number is 1567204 because it is 1242 * 1242 in base 8.  
Output each 7-digit number followed by 2 spaces and its square 
root.  Display each successive entry on a separate line in 
ascending order.  The following example illustrates the format of 
the output, but it only gives the first solution.  Example:

     OUTPUT: 1567204  1242
             #######  ####
             #######  ####
             #######  ####
             #######  ####
             #######  ####
             #######  ####



3.6  GTE Data Services has a highly talented group of classroom 
instructors that equip qualified New Recruits with a wide range of 
skill sets necessary to succeed in the GTEDS environment.  The 
trainers in the program impart to their students not only 
technical skills, but personal insights into corporate life and 
the needed people-skills to succeed in the company.  In addition 
to teaching the Recruits a "right" way to solve programming 
problems, the instructors also lead them on a journey to discover 
a solution that is highly "efficient."  Write a program that is 
"efficient", given the following information:
 
Every integer, N, greater than 17 can be written as the sum of 
three distinct integers, each greater than 1, such as:

     X + Y + Z = N

where X, Y, and Z are pairwise relatively prime with respect to 
each other.  When N is equal to 20, there are six sets of integers 
that satisfy the equation:

     2+5+13,  2+7+11,  3+4+13,  3+7+10,  4+5+11,  4+7+9.

Notice that although 3+6+11 equals 20, the set does not satisfy 
the conditions since the numbers 3 and 6 have a common factor: 3.

Write an "efficient" program to generate the smallest combination 
of X, Y, and Z (with X as small as possible, then Y, then Z) that 
satisfies the equation for an input number, N, between 18 and 
32700.  Display the solution in the following format:

     X + Y + Z = N

with X < Y < Z.  Examples:

     INPUT: Enter N: 20
    OUTPUT: 2 + 5 + 13 = 20

     INPUT: Enter N: 184
    OUTPUT: 2 + 3 + 179 = 184

     INPUT: Enter N: 185
    OUTPUT: 3 + 19 + 163 = 185     
     
     INPUT: Enter N: 32693
    OUTPUT: 3 + 13 + 32677 = 32693

     INPUT: Enter N: 32694
    OUTPUT: 2 + 3 + 32689 = 32694



3.7  Doug and Dan have each served as the captain of the New 
Recruits indoor soccer team.  Four other GTEDS New Recruit 
employees have consistently play on the team: Andy, Jack, Mike, 
and Yehia.  No more than six players may play on the field at any 
time.  Substitutions may be made for any player at any time.  
Write a program to accept, as input, 1 to 3 extra players that 
come for the game, and then display all possible combinations of 
six players (listed alphabetically) that can play together.  
Display each list numbered and ordered alphabetically among the 
lists, assuming that the names are concatenated within the list.  
If the number of lines of lists exceeds the number of lines on the 
screen, then pause each screen of output, allowing a key to be 
pressed to display then next screen of output.  Examples:

     INPUT: Enter number of substitutes: 1
            Enter name: TONY

    OUTPUT: 1 ANDY,DAN,DOUG,JACK,MIKE,TONY
            2 ANDY,DAN,DOUG,JACK,MIKE,YEHIA
            3 ANDY,DAN,DOUG,JACK,TONY,YEHIA
            4 ANDY,DAN,DOUG,MIKE,TONY,YEHIA
            5 ANDY,DAN,JACK,MIKE,TONY,YEHIA
            6 ANDY,DOUG,JACK,MIKE,TONY,YEHIA
            7 DAN,DOUG,JACK,MIKE,TONY,YEHIA


     INPUT: Enter number of substitutes: 3
            Enter name: PAUL
            Enter name: DEAN
            Enter name: ROB

    OUTPUT: 1 ANDY,DAN,DEAN,DOUG,JACK,MIKE
            2 ANDY,DAN,DEAN,DOUG,JACK,PAUL
            3 ANDY,DAN,DEAN,DOUG,JACK,ROB
            4 ANDY,DAN,DEAN,DOUG,JACK,YEHIA
            5 ANDY,DAN,DEAN,DOUG,MIKE,PAUL
            6 ANDY,DAN,DEAN,DOUG,MIKE,ROB
            :
            :
            63 DAN,DEAN,DOUG,JACK,ROB,YEHIA
            64 DAN,DEAN,DOUG,MIKE,PAUL,ROB
            :
            :
            81 DEAN,DOUG,JACK,PAUL,ROB,YEHIA
            82 DEAN,DOUG,MIKE,PAUL,ROB,YEHIA
            83 DEAN,JACK,MIKE,PAUL,ROB,YEHIA
            84 DOUG,JACK,MIKE,PAUL,ROB,YEHIA


Note: lines 7 through 62 and lines 65 through 80 are not displayed 
in the example, but must appear within the actual output, allowing 
a key to be pressed after a screen full of lines has been 
displayed.



3.8  The Customer Billing Services System (CBSS) at GTEDS prints 
its customers' phone bills at different times to suit the 
customers' needs.  Bills are produced on one of 10 cycles, 
starting on the first of the month and occurring every 3 days 
afterwards: 1, 4, 7, 10, 13, 16, 19, 22, 25, 28.  The Bill Due 
Date is assigned to an account by adding a specified number of 
days to the account's Bill Date (the day the bill was produced).  
In many cases, if the due date falls on a Saturday, Sunday, or 
holiday, the system moves the due date to the next weekday that is 
not a holiday.  Write a program to display the BILL DATE and the 
DUE DATE given the following as input: the month of the bill in 
1992, the cycle number, the number of days (less than 25) to add 
to the Bill Date, and a set of holidays in the form MM, DD 
(terminated by 0, 0).  January 1, 1992 was a Wednesday.  Examples:

     INPUT: Enter month of bill: 1
            Enter cycle number: 6
            Enter number of days: 15
            Enter holiday MM, DD: 1, 1
            Enter holiday MM, DD: 1, 31
            Enter holiday MM, DD: 0, 0
 
    OUTPUT: BILL DATE: THURSDAY JANUARY 16
            DUE DATE: MONDAY FEBRUARY 3


     INPUT: Enter month of bill: 5
            Enter cycle number: 1
            Enter number of days: 24
            Enter holiday MM, DD: 5, 25
            Enter holiday MM, DD: 0, 0
    
    OUTPUT: BILL DATE: FRIDAY MAY 1
            DUE DATE: TUESDAY MAY 26



3.9  GTE Data Services is located in four large information 
processing centers in Temple Terrace, Florida; San Angelo, Texas; 
Sacramento, California; and Fort Wayne, Indiana.  GTEDS employs 
over 5,000 data processing, software, and network professionals 
within the buildings located in the four areas.  The buildings 
have many different rooms and cubicles.  Write a program to 
calculate the area of a room in the shape of a polygon with 
perpendicular corners, given a series of movements describing its 
shape.  After the program accepts the number of vertical and 
horizontal sides in the room, it then accepts a list of successive 
direction-distance pairs, starting from an arbitrary corner.  
Directions will be U, D, R, and L to indicate Up, Down, Right, and 
Left respectively.  Each direction will be followed by a distance 
in feet, less than 25.  Each room described will have at most 10 
corners and will have both a length and a width less than 25 feet. 
 The first example uses a polygon room with the shape and 
dimensions of:

                                24            
                    ************************  
                    *                      *  
                  4 *                      *  
                    ********               * 7
                       8   *               *  
                         3 *               *  
                           *****************  
                                  16          

Examples:

     INPUT: Enter number of sides: 6
            Enter movement: U3
            Enter movement: L8 
            Enter movement: U4
            Enter movement: R24
            Enter movement: D7 
            Enter movement: L16

    OUTPUT: AREA = 144 SQUARE FEET


     INPUT: Enter number of sides: 10
            Enter movement: R8
            Enter movement: U2
            Enter movement: R6
            Enter movement: D10
            Enter movement: L10
            Enter movement: U3
            Enter movement: L9
            Enter movement: U7
            Enter movement: R5
            Enter movement: D2
 
    OUTPUT: AREA = 147 SQUARE FEET


3.10  The Rubik's Cube, invented by the Hungarian Erno Rubik in 
1975, is a three by three by three inch cube.  A cube has six 
sides or faces which contain a different color.  Each face is 
divided up into nine squares--a total of 54 squares on the cube.  
A brilliant inner mechanism of a spring loaded spindle allows 
sides of the cube to be rotated either vertically or horizontally 
and independent of the other sides.  In the cube's pristine 
condition it has a solid color on each face, but is scrambled by 
just a few random moves.  The cube comes in six different colors, 
of which, the original Rubik's Cube contains: white, yellow, 
orange, red, green, and blue.  The object is to get the cube back 
to its original positions so that all six sides have nine 
identical squares with respect to their colors.  If the cube is 
taken apart and randomly reassembled, then there is only a 1 in 12 
chance that the puzzle can be solved.  An almost sure way to make 
the cube impossible to solve is to remove the 54 square colors and 
randomly place them back on the squares of the cube.

Write a program to accept as input, 6 sides of 9 square color 
symbols for the Rubik's Cube, and to then determine the reasons 
for judging the cube as insolvable, as given on the next page.   
One letter color symbols (W, Y, O, R, G, B) will be entered from 
left to right, top to bottom, for the following sides (in order): 
top, front, right, back, left, bottom.  The order of input is 
illustrated below by numbers for each side of the cube:

   +-------+        The sides of this cube are connected as shown.
   | 1 2 3 |        The TOP side "1 2 3" is joined to the BACK
 T |       |        side "1 2 3".  The LEFT side "3 6 9" is joined
 o | 4 5 6 |        to the FRONT side "1 4 7".  The BOTTOM side
 p |       |        "7 8 9" is joined to the BACK side "7 8 9".
   | 7 8 9 |
   +-------+
   +-------++-------++-------++-------+
 F | 1 2 3 || 1 2 3 || 1 2 3 || 1 2 3 |
 r |       ||       ||       ||       |
 o | 4 5 6 || 4 5 6 || 4 5 6 || 4 5 6 |
 n |       ||       ||       ||       |
 t | 7 8 9 || 7 8 9 || 7 8 9 || 7 8 9 |
   +-------++-------++-------++-------+
   +-------+  Right    Back       Left
 B | 1 2 3 |
 o |       |        The cube has 12 edge pieces made up of 2
 t | 4 5 6 |        adjacent squares in positions 2,4,6,8.
 t |       |        There are 8 corner pieces made up of 3
 o | 7 8 9 |        adjacent squares in positions 1,3,7,9.
 m +-------+        There are 6 middle pieces in position 5.


            *** CONTINUED ON NEXT PAGE ***


After the program accepts the color symbols on the six sides, then 
display one or two of the following statements (in order), with 
the first statement displayed conditionally:

     If two of the middle squares have the same color, display:

         COLORS ON MIDDLE SQUARES ARE NOT UNIQUE


     Display the following message on the next (or first) line:

         NUMBER OF EDGE PIECES HAVING SAME COLOR: ##

     where ## is a number between 0 and 12.


Examples:

     INPUT: Enter colors on top:    R,G,R,O,W,B,W,B,Y
            Enter colors on front:  G,O,O,R,Y,G,B,W,B
            Enter colors on right:  W,G,Y,W,O,B,Y,O,R
            Enter colors on back:   W,G,B,Y,R,Y,G,R,G
            Enter colors on left:   Y,O,G,W,R,B,B,O,R
            Enter colors on bottom: G,W,O,Y,B,R,O,Y,W

    OUTPUT: COLORS ON MIDDLE SQUARES ARE NOT UNIQUE
            NUMBER OF EDGE PIECES HAVING SAME COLOR: 3


Note: Edge "Back 2" and Edge "Top 2" have same color: G
      Edge "Front 4" and Edge "Left 2" have same color: O
      Edge "Front 8" and Edge "Bottom 2" have same color: W



     INPUT: Enter colors on top:    B,R,G,B,W,G,Y,B,R
             Enter colors on front: W,G,B,W,O,Y,G,R,R
            Enter colors on right:  W,R,W,Y,G,O,Y,W,B
            Enter colors on back:   O,B,R,G,R,O,O,W,B
            Enter colors on left:   G,O,O,Y,Y,G,Y,O,R
            Enter colors on bottom: W,Y,B,R,B,Y,O,W,G

    OUTPUT: NUMBER OF EDGE PIECES HAVING SAME COLOR: 2


Note: Edge "Front 6" and Edge "Right 4" have same color: Y
      Edge "Bottom 8" and Edge "Back 8" have same color: W