Commit 109c0858 authored by amsen's avatar amsen

first commit without compile error abstract compeleted

parents
Pipeline #578 canceled with stages
File added
package org.university.core;
import java.util.*;
public abstract class AbstractEmployee extends Person{
protected ArrayList<Statement> bankStatements;
protected String position;
protected Date lastPromote;
protected double basicIncome;
public AbstractEmployee(String name, int entranceYear, int id){
super(name, entranceYear, id);
bankStatements = new ArrayList<>();
lastPromote = new Date();
}
public String getPosition(){
return position;
}
public void addBankStatement(Statement s){
bankStatements.add(s);
}
public Statement[] getBankStatements(){
Statement[] arr = new Statement[bankStatements.size()];
bankStatements.toArray(arr);
return arr;
}
public void setBasicIncome(double income){
this.basicIncome = income;
}
public boolean promote(){
if(isPromotable()){
lastPromote = new Date();
return true;
}
return false;
}
abstract public double getCurrentIncome();
abstract public boolean isPromotable();
}
package org.university.core;
public class Article{
private String name;
private int year;
public Article(){
this.name = name;
this.year = year;
}
public String getName(){
return name;
}
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 GraduateStudent teacherAssistance;
public GraduateStudent getTeacherAssistance() {
return teacherAssistance;
}
public void setTeacherAssistance(GraduateStudent 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.*;
public class GraduateStudent extends Student{
private ArrayList<Article> articles;
public GraduateStudent(String name, int entranceYear, int id){
super(name, entranceYear, id);
}
public Article[] getArticles(){
Article[] arr = new Article[articles.size()];
articles.toArray(arr);
return arr;
}
public void addArticle(Article c){
articles.add(c);
}
}
package org.university.core;
public class Person{
protected String name;
protected int entranceYear;
protected int id;
public Person(String name, int entranceYear, int id){
this.name = name;
this.entranceYear = entranceYear;
this.id = id;
}
public String getName(){
return name;
}
public int getEntranceYear(){
return entranceYear;
}
public int getId(){
return id;
}
}
package org.university.core;
import java.util.*;
public class Professor extends AbstractEmployee{
private ArrayList<Course> courses;
private String group;
public Professor(String name, int entranceYear, int id){
super(name, entranceYear, id);
courses = new ArrayList<>();
basicIncome = 7000;
}
public double getCurrentIncome(){
return courses.size() * 1000 + basicIncome;
}
public Course[] getCourses(){
Course[] arr = new Course[courses.size()];
courses.toArray(arr);
return arr;
}
public void addCourse(Course c){
courses.add(c);
}
public String getGroup(){
return group;
}
public boolean isPromotable(){
//TODO
return true;
}
}
package org.university.core;
import java.util.*;
public class ServiceEmaployee extends AbstractEmployee{
public int extraWork;
public ServiceEmaployee(String name, int entranceYear, int id){
super(name, entranceYear, id);
basicIncome = 3;
}
public void setExtraWork(int extraWork){
this.extraWork = extraWork;
}
public int getExtraWork(){
return extraWork;
}
public double getCurrentIncome(){
return extraWork * 500 + basicIncome;
}
public boolean isPromotable(){
long dis = (new Date()).getTime() - lastPromote.getTime();
dis /= 1000 * 3600 * 24 * 365;
return dis >= 3;
}
}
package org.university.core;
import java.util.*;
public class Statement{
private int amount;
private Date date;
private AbstractEmployee receiver;
public Statement(int amount, Date date, AbstractEmployee receiver){
this.amount = amount;
this.date = date;
this.receiver = receiver;
}
public int getAmount(){
return amount;
}
public Date getDate(){
return date;
}
public AbstractEmployee receiver(){
return receiver;
}
}
package org.university.core;
import java.util.*;
public class Student extends Person{
protected String college;
protected ArrayList<Course> passedCourses;
public Student(String name, int entranceYear, int id){
super(name, entranceYear, id);
passedCourses = new ArrayList<>();
}
public String getCollege(){
return college;
}
public Course[] getPassedCourses(){
Course[] arr = new Course[passedCourses.size()];
passedCourses.toArray(arr);
return arr;
}
public void addCourse(Course c){
passedCourses.add(c);
}
}
package org.university.core;
public class UnderGradStudent extends Student{
public UnderGradStudent(String name, int entranceYear, int id){
super(name, entranceYear, id);
}
}
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