Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Iterator;
- /**
- * Created by El_Diablo on 3/6/2016.
- * Class "Admin" creates the password and username for the administrator.
- * Administrator can later add Members.
- */
- public class Admin extends Person {
- public static int num = 0;
- private String password;
- private String username;
- /**
- * @param name
- * @param surname Constructor calls method "getNum" so every time an object is created, a static number is increased
- */
- Admin(String name, String surname) {
- super(name, surname);
- getNum();
- }
- /**
- * Constructor of Admin, calls the constructor of super class(Person) and passes the number of admin as an argument
- */
- Admin() {
- super("Administrator", getNum());
- }
- /**
- * method to get the number of created Admins
- */
- public static String getNum() {
- num++;
- return Integer.toString(num);
- }
- /**
- * @param username setter of username
- */
- public void setUsername(String username) {
- this.username = username;
- }
- /**
- * @param password setter of password
- */
- public void setPassword(String password) {
- this.password = password;
- }
- /**
- * getter of username
- */
- public String getUsername() {
- return username;
- }
- /**
- * getter of password
- */
- public String getPassword() {
- return password;
- }
- /**
- * Methods for creating Members in ArrayList. Each admin can add members to the same arraylist.
- */
- static ArrayList<Member> members = new ArrayList<Member>();
- /**
- * @param name
- * @param surname Method for filling an array list with members
- */
- public void newMembers(String name, String surname) {
- members.add(new Member(name, surname));
- }
- /**
- * Method to make pretty text
- */
- public String toString() {
- return "Name of the admin : " + this.getName() + '\n' + "Surname of the admin : "
- + this.getSurname() + '\n' + "Identification number : " + this.getId() + '\n';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement