How Do I Design an Algorithm to Convert Height and Weight Measurements?

Click For Summary
SUMMARY

The discussion focuses on designing an algorithm to convert height from feet and inches to meters and weight from pounds to kilograms. The algorithm involves user input for height and weight, converting feet to inches, and applying the appropriate conversion factors: 1 foot equals 12 inches and 1 meter equals 39.37 inches. The user is guided to break down the problem into manageable steps, emphasizing the importance of defining variables and structuring the code correctly for clarity and functionality.

PREREQUISITES
  • Understanding of basic algorithm design principles
  • Knowledge of unit conversion factors (feet to meters, pounds to kilograms)
  • Familiarity with user input handling in programming
  • Basic programming skills for implementing algorithms
NEXT STEPS
  • Research the specific conversion formulas for height and weight: 1 foot = 0.3048 meters, 1 pound = 0.453592 kilograms
  • Learn about data types and variable declaration in your programming language of choice
  • Explore control structures (loops and conditionals) for handling user input
  • Study examples of algorithm breakdown and step-by-step coding practices
USEFUL FOR

This discussion is beneficial for students in computer science, particularly those taking introductory programming or algorithm design courses, as well as anyone looking to improve their skills in unit conversion and algorithmic thinking.

mikedot
Messages
2
Reaction score
0

Homework Statement


The assignment was to design an algorithm that asks for a user's height in feet and inches and their weight in pounds. The output of user's height and weight is suppose to be the user's height in meters and the user's weight in kilos. So I'm basically just suppose to convert those two things, which should be easy (and it probably is...). The problem is that I'm not sure how to write this all down.


Homework Equations


(Umm... I'm not sure what to add here... Is that ok?)


The Attempt at a Solution


Only thing I could think of for this was this:

Algorithm HeightWeightConvert

Calulate Feet in inches to Meters
1 Feet = 12 in.
1 Meter = 39.37 in.
User inputs 4 feet 3 in. then output 1 meter 8 inches...

...or something like that...

It's my first time designing an algorithm and I've very stumped on what to write down... like what variables I'm suppose to use... (And my converstion skills is pretty curdy, too.) I've talked to my proffessor about it, and he told it to me again. It seemed pretty striaght foward, but I still wasn't sure about it myself.

(I'm not sure if I posted this thread in the right section... This assignment is for my Computer Organization class which include topics on data representation within a computer, number systems, intrustion set, basic logical structures and operating systems.
 
Physics news on Phys.org
I can give you this much since I'm not a programmer.

Input height in feet and inches
convert feet to inches and add to input inches to get total inches.
multiply total inches by conversion factor to get meters
output meters.
(code for weight here)

You need to break the problem down in steps and write the code accordingly.
Hope this helps.
 
Oh yeah... I think I get it, now... Thank you, kindly.
 

Similar threads

  • · Replies 12 ·
Replies
12
Views
2K
Replies
8
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
Replies
1
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
2
Views
12K
Replies
4
Views
2K
Replies
3
Views
4K
Replies
1
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K