Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 5 . Gym MembershipCreate a class called GymMembership that takes in the number of Gym Memberships and the type. Using a constructor, define two
Gym MembershipCreate a class called GymMembership that takes in the number of Gym Memberships and the type. Using a constructor, define two instance parameters num and gymtype. Assign the values of your parameters to two attributes number and type.Within this class add three methods with the following purpose:Determinerate finds the cost of the membership based on the type of membership the user wants. It will store this value in the attribute rate The "bronze" membership is dollars a month, the "silver" membership is dollars a month, the "gold" membership is dollars a month and the "platinum" is dollars a month.DetermineTotal uses the cost of one membership and multiplies it by the number of memberships. It will store this value in an attribute called total. At this gym, customers agree to a one year contract. Therefore the total is going to be for the year and not the month.ReturnTotal returns the total cost for the membership.Once you have created your class, create an object based on this class. Use s for the number of memberships and silver for the type of membership. Make sure you call your method to determine the rate BEFORE you call the method to determine the total. Utilize the Return Total method to print the total to
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started