Here ya go
Profile.rb
class Profile
attr_reader :username, :height, :weight, :age, :activity_level,
:gender
@password #these field need never be read
@meta_calc_strategy # The means of calculating metabolic rate
@@male_gender = "Male"
@@female_gender = "Female"
@@max_activity_level = 5
#I have decided to implement a max_activity_level as I've noticed each
#scale for metabolic rate has its own definition of how active a
person can be.
#When making a Strategy for calculating metabolic rate, dividing the
#activity_level / max_activity_level will give you a percentage that
can be
#used to place a person within any specific class.
def initialize
puts 1
end
def username= (username)
@username = username
end
def password= (password)
@password = password
end
def weight= (weight)
@weight = weight
end
def height= (height)
@height = height
end
def age= (age)
@age = age
end
def activity_level= (a_l)
@activity_level = a_l
end
def gender= (gender)
@gender = gender
end
def meta_calc_strategy= (strategy)
@meta_calc_strategy = strategy
end
def get_target_calories
@meta_calc_strategy.get_target_calories
end
end
test123.rb
load "Profile.rb"
t = Profile.new
puts t.username
--
Posted via http://www.ruby-forum.com/.