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

In summary, the conversation was about designing an algorithm that converts a user's height in feet and inches to meters, and their weight in pounds to kilograms. The individual was having trouble figuring out how to approach the problem and asked for help. The solution involved breaking down the problem into steps and writing the code accordingly.
  • #1
mikedot
2
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
  • #2
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.
 
  • #3
Oh yeah... I think I get it, now... Thank you, kindly.
 

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

1. What is an algorithm?

An algorithm is a set of instructions or steps used to solve a problem or complete a task. It is a fundamental concept in computer science and is used to design programs and applications.

2. How do I approach my first algorithm assignment?

Start by understanding the problem you are trying to solve. Break it down into smaller, more manageable steps and think about the logic and order in which these steps need to be executed. It can also be helpful to brainstorm and sketch out your ideas before writing any code.

3. Do I need to have prior coding experience to complete my first algorithm assignment?

No, prior coding experience is not necessary. However, having a basic understanding of coding concepts such as variables, loops, and conditional statements can be helpful in understanding and implementing algorithms.

4. How do I know if my algorithm is efficient?

One way to determine the efficiency of an algorithm is to analyze its time and space complexity. This refers to the amount of time and memory required for the algorithm to run. A more efficient algorithm will have a lower time and space complexity.

5. Can I collaborate with others on my first algorithm assignment?

It is best to check with your instructor or assignment guidelines to see if collaboration is allowed. In some cases, working with others can help you understand and improve your algorithm, but it is important to give credit to anyone who contributed to your work.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
12
Views
1K
Replies
8
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
11
Views
3K
  • Introductory Physics Homework Help
Replies
4
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
3K
Replies
4
Views
2K
Replies
2
Views
11K
  • Materials and Chemical Engineering
Replies
4
Views
4K
  • Calculus and Beyond Homework Help
Replies
1
Views
2K
  • Introductory Physics Homework Help
Replies
9
Views
2K
Back
Top