[ Input-Output ] Statistics ] Computations ] Error trapping ] Functions ] Strings ] Filing ] Graphing ] Randomizing ] Sorting ]

 

 


Input-Output Exercises

1.  Write a program that will print out the numbers 1 through 20 along with their squares.  Make sure the user can tell which squared value goes with which number.

2.  Write a program for metric conversion.  The user enters a name, height (in inches), and weight (in pounds).  The program should display the entered values and their metric equivalents.  I looked up the equivalences to save you the trouble.  One inch = 2.54 centimeters, and one pound = 0.45 kilograms.

3.  Baseball pitchers take great pride in their earned-run-averages, which is what ERA stood for long ago.  This statistic reports the number of earned runs conceded by a pitcher in a nine-inning game.  However, very few pitchers actually pitch nine innings in one game nowadays.  Write a program that asks the user for the pitcher's name, number of innings pitched, and number of earned runs given up to date and reports the current ERA.

4.  Write a program that will display a birthday greeting on the screen.  The user will enter the recipient's name and age, and then the program will choose an appropriate message to print.  In creating the messages, you may break down the ages as finely as you care to.  You may also wish to use gender-specific messages, and in that case the program will need to ask the user for the gender of the recipient.  You might want to allow the user the option of signing the message.  Please be especially kind with any message that involves the age of 50.

5.  The state of Lincolnia levies a graduated income tax upon its residents.  Those with adjusted annual gross incomes under $10000 pay nothing, between $10000-$20000 pay 3%, $20001-$40000 pay 4%, $40001-$70000 pay 6%, $70001-$100000 pay 9%, and above $100000 pay $13%.  Write a program that tells a Lincolnian who enters name and income how much to pay.