-
-
Save arthurschreiber/5406 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BmiRechner | |
def initialize | |
self.get_name | |
puts "WIr werden jetzt herausfinden ob sie\n-zu dick\n-zu duenn\n-oder genau richtig sind." | |
end | |
def get_name | |
puts "Hallo wie ist ihr Name?" | |
@name = gets.chomp | |
end | |
def get_gewicht | |
puts "Geben sie bitte ihr Gewicht." | |
@gewicht = gets.chomp | |
end | |
def get_groesse | |
puts "Geben sie bitte ihre Groese in >>METERN<<(z.B 1.65 ein." | |
@groese = gets.chomp | |
end | |
def hallo | |
self.get_gewicht() | |
self.get_groesse() | |
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.hallo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment