Commit 5f84f1ae authored by Amirhosein Rajabpour's avatar Amirhosein Rajabpour

first commit

parent ff502181
package org.university.core;
import java.util.ArrayList;
public abstract class AbstractEmployee extends Person implements AccountingInterface
{
protected ArrayList<Statement> bankStatments = new ArrayList<Statement>();
protected String position;
protected double basicIncome,currentIncome;
public AbstractEmployee(String firstName, String lastName, String ID, int joiningYear, Department department, String position, double basicIncome) {
super(firstName, lastName, ID, joiningYear, department);
this.position = position;
this.basicIncome = basicIncome;
}
public abstract boolean isPromotable();
public void addBankStatement(Statement s)
{
bankStatments.add(s);
}
@Override
public double callCurrentIncome() {
return callCurrentIncome();
}
public ArrayList<Statement> getBankStatments() {
return bankStatments;
}
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position;
}
public double getBasicIncome() {
return basicIncome;
}
public void setBasicIncome(double basicIncome) {
this.basicIncome = basicIncome;
}
public void setCurrentIncome(double currentIncome)
{
this.currentIncome = currentIncome;
}
public double calCurrentIncome()
{
return currentIncome;
}
}
package org.university.core;
public class Account
{
private AbstractEmployee owner;
private double credit;
public Account(AbstractEmployee owner, double credit) {
this.owner = owner;
this.credit = credit;
}
public AbstractEmployee getOwner() {
return owner;
}
public void setOwner(AbstractEmployee owner) {
this.owner = owner;
}
public double getCredit() {
return credit;
}
public void setCredit(double credit) {
this.credit = credit;
}
}
\ No newline at end of file
package org.university.core;
import java.util.ArrayList;
public class AccountingManagement
{
private ArrayList<Account> accounts;
private ArrayList<Statement> statements;
public void checkout(AccountingInterface employee)
{
boolean flag = true;
for (Account account:accounts)
{
if (account.getOwner()==employee)
{
double amount = employee.callCurrentIncome();
account.setCredit(account.getCredit()+amount);
flag = false;
Statement s = new Statement(amount,employee.callEmployee());
statements.add(s);
}
}
if (flag)
{
double amount = employee.callCurrentIncome();
Account ac = new Account(employee.callEmployee(),employee.callCurrentIncome());
accounts.add(ac);
Statement s = new Statement(amount,employee.callEmployee());
statements.add(s);
}
}
}
package org.university.core;
public class Article
{
private String title;
private int year;
public Article(String title, int year) {
this.title = title;
this.year = year;
}
public String getTitle() {
return title;
}
public int getYear() {
return year;
}
}
package org.university.core;
import java.util.ArrayList;
public class Course {
private String name;
private Professor instructor;
private ArrayList<Student> students = new ArrayList<Student>();
private GradStudent teacherAssistance;
public GradStudent getTeacherAssistance() {
return teacherAssistance;
}
public void setTeacherAssistance(GradStudent teacherAssistance) {
this.teacherAssistance = teacherAssistance;
}
public Course(String name, Professor instructor) {
this.name = name;
this.instructor = instructor;
}
public String getName() {
return name;
}
public Professor getInstructor() {
return instructor;
}
public ArrayList<Student> getStudents() {
return students;
}
public void addStudent(Student student){
this.students.add(student);
}
}
package org.university.core;
import java.util.ArrayList;
public class Department {
private String name;
private ArrayList<Course> courses = new ArrayList<>();
public Department(String name){
this.name = name;
}
public String getName() {
return name;
}
public ArrayList<Course> getCourses() {
return courses;
}
public void addCourse(Course course){
courses.add(course);
}
}
package org.university.core;
import java.util.ArrayList;
public class GradStudent extends Student
{
private ArrayList<Publication> publications;
private Professor advisor;
public GradStudent(String firstName, String lastName, String ID, int joiningYear, Department department, Professor advisor) {
super(firstName, lastName, ID, joiningYear, department);
this.advisor = advisor;
}
public void addPublication(Publication p)
{
publications.add(p);
}
public ArrayList<Publication> getPublications() {
return publications;
}
public Professor getAdvisor() {
return advisor;
}
}
package org.university.core;
public class Person {
protected String firstName;
protected String lastName;
protected String ID;
protected int joiningYear;
protected Department department;
public Person(String firstName, String lastName, String ID, int joiningYear, Department department)
{
this.firstName = firstName;
this.lastName = lastName;
this.ID = ID;
this.joiningYear = joiningYear;
this.department = department;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getID() {
return ID;
}
public void setID(String ID) {
this.ID = ID;
}
public int getJoiningYear() {
return joiningYear;
}
public void setJoiningYear(int joiningYear) {
this.joiningYear = joiningYear;
}
public Department getDepartment() {
return department;
}
public void setDepartment(Department department) {
this.department = department;
}
}
package org.university.core;
import java.util.ArrayList;
public class Professor extends AbstractEmployee
{
private ArrayList<Course> courses;
private ArrayList<Article> articles;
private String group;
public Professor(String firstName, String lastName, String ID, int joiningYear,
Department department, String position, double basicIncome, String group) {
super(firstName, lastName, ID, joiningYear, department, position, basicIncome);
this.group = group;
}
public void addArticle(Article a){
articles.add(a);
}
public ArrayList getArticles(){
return articles;
}
@Override
public boolean isPromotable() {
if(articles.size()>10)
return true;
else
return false;
}
}
package org.university.core;
import java.util.Date;
public class ServiceEmployee extends AbstractEmployee
{
public ServiceEmployee(String firstName, String lastName, String ID, int joiningYear, Department department, String position, double basicIncome) {
super(firstName, lastName, ID, joiningYear, department, position, basicIncome);
}
int passedDays = 0;
public void setPassedDays(int passedDays) {
this.passedDays++;
}
@Override
public boolean isPromotable() {
if(passedDays > 365*3 )
{
passedDays = 0;
return true;
}
else
return false;
}
}
package org.university.core;
public class Statement {
private double amount;
private AbstractEmployee receiver;
public Statement(double amount, AbstractEmployee receiver) {
this.amount = amount;
this.receiver = receiver;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public AbstractEmployee getReciever() {
return receiver;
}
public void setReciever(AbstractEmployee reciver) {
this.receiver = receiver;
}
}
package org.university.core;
import java.util.ArrayList;
public class Student extends Person
{
private ArrayList<Course> courses;
public Student(String firstName, String lastName, String ID, int joiningYear, Department department)
{
super(firstName, lastName, ID, joiningYear, department);
}
public void addCourse(Course c)
{
courses.add(c);
}
public ArrayList<Course> getCourses()
{
return courses;
}
}
package org.university.core;
public class Type
{
private String type;
public Type(String type) {
this.type = type;
}
public String getType()
{
return type;
}
}
package org.university.core;
public class UnderGradStudent extends Student
{
private Type field;
public UnderGradStudent(String firstName, String lastName, String ID, int joiningYear, Department department, Type field) {
super(firstName, lastName, ID, joiningYear, department);
this.field = field;
}
public void setField(Type field) {
this.field = field;
}
public Type getField()
{
return field;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment