Question: A. Write a java program that do the following: Create a class named GymMembership that consists of the following: - Three instance data members of
A. Write a java program that do the following: Create a class named GymMembership that consists of the following: - Three instance data members of private access modifier: memberId: represents the id of the member and its data type is integer. membershipType: represents the display type of the membership and its data type is string. totalFee: represents the cost that members pay and its data type is double. - One static data member of public access modifier: membersCounter: keeps track of the number of member's objects that are created from the GymMembership class. Its type is integer. - Member methods as follows: 1. Default constructor to initialize the memberId to zero, membershipType to empty string, and the totalFee to zero. 2. Parameterized constructor that receives values for the following data members (totalFee, membershipType, and totalFee), then it sets the received values in the class data members. 3. Create a method named setTotalFee that sets a value in the totalFee data member. Be sure that the value is nonnegative. 4. Create a method named get MemberId that returns the value of the memberId. 5. Create a method named isExpensive that returns true if the total fee is more than or equals to 300JD, and returns false otherwise. 6. Create a method named calculateFee that returns the annual cost required for the membership according to the following: - If you only enroll for a month (Monthly), the fee to pay is 45 JD. - If you want a single yearly payment (Annually), the fees to pay is 35 ]D per month. [Hint: = TotalFee = cost per month*number of months] 7. Create a method named showMembershipDetails that prints the values of the data members in the following format
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
