/home/caleb/ASDV-Java/Semester 2/Assignments/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Person.java
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.calebfontenot.lab5_calebfontenot;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;

/**
 *
 * @author caleb
 */
public class Person {
    //name, addresss, phone number, and email addresss
    
    private String name;
    private String address;
    private String phoneNumber;
    private String email;

    public Person(String name, String address, String phoneNumber, String email)
    {
        this.name = name;
        this.address = address;
        this.phoneNumber = phoneNumber;
        this.email = email;
    }
    
    public String getEmailAddress() {return email;}
    public void setEmailAddress(String email) {this.email = email;}
    public String getPhoneNumber(){return phoneNumber;}
    public void setPhoneNumber(String phoneNumber) {this.phoneNumber = phoneNumber;}
    public String getAddress() {return address;}
    public void setAddress(String address){ this.address = address;}
    public String getName() {return name;}
    public void setName(String name) {this.name = name;}

    @Override
    public String toString()
    {
        return "Person{" + "name=" + name + '}';
    }
    
    public static void  checkArrayList() {
        Integer[] arr = {3, 1, 2, 3, 6, 3, 4, 6, 3};
        ArrayList<Integer> list =new ArrayList<Integer>(Arrays.asList(arr));
        System.out.println(list);
        Object[] arr3 = list.toArray();
        for (int i = 0; i < 3; ++i) {
            System.out.print(arr3[i] + " ");
        }
        System.out.println("max is " + Collections.max(list));
        System.out.println();

    }
    
    public static void ArrayListGeneric() {
        ArrayList returnList = new ArrayList();
        returnList.add(new Person("John Wayne", "123 Sunny Dr. Santa Barabara, 90611", "922-337-3231", "jw@gmail.com"));
        returnList.add(new Date());
        returnList.add(new String("Hello, I am a string object."));
        returnList.add(new Employee("123", 1234567, new Date(), "Mary Poppins", "123 Blake Drive, Lafayette, LA, 70506", "337-123-4567", "mp@gmail.com"));
        // Print objects in ArrayList
        for (Object o: returnList) {
            System.out.println(o);
        }
        
    }
    
    public static ArrayList<Integer> removeDuplicate(ArrayList<Integer> list) {
        //list.contains();
        //list.remove();
        System.out.println(list);
        ArrayList<Integer> newList = new ArrayList<>();
                for (int i = 0; i < list.size(); ++i) {
                        if (!newList.contains(list.get(i))) {
                            newList.add(list.get(i));
                    }
                }
                return newList;
    }
    
    public static void main(String[] args)
    {
        Integer[] arr = {3, 1, 2, 3, 6, 3, 4, 6, 3};
        ArrayList<Integer> list2 =new ArrayList<>(Arrays.asList(arr));
        System.out.println(removeDuplicate(list2));
        ArrayListGeneric();
        
        ArrayList list = new ArrayList();
        list.add(new Person("John Wayne", "123 Sunny Dr. Santa Barabara, 90611", "922-337-3231", "jw@gmail.com"));
        list.add(new Date());
        list.add("This is a string");
        list.add(new String("This is another string"));
        list.add(new Employee("123", 1234567, new Date(), "Mary Poppins", "123 Blake Drive, Lafayette, LA, 70506", "337-123-4567", "mp@gmail.com"));
        for (int i = 0; i < list.size(); ++i) {
            System.out.println(list.get(i));
        }
        
    }
}
class Student extends Person {

    private Status status;
    public Status getStatus() {return status;}
    public void setStatus(Status status) {this.status = status;}

        public Student(Status status, String name, String address, String phoneNumber, String email)
    {
        super(name, address, phoneNumber, email);
        this.status = status;
    }
    
    @Override
    public String toString() {return super.toString() + "Student{" + "Status=" + this.status +  '}';}
}
class Employee extends Person {
    // office, salary, and data hired
    private String office;
    private double salary;
    private Date dateHired;

    public Employee(String office, double salary, Date dateHired, String name, String address, String phoneNumber, String email)
    {
        super(name, address, phoneNumber, email);
        this.office = office;
        this.salary = salary;
        this.dateHired = dateHired;
    }

    
    
    public Date getDateHired() {return dateHired;}
    public double getSalary() {return salary;}
    public void setSalary(double salary) {this.salary = salary;}
    public String getOffice() {return office;}
    public void setOffice(String office) {this.office = office;}

    @Override
    public String toString() {return super.toString() + ", Employee{" + "Office=" + this.office + ", Salary=" + this.salary + ", dateHired=" +this.dateHired + '}';}
}
class Faculty extends Employee {
    
    private String officeHours;
    private int rank;

    public Faculty(String officeHours, int rank, String office, double salary, Date dateHired, String name, String address, String phoneNumber, String email)
    {
        super(office, salary, dateHired, name, address, phoneNumber, email);
        this.officeHours = officeHours;
        this.rank = rank;
    }
    
    
    
    public int getRank(){return rank;}
    public void setRank(int rank) {this.rank = rank;}
    public String getOfficeHours() {return officeHours;}
    public void setOfficeHours(String officeHours) {this.officeHours = officeHours;}
    
    @Override
    public String toString() {return "Faculty{name="  + this.getName() + ", "  +"rank=" + rank + '}';}

}
class Staff extends Employee {
    
    private String title;

    public Staff(String title, String office, double salary, Date dateHired, String name, String address, String phoneNumber, String email)
    {
        super(office, salary, dateHired, name, address, phoneNumber, email);
        this.title = title;
    }
    
    
    
    public String getTitle() {return title;}
    public void setTitle(String title) {this.title = title;}

      @Override
    public String toString() {return "Staff{name="  + this.getName() + ", "  +"title=" + title + '}';}
}
class Status  {
    
    final private String status;
    public Status(String status) { this.status = status;}
    public String getStatus()
    {
        return status;
    }

    @Override
    public String toString() {return "Status{" + "status=" + status + '}';}

}