Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A. Write a java program that do the following: Create a class named GymMembership that consists of the following: - Three instance data members of

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2016 Riva Del Garda Italy September 19 23 2016 Proceedings Part 1 Lnai 9851

Authors: Paolo Frasconi ,Niels Landwehr ,Giuseppe Manco ,Jilles Vreeken

1st Edition

3319461273, 978-3319461274

More Books

Students also viewed these Databases questions