Recently started learning ruby and I've created a class for family members that contains name, age, sex, marital status, and traits. I am trying to write a method that will determine if a family member is a parent and if whether or not its the mother or the father.
so the code for the method is as follows:
def is_father?(age, sex)
if age > 30
puts "is parent"
if sex == "Male"
then puts "is father"
else puts "not father"
end
end
end
And a family member might look like this:
fm1=Family.new("John", "Male", 54, "Married", "Annoying")
after being initialized like this:
class Family
def initialize(name, sex, age, status, trait)
@fam_name=name
@fam_sex=sex
@fam_age=age
@fam_stat=status
@fam_trait=trait
end
end
If a person contains the previously mentioned characteristics, how do I just pass age + sex into this method? Thanks in advance for your help