Commit a6013617 authored by Aryan's avatar Aryan

First Commit

parents
Pipeline #607 canceled with stages
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
import java.util.*;
public class Main {
public static void main(String[] args) {
}
}
package org.university.core;
import java.util.ArrayList;
import java.util.Iterator;
public abstract class AbstractEmployee extends Person{
private ArrayList<Statement> bankStatement;
private String position;
private double basicIncome;
public AbstractEmployee(){
}
public AbstractEmployee(String position, double basicIncome) {
this.bankStatement = new ArrayList<Statement>();
this.position = position;
this.basicIncome = basicIncome;
}
public String getPosition() {
return position;
}
public void addBankStatement(Statement bankStatement) {
this.bankStatement.add(bankStatement);
}
public ArrayList<Statement> getBankStatement() {
return bankStatement;
}
public void setBasicIncome(double basicIncome) {
this.basicIncome = basicIncome;
}
public double getCalPrice(){
double res = 0;
for(Statement statement : bankStatement)
res += statement.getAmount();
return res;
}
abstract public boolean isPromotable();
}
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 org.university.core.Course;
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 GraduateStudent extends Student {
private ArrayList<Publication> publications;
private Professor advisor;
public GraduateStudent(Professor advisor) {
publications = new ArrayList<Publication>();
this.advisor = advisor;
}
public Professor getAdvisor() {
return advisor;
}
public void addPublication(Publication publication) {
publications.add(publication);
}
public ArrayList<Publication> getPublication() {
return publications;
}
}
package org.university.core;
public class Person {
private String firstName;
private String lastName;
private String id;
private int joiningYear;
private 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 Person(){
}
public String getId() {
return id;
}
public Department getDepartment() {
return department;
}
public int getJoiningYear() {
return joiningYear;
}
public String getFullName(){
return firstName + lastName;
}
public void setJoiningYear(int joiningYear) {
this.joiningYear = joiningYear;
}
}
package org.university.core;
import java.util.ArrayList;
public class Professor extends AbstractEmployee {
private ArrayList<Course> courses;
private String group;
private ArrayList<Publication> publications;
public Professor(String group) {
super();
courses = new ArrayList<>();
publications = new ArrayList<>();
this.group = group;
setBasicIncome(7);
}
public ArrayList<Course> getCourses() {
return courses;
}
public String getGroup() {
return group;
}
public void addCourse(Course course){
courses.add(course);
}
public void addPublication(Publication publication){
publications.add(publication);
}
@Override
public boolean isPromotable() {
if(publications.size() >= 10){
setJoiningYear(0);
return true;
}
return false;
}
}
package org.university.core;
public class Publication {
private String title;
private int year;
public Publication(String title, int year) {
this.title = title;
this.year = year;
}
//
}
package org.university.core;
import java.beans.Statement;
import java.util.ArrayList;
public class ServiceEmployee extends AbstractEmployee {
public ServiceEmployee(String position, double basicIncome) {
super(position, basicIncome);
setBasicIncome(3);
}
@Override
public boolean isPromotable() {
if(getJoiningYear() >= 3) {
setJoiningYear(0);
return true;
}
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 AbstractEmployee getReceiver() {
return receiver;
}
}
package org.university.core;
import java.util.ArrayList;
public class Student extends Person{
private ArrayList<Course> courses;
public Student(){
}
public Student(String firstName, String lastName, String id, int joiningYear, Department department) {
super(firstName,lastName,id,joiningYear, department);
courses = new ArrayList<>();
}
public void addCourse(Course course){
courses.add(course);
}
public ArrayList<Course> getCourses(){
return courses;
}
}
package org.university.core;
public class UnderGraduate extends Student{
}
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