Commit c09a7d39 authored by mrsl2000's avatar mrsl2000

tammom shod lab9 lanati

parents
Pipeline #703 canceled with stages
package org.university.core;
import java.util.ArrayList;
public abstract class AbstractEmployee extends Person implements AccountingInterface{
protected String position;
protected double basicIncome,currentIncome;
protected ArrayList<Bill> bankBill = new ArrayList<Bill>();
public AbstractEmployee(String firstName, String lastName, int 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(Bill s)
{
bankBill.add(s);
}
@Override
public AbstractEmployee getEmployee() {
return this;
}
@Override
public double getCurrentIncome()
{
return currentIncome;
}
public ArrayList<Bill> getBankBill() {
return bankBill;
}
public String getPosition() {
return position;
}
public double getBasicIncome() {
return basicIncome;
}
public void setCurrentIncome(double currentIncome)
{
this.currentIncome = currentIncome;
}
}
package org.university.core;
public class Account {
private AbstractEmployee owner;
private double money;
public Account(AbstractEmployee owner , double money){
this.money = money;
this.owner = owner;
}
public AbstractEmployee getOwner() {
return owner;
}
public double getMoney() {
return money;
}
public void setMoney(double money) {
this.money = money;
}
}
package org.university.core;
public interface AccountingInterface {
double getCurrentIncome();
AbstractEmployee getEmployee();
}
package org.university.core;
import java.util.ArrayList;
public class AccountingManagement
{
private ArrayList<Bill> Bills;
private ArrayList<Account> accounts;
public void check(AccountingInterface employee)
{
int f = 1;
for (Account account:accounts)
{
if (account.getOwner() == employee)
{
double amount = employee.getCurrentIncome();
account.setMoney(account.getMoney()+amount);
f = 0;
Bill s = new Bill(amount,employee.getEmployee());
Bills.add(s);
}
}
if (f > 1)
{
double amount = employee.getCurrentIncome();
Account ac = new Account(employee.getEmployee(),employee.getCurrentIncome());
accounts.add(ac);
Bill s = new Bill(amount,employee.getEmployee());
Bills.add(s);
}
}
}
package org.university.core;
public class Bill {
private double amount;
private AbstractEmployee receiver;
public Bill(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 receiver) {
this.receiver = receiver;
}
}
package org.university.core;
import java.util.ArrayList;
public class Course {
private String name;
private Professor instructor;
private ArrayList<Student> students = new ArrayList<Student>();
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);
}
}
\ No newline at end of file
package org.university.core;
public class Person {
protected String firstName;
protected String lastName;
protected int ID;
protected int joiningYear;
protected Department department;
public Person(String firstName, String lastName, int 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 String getLastName() {
return lastName;
}
public int getID() {
return ID;
}
public int getJoiningYear() {
return 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{
ArrayList<Course> courses = new ArrayList<>();
String group;
public Professor(String firstName,String lastName,int ID , int joiningYear , Department department ,String position , double basicIncome , String group){
super(firstName , lastName , ID , joiningYear , department , position , basicIncome);
this.group = group;
}
public Course[] getCourses() {
Course[] temp = new Course[courses.size()];
courses.toArray(temp);
return temp;
}
public void addCourse(Course c){
this.courses.add(c);
}
public String getGroup() {
return group;
}
@Override
public boolean isPromotable(){
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;
}
public int getYear() {
return year;
}
public String getTitle() {
return title;
}
}
package org.university.core;
public class ServiceEmployee extends AbstractEmployee {
public ServiceEmployee(String firstName,String lastName,int ID , int joiningYear , Department department ,String position , double basicIncome){
super(firstName , lastName , ID , joiningYear , department , position , basicIncome);
}
@Override
public boolean isPromotable(){
return false;
}
}
package org.university.core;
import java.util.ArrayList;
public class Student extends Person {
ArrayList<Course> courses = new ArrayList<>();
public Student(String firstName,String lastName,int 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;
}
}
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