Commit 1b6d3365 authored by Roonak's avatar Roonak

push

parents
Pipeline #646 failed with stages
package com.company;
public class Article {
private String title;
private int publishYear;
public Article(String title , int publishYear){
this.title = title;
this.publishYear = publishYear;
}
public void setTitle(String title) {
this.title = title;
}
public void setPublishYear(int publishYear) {
this.publishYear = publishYear;
}
public String getTitle() {
return title;
}
public int getPublishYear() {
return publishYear;
}
}
package com.company;
public class BankStatements {
private int paymentNumber;
private int paymentAmount;
private int paymentDate;
private Employee employee;
public BankStatements(int paymentNumber, int paymentAmount, int paymentDate, Employee employee) {
this.paymentNumber = paymentNumber;
this.paymentAmount = paymentAmount;
this.paymentDate = paymentDate;
this.employee = employee;
}
}
package com.company;
import java.util.ArrayList;
public class Course {
private String name;
private Professor professor;
private ArrayList<Student> students = new ArrayList<Student>();
private String TA;
public Course(String name, Professor professor , String TA) {
this.name = name;
this.professor = professor;
this.TA = TA;
}
public String getName() {
return name;
}
public Professor getProfessor() {
return professor;
}
public ArrayList<Student> getStudents() {
return students;
}
public void addStudent(Student student){
this.students.add(student);
}
public String getTA(){
return TA;
}
}
\ No newline at end of file
package com.company;
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 com.company;
import java.util.ArrayList;
public abstract class Employee extends Person {
protected ArrayList<Statement> bankStatements;
protected String position;
protected double basicIncome;
protected double currentIncome;
protected int lastPromotedYear;
protected int date;
public Employee(String position, double basicIncome , int lastPromotedYear , int date) {
this.position = position;
this.basicIncome = basicIncome;
this.lastPromotedYear = lastPromotedYear;
this.date = date;
}
public void setPosition(String position) {
this.position = position;
}
public void setBasicIncome(double basicIncome) {
this.basicIncome = basicIncome;
}
public String getPosition() {
return position;
}
public void addBankStatement(Statement s) {
bankStatements.add(s);
}
public ArrayList<Statement> getBankStatements() {
return bankStatements;
}
public abstract boolean isPromoteable();
public abstract void setCurrentIncome();
}
\ No newline at end of file
package com.company;
import java.util.ArrayList;
public class GraduatedStudent extends Person {
ArrayList<Article> articles = new ArrayList<>();
public void addArticle(Article a){
articles.add(a);
}
public ArrayList<Article> getArticle(){
return articles;
}
@Override
public double calCurrentIncome() {
return 300 * (articles.size());/*nmidunstm meghdar ro cheghadr bdm*/
}
}
\ No newline at end of file
package com.company;
public abstract class Person {
protected String firstName;
protected String lastName;
protected String ID;
protected int joiningYear;
protected Department department;
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public void setID(String ID) {
this.ID = ID;
}
public String getFullName() {
return firstName + lastName;
}
public String getID() {
return ID;
}
public int getJoiningYear() {
return joiningYear;
}
public Department getDepartment() {
return department;
}
public abstract double calCurrentIncome();
}
package com.company;
import java.util.ArrayList;
public class Professor extends Employee {
ArrayList<Course> course = new ArrayList<>();
ArrayList<Article> articles = new ArrayList<>();
private String group;
private int counter = 0;
public Professor(String position, double basicIncome , int lastPromotedYear , int year) {
super(position, basicIncome ,lastPromotedYear , year);
}
public void setGroup(String group) {
this.group = group;
}
public ArrayList<Course> getCourses() {
return course;
}
public void addCourse(Course c) {
course.add(c);
}
public String getGroup() {
return group;
}
@Override
public void setCurrentIncome() {
currentIncome += 1000*(articles.size());
}
@Override
public boolean isPromoteable() {
for(int i=0 ; i<(articles.size()) ; i++){
if(articles.get(i).getPublishYear() <= lastPromotedYear) counter++ ;
}
return counter >=10 ? true : false;
}
public double calCurrentIncome() {
return currentIncome;
}
}
\ No newline at end of file
package com.company;
public class ServiceEmployee extends Employee{
public ServiceEmployee(String position, double basicIncome , int lastPromotedYear , int date) {
super(position, basicIncome , lastPromotedYear , date);
}
private int hour;
@Override
public void setCurrentIncome() {
currentIncome += 500 * (hour);
}
@Override
public boolean isPromoteable() {
return date-lastPromotedYear >= 3 ? true : false;
}
@Override
public double calCurrentIncome() {
return currentIncome;
}
}
\ No newline at end of file
package com.company;
import com.sun.org.apache.bcel.internal.generic.RET;
public class Statement {
private int paymentNumber;
private int paymentAmount;
private int paymentDate;
private Employee employee;
public Statement(int paymentNumber , int paymentAmount , int paymentDate){
this.paymentNumber = paymentNumber;
this.paymentAmount = paymentAmount;
this.paymentDate = paymentDate;
}
public int getNumber() {
return paymentNumber;
}
public int getAmount() {
return paymentAmount;
}
public int getDate() {
return paymentDate;
}
public Employee getEmployee() {
return employee;
}
}
\ No newline at end of file
package com.company;
import java.util.ArrayList;
public class Student extends Person {
protected ArrayList<Course> course = new ArrayList<>();
public ArrayList<Course> getCourse() {
return course;
}
public void addCourse(Course course) {
this.course.add(course);
}
@Override
public double calCurrentIncome() {
return 0;
}
}
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