Home‎ > ‎ICT Programming‎ > ‎

Gym Membership

Gym Member (Mastery Level)

A local fitness club needs to model the attributes and behaviors of their
club members. Write a class called Member

Include appropriate comments for each class element.

Here are the relevant attributes of a Member object. These must be the ONLY fields in your
class. All the attributes must be passed to the object constructor and initialized in the constructor.

· first name
· last name
· height (inches)
· weight (pounds)
· year of birth
· year of joining the club
· current year

Here are some of the behaviors of a Member object. Each of these is a method that returns the
specified information when it is invoked.

· getFullName returns the member’s full name, e.g. “Joe Smith”
· getHeightInches returns the member’s height
· getWeightPounds returns the member’s weight
· calculateYearsJoined returns the number of years the person has been a member
· calculateAge returns the calculated age of the member
· calculateAgeAtJoining returns the age the member was when they joined
· getsDiscount returns true if the member qualifies for a discount. 

People who qualify for a discount are either:

- under the age of 12 and members for at least two years
- at least 65 years of age
- members for at least 10 years

Helpful Resources

Video: more on if / else statements in BlueJ