Commit 01a175bf authored by 9731001's avatar 9731001

lab-9

parents
Pipeline #604 failed with stages
import java.util.ArrayList;
public class Acount {
private AcountingInterface person;
private double amount;
public Acount(AcountingInterface employee){
person = employee;
amount = 0;
}
public ArrayList<Statement> getStatements(){
return person.getBankStatements();
}
public void addStatement(double amount){
Statement s = new Statement(person , amount);
person.addBankStatement(s);
}
public AcountingInterface getEmployee(){
return person;
}
public void setAmount(double amount){
this.amount += amount;
}
}
import java.util.ArrayList;
public interface AcountingInterface {
public double callCurrentIncome();
public ArrayList<Statement> getBankStatements();
public void addBankStatement(Statement s);
}
import java.util.ArrayList;
public class AcountingManagement {
private ArrayList<Acount> acounts = new ArrayList<Acount>();
public void addAcount(AcountingInterface employee){
Acount acount = new Acount(employee);
acounts.add(acount);
}
public void checkOut(Acount acount){
AcountingInterface employee = acount.getEmployee();
double amount = employee.callCurrentIncome();
if(amount != 0) {
acount.setAmount(amount);
acount.addStatement(amount);
}
}
public void settel(){
for(Acount a : acounts) {
checkOut(a);
}
}
public ArrayList<Statement> getStatements(){
ArrayList<Statement> statements = new ArrayList<Statement>();
for(Acount a : acounts){
AcountingInterface e = a.getEmployee();
for(Statement s : e.getBankStatements()){
statements.add(s);
}
}
return statements;
}
}
import java.util.ArrayList;
public class Course {
private String name;
private Professor instructor;
private GradStudent assistance;
private ArrayList<Student> students = new ArrayList<Student>();
public Course(String name , Professor instructor) {
this.name = name;
this.instructor = instructor;
}
public GradStudent getTeacherAssistance() {
return assistance;
}
public void setTeacherAssistance(GradStudent teacherAssistance) {
this.assistance = teacherAssistance;
}
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);
}
}
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);
}
}
import java.util.ArrayList;
public abstract class Employee extends Person {
protected ArrayList<Statement> statements;
protected String position;
protected double basicIncome;
public ArrayList<Statement> getSalaries() {
return statements;
}
public String getPosition(){
return position;
}
public void addBankStatement(Statement s){
statements.add(s);
}
public ArrayList<Statement> getBankStatements(){
return statements;
}
public void setBasicIncome(double basicIncome){
this.basicIncome = basicIncome;
}
public abstract double getCurrentIncome();
public double callCurrentIncome(){
return this.getCurrentIncome();
}
}
import java.util.ArrayList;
public class GradStudent extends Student {
private ArrayList<Publication> publications = new ArrayList<Publication>();
private Professor advisor;
public void addPublication(Publication p){
publications.add(p);
}
public ArrayList<Publication> getPublications(){
return publications;
}
}
public class Main {
public static void main(String[] args) {
}
}
public abstract class Person {
protected String firstname;
protected String lastName;
protected String ID;
protected int joiningYaer;
protected Department department;
public String getFullName(){
String fullName = new String();
fullName = firstname + lastName;
return fullName;
}
public String getID(){
return ID;
}
public int getJoiningYear() {
return joiningYaer;
}
public Department getDepartment(){
return department;
}
}
import java.util.ArrayList;
public class Professor extends Employee {
private ArrayList<Course> courses;
private String group;
private ArrayList<Publication> publications;
public void addCourses(Course c){
courses.add(c);
}
public String getGroup(){
return group;
}
public ArrayList<Course> getCourses(){
return courses;
}
@Override
public double getCurrentIncome(){
double currentIncome = basicIncome + publications.size() * 1000;
return currentIncome;
}
public void addPublication(Publication p){
publications.add(p);
}
public ArrayList<Publication> getPublications(){
return publications;
}
}
public class Publication {
String titel;
int year;
}
public class Service extends Employee {
int workHours;
@Override
public double getCurrentIncome(){
double currentIncome = basicIncome + 500 * workHours;
return currentIncome;
}
}
import javax.swing.plaf.nimbus.State;
public class Statement {
private double amount;
private AcountingInterface reciver;
public Statement(AcountingInterface employee , double amount){
reciver = employee;
this.amount = amount;
}
}
import java.util.ArrayList;
public class Student extends Person {
ArrayList<Course> courses = new ArrayList<Course>();
public ArrayList<Course> getCourses(){
return courses;
}
public void addCourse(Course c){
courses.add(c);
}
public int numberOfCourses(){
return courses.size();
}
}
public class UnderGradStudent 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