Programming Exercises:

1.  Convert the following equation into C++ arithmetic expression statements:

  1. T=2π√lg
  2. F=Gm1m2r2
  3. x=-b+b2-4ac2a

2.  Fill in the blank in order to complete the sentences:

3.  List down all the actions if committed by a programmer will results in logic error?

  1. Logic error is a kind of error due to ______during ______phase in programming development lifecycle.
  2. There are three types of control structure in programming which are ______, ______and,______.
  3. Upon declaring a variable, ______with enough space (bytes )is allocated in the computer.
  4. A variable get it’s value either by an ______statement or using an ______statement.
  5. ______of a variable is important because it tells the computer exactly the memory should be allocated for a variable.

4.  Write an analysis, design and coding of the following problems:

  1. There is a pole in a lake. One-half of the pole is in the ground, another one-third of it is covered by water, and 10 ft is out of the water. What is the total length of the pole in ft then convert the answer into centimeter.
  2. Ann purchased a house for $ 127567. She wants to sell it for a profit of exactly 11%. However, she does not want to sell it herself. She wants a Real Estate Agent to sell it for her. The Agent must make a commission of exactly 5.6% (in addition to Ann's 11% profit). How much must the Agent sell the house for? Give your answer to the nearest MYR.
  3. A cylinder 48 cm high has a circumference of 16 cm. A string makes exactly 4 complete turns round the cylinder while its two ends touch the cylinder's top and bottom. How long is the string in cm?

Please submit to me on: Feb 10th 2011. Printed (hard copy). Put in the mailbox in front of my room at a1-09.