/Users/johnr/Desktop/IA pdf Downloads/Criteria__P__-_Coding_Project_Upload_all_2022-05-03/IdanIA/src/idania/Objects/Client.java
  1 /*
  2  * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
  3  * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
  4  */
  5 package idania;
  6 
  7 /**
  8  *
  9  * @author Idan
 10  */
 11 public class Client {
 12     public int clientID;
 13     String firstName;
 14     String lastName;
 15     boolean isTeacher;
 16     boolean isStudent;
 17     int age;
 18     String emailAddress;
 19     String dateJoined;
 20 
 21     public Client(String firstName,
 22                   String lastName,
 23                   boolean isTeacher,
 24                   boolean isStudent,
 25                   int age,
 26                   String emailAddress,
 27                   String dateJoined) {
 28 
 29         this.firstName = firstName;
 30         this.lastName = lastName;
 31         this.isTeacher = isTeacher;
 32         this.isStudent = isStudent;
 33         this.age = age;
 34         this.emailAddress = emailAddress;
 35         this.dateJoined = dateJoined;
 36     }
 37 
 38     public String getFirstName() {
 39         return firstName;
 40     }
 41 
 42     public void setFirstName(String firstName) {
 43         this.firstName = firstName;
 44     }
 45 
 46     public String getLastName() {
 47         return lastName;
 48     }
 49 
 50     public void setLastName(String lastName) {
 51         this.lastName = lastName;
 52     }
 53 
 54     public boolean isTeacher() {
 55         return isTeacher;
 56     }
 57 
 58     public void setTeacher(boolean teacher) {
 59         isTeacher = teacher;
 60     }
 61 
 62     public boolean isStudent() {
 63         return isStudent;
 64     }
 65 
 66     public void setStudent(boolean student) {
 67         isStudent = student;
 68     }
 69 
 70     public int getAge() {
 71         return age;
 72     }
 73 
 74     public void setAge(int age) {
 75         this.age = age;
 76     }
 77 
 78     public String getEmailAddress() {
 79         return emailAddress;
 80     }
 81 
 82     public void setEmailAddress(String emailAddress) {
 83         this.emailAddress = emailAddress;
 84     }
 85 
 86     public String getDateJoined() {
 87         return dateJoined;
 88     }
 89 
 90     public void setDateJoined(String dateJoined) {
 91         this.dateJoined = dateJoined;
 92     }
 93 
 94     public String fullName() {
 95         return this.firstName + " " + this.lastName;
 96     }
 97 
 98 
 99     //  Make a method that returns a string with all the info; full name, email address and date joined
100     public String allInfo(){
101         return "Full Name: " + this.firstName + " " + this.lastName + "\nEmail: " + this.emailAddress + "\nDate Joined: " + this.dateJoined;
102     }
103 
104     // Return an array of objects to add as a row
105     public Object [] getAsRow(){
106         // Nicer variable appearance
107         String fullName = this.firstName + " " + this.lastName;
108         String studentOrTeacher;
109 
110         // Check if student or teacher
111         if (this.isStudent) {
112             studentOrTeacher = "Student";
113         } else if (this.isTeacher) {
114             studentOrTeacher = "Teacher";
115         } else {
116             studentOrTeacher = "Neither";
117         }
118 
119         Object [] objectRow = {clientID, fullName, this.age, this.emailAddress, studentOrTeacher, this.dateJoined};
120         
121         return objectRow;
122     }
123 }
124