Skip to content

Instantly share code, notes, and snippets.

@arthurschreiber
Forked from anonymous/gist:5400
Created August 14, 2008 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arthurschreiber/5404 to your computer and use it in GitHub Desktop.
Save arthurschreiber/5404 to your computer and use it in GitHub Desktop.
class BmiRechner
def name
puts "Hallo wie ist ihr Name?"
@name = gets.chomp
puts "WIr werden jetzt herausfinden ob sie\n-zu dick\n-zu duenn\n-oder genau richtig sind."
end
def hallo
puts "Geben sie bitte ihr Gewicht."
@gewicht = gets.chomp
puts "Geben sie bitte ihre Groese in >>METERN<<(z.B 1.65 ein."
@groese = gets.chomp
puts "#{@name}, sie sind #{@groese} Groß und wiegen #{@gewicht}.\n Ist das richtig?\n"
puts "Bitte geben sie J oder N ein."
bestaetigung = gets.chomp
@bmi = @gewicht.to_i / (@groese.to_f ** 2)
if bestaetigung == "J"
puts "Gut. Ihr Bodymasindex betraegt #{@bmi}"
else
puts "Dan nochmal"
hallo()
end
if @bmi < 19
puts "o.0 Schnell zu Mc Donalds^^"
elsif @bmi < 25
puts "PERFEKT"
elsif @bmi < 30
puts "SCHNELL INS FITNESSTUDIO"
end
end
end
lol = BmiRechner.new
lol.name
lol.hallo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment