Commit 1a2ee839 authored by 9731073's avatar 9731073

first commit

parent 4b5d9976
Pipeline #611 failed with stages
package core;
import java.util.ArrayList;
public abstract class AbstractEmployee extends Person {
protected ArrayList<Statement> statements;
protected int defpay;
protected int income;
public AbstractEmployee(String firstName,String lastName,String Id,int joiningYear,Department department,int defpay,ArrayList<Statement> statements){
super(firstName,lastName,Id,joiningYear,department);
this.defpay=defpay;
this.statements=statements;
}
public ArrayList<Statement> getStatements(){
return this.statements;
}
public int getDefpay(){
return defpay;
}
public abstract int incomeCalculate();
public abstract boolean isPromotable();
}
package core;
public class Account {
private AbstractEmployee owner;
private double credit;
public Account(AbstractEmployee owner,double credit){
this.credit=credit;
this.owner=owner;
}
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;
}
}
package core;
public interface AccountingInterface{
public AbstractEmployee callEmployee();
public double callCurrentIncome();
}
\ No newline at end of file
package 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 account=new Account(employee.callEmployee(),employee.callCurrentIncome());
accounts.add(account);
Statement s=new Statement(amount,employee.callEmployee());
statements.add(s);
}
}
}
package 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 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 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 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 core;
import java.util.ArrayList;
public class Professor extends AbstractEmployee
{
private ArrayList<Course> courses;
private String group;
public Professor(String firstName, String lastName, String Id, int joiningYear, Department department, int defpay, ArrayList<Statement> statements,String group) {
super(firstName, lastName, Id, joiningYear, department, defpay, statements);
this.group=group;
}
@Override
public int incomeCalculate() {
return 0;
}
@Override
public boolean isPromotable() {
return false;
}
}
package core;
public class Publication {
private String title;
private int year;
public Publication(String title,int year){
this.year=year;
this.title=title;
}
public String getTitle(){
return title;
}
public int getYear(){
return year;
}
}
package core;
import java.util.ArrayList;
public class ServiceEmployee extends AbstractEmployee
{
public ServiceEmployee(String firstName, String lastName, String Id, int joiningYear, Department department, int defpay, ArrayList<Statement> statements) {
super(firstName, lastName, Id, joiningYear, department, defpay, statements);
}
@Override
public int incomeCalculate() {
return 0;
}
@Override
public boolean isPromotable() {
return false;
}
}
package 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 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 core;
public class Type {
private String type;
public Type(String type){
this.type=type;
}
public String getType(){
return type;
}
}
package 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