SHARE
TWEET

asdsds

a guest Feb 26th, 2020 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. public class Club
  3. {
  4.     private String clubName;
  5.     private int numberOfMembers;
  6.     private String university;
  7.  
  8.     //Constructor to initialize all member variables
  9.     public Club()
  10.     {
  11.         clubName = "?";
  12.         university = "?";
  13.         numberOfMembers = 0;
  14.     }
  15.  
  16.     //Accessor methods
  17.     public String getClubName()
  18.     {
  19.         return clubName;
  20.     }
  21.  
  22.     public String getUniversity()
  23.     {
  24.         return university;
  25.     }
  26.  
  27.     public int getNumberOfMembers()
  28.     {
  29.         return numberOfMembers;
  30.     }
  31.  
  32.     //Mutator methods
  33.     public void setClubName(String someClubName)
  34.     {
  35.         clubName = someClubName;
  36.     }
  37.  
  38.     public void setUniversity(String someUniversity)
  39.     {
  40.         university = someUniversity;
  41.     }
  42.  
  43.     public void setNumberOfMembers(int someNumber)
  44.     {
  45.         numberOfMembers = someNumber;
  46.     }
  47.  
  48.     //toString() method returns a string containg its name, number of members, and university
  49.     public String toString()
  50.     {
  51.         String result = "\nsample.Club Name:\t\t" + clubName
  52.                 + "\nNumber Of Members:\t" + numberOfMembers
  53.                 + "\nUniversity:\t\t" + university
  54.                 + "\n\n";
  55.         return result;
  56.     }
  57. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top