General.html

E 1.10

Write a program that prints an animal speaking a greeting, similar to the following (but different from)

 /\_/\        ------

( '  ' )    / Hello  \

(  -  )   

E 1.19

In the United States there is no federal sales tax, so every state may impose its own sales taxes. Look on the Internet for the sales tax charged in five U.S. states, then write a program that prints the tax rate for five states of your choice.

Example:

Sales Tax Rates

------------------------

 Alaska:        0%

 Hawaii:         4%

...

R 1.18

The ancient Babylonians had an algorithm for determining the square root of a number a. Start with an initial guess of a / 2. Then find the average of your guess g and a / g. That's your next guess. Repeat until two consecutive guesses are close enough. Write pseudocode for this algorithm.

P 1.8

Consider a robot that has been placed in a maze. The right-hand rule tells you how to escape from a maze: Always have the right hand next to a wall, and eventually you will find an exit.

The robot can do the following:

* Move forward by one unit

* Turn left or right

* Sense what is in front of it: a wall, an exit, or neither

Write an algorithm that lets the robot escape the maze. You may assume there is an exit that is reachable by the right-hand rule. You challenge is to deal with situations in which the path turns. The robot can't see turns. It can only see what is directly in front of it.