In: Computer Science
Write an algorithm to describe how to convert a user input from ounces to grams, drams and pounds. Use enough detail that you have between five and ten steps. List any assumptions.
a) Assumptions
b) Steps
Algorithm for
converting ounces to grams and pounds:
Start
num ounces
num grams
num pounds
Set grams=0
Set pounds=0
Set OUNCES_TO_GRAMS=28.3495
Set OUNCES_TO_POUNDS=0.0625
Print "Enter number of ounces"
Read ounces
Calculate
grams=ounces*OUNCES_TO_GRAMS
Calculate
pounds=ounces*OUNCES_TO_POUNDS
Print ounces , " ounces = ", grams,
"grams"
Prnt ounces , " ounces = ", pounds , "
pounds"
Stop
----------------------------------------------------------------------------------------------------------------
Flow-chart :