Elementary Division 1992

1. LETTER HOME
You are away at summer camp and you have run out of money.  You 
plan to write a letter home to ask for more.  Everyone else a camp is in 
the same situation.  Since you are learning how to program a 
computer, you decide to write a program that will generate a letter that 
anyone in your situation can use.
The contents of the letter is up to you but it must include certain pieces 
of information that are supplied by the user of the program.  The 
information is underlined in the following sample letter which you 
may use.

DEAR MOM AND DAD,
THE $15.00 YOU GAVE ME FOR SPENDING MONEY AT CAMP 
IS GONE. I SPENT MOST OF IT ON SNACKS. DO YOU THINK 
YOU COULD SEND AN EXTRA $5.00?   THINKING OF YOU 
OFTEN.
     LOVE, KAREN

Write a program that asks for all the underlined information and 
prints out a letter home.  It is not important that your letter look 
exactly like this one, but it  must contain the same information.


2. SECOND THOUGHTS
Write a program that will compute how long a person sleeps at night 
in seconds.  Assume that the person goes to bed between noon and 
midnight and gets up between midnight and noon. The computer 
should ask you to enter the time when you go to bed and the time when 
you wake up:  hours, minutes, and seconds.

Run your program with a bed time of 10,45,32 (h,m,s) and a wake up 
time of 7,34,47 (h,m,s). Run it again with a bed time of 2,00,00 and a 
wake up time of 12,01,01.

Sample Run
WHAT TIME DID YOU GO TO BED    (HOURS, MINUTES, 
SECONDS)
10, 45, 32

WHAT TIME DID YOU GET UP?         (HOURS, MINUTES, 
SECONDS)
7,34,47

YOU SLEPT FOR 31755 SECONDS.





3. STAR TRACKS
Write a program that will produce the following design.

          *
         * *
        * * *
       * * * *
      * * * * *

Write the program using only one *.  

Making A$ ="*" and using A$ more than once is also not allowed.



4. EGG TOSS
You and your partner decide to enter an egg toss contest.  You toss an 
egg back and forth trying to keep it from breaking.  On each toss, the 
chances that the egg breaks is .2 (20% or 2 out of 10).  If you make 6 
good tosses before the egg breaks, then you win.
Write a program that simulates the egg toss contest.  Run the program 
until you get a win.  Print out wins and losses as follows:

Sample Run
GOOD   GOOD   GOOD   SPLAT!

Sample Run
GOOD   GOOD   GOOD   GOOD    GOOD   GOOD   YOU WIN!


5. WORTH OF WORDS
The value of a letter in the alphabet (A . . Z) is defined as the position 
of that letter in the alphabet.  Thus A = 1, B = 2, C = 3 and so on  with 
Z = 26.  The worth of a word is defined as the sum of the value of each 
letter in that word.  For example, the worth of the word CAB is 6.

Write a program that will accept a word as input and compute its 
worth.

Test your program with the words PRICELESS and WORTHLESS.

Sample Run
ENTER A WORD: PRICELESS

THE WORTH OF THE WORD
PRICELESS IS 106.


	ICPSC 1982
	Elementary Division Problems




