Sabado, Enero 26, 2013

PROGRAMMING: CONVERT LENGTH



Convert Length
This program converts measurements in feet and inches into centimeters using the formula that 1 inch is equal to 2.54 centimeters.  It uses the following steps to come up with the final code solution.
  1. Problem Analysis and Algorithm Design
  2. Declaring Variables
  3. Stating Named Constant
4.      Main Algorithm
  1. Putting it all together and producing final code
The main algorithm for this program is:
  1. Prompt the user for the input. (Without a prompt line, the user will stare at a blank screen and not know what to do.)
  2. Get feet.
  3. Prompt the user to enter a value for inches.
  4. Get inches.
  5. Echo the input—output what the program read as input. (Without this step, after the program has executed, you will not know what the input was.)
  6. Find the length in inches.
  7. Output the length in inches.
  8. Convert the length to centimeters.
  9. Output the length in centimeters.

Walang komento:

Mag-post ng isang Komento