1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

My first algorithm assignment

  1. Oct 11, 2007 #1
    1. The problem statement, all variables and given/known data
    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.


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


    3. 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.
     
  2. jcsd
  3. Oct 11, 2007 #2

    dlgoff

    User Avatar
    Science Advisor
    Gold Member

    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.
     
  4. Oct 13, 2007 #3
    Oh yeah... I think I get it, now... Thank you, kindly.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: My first algorithm assignment
Loading...