Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a class ClubMembers that has three data members(String) Name, (String) ID

ID: 3610245 • Letter: C

Question

Create a class ClubMembers that has three data members(String) Name, (String) ID & (int) Age, and a constructor thattakes two parameters (Name, ID) and sets the specified datamembers. Include Setters and Getters for all data members.

Write a TestClubMember class (Driver class) to test your classcapabilities. Create 5 club members and for each member, ask themember to enter his/her Age: “Enter Age Name”.If the member is younger than 15 years old, simply reject him/herby printing: “Under Age or No permission”. Ifthe member is between 15-20, then the program must ask for apermission by printing a message: “Do you have apermission?” (Y means Yes and N means No permission). Ifthe member does not have a permission, then simply reject andprint: “Under Age or No permission”. If themember has a permission or is older than 20 years, then set thevalue of Age and welcome the new member by printing:“Welcome Name”.

[Note: You may add any necessary methods to your class ifneeded]

*** Use only JOptionPane methods for printing messages and inputdialogs:

- JOptionPane.showInputDialog("arg0");

- JOptionPane.showMessageDialog(null, "arg0") ;

Explanation / Answer

public class ClubMember{     String name;     int age;             public     ClubMember()     {}             public ClubMember(String name, int age){         this.name = name;         this.age = age;     }             public void setName(String name){         this.name = name;     }             public void setAge(int age){         this.age = age;     }             public String getName(){         return name;     }             public int getAge(){         return age;     } }     /*=======================================================*/ /*=======================================================*/ import java.io.*; import javax.swing.*; public class TestClubMember {     public static void main(String[] args){         ClubMember members[] = newClubMember[5];         String memberName;         int memberAge;         for(int i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote