Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
Lab9
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
9731087
Lab9
Commits
d5277887
Commit
d5277887
authored
May 16, 2019
by
9731087
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
last commit
parent
85ac1c8e
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
218 additions
and
23 deletions
+218
-23
AbstarctEmployee.java
src/org/university/core/AbstarctEmployee.java
+29
-5
AccountingInterface.java
src/org/university/core/AccountingInterface.java
+8
-0
Bachler.java
src/org/university/core/Bachler.java
+11
-5
Essay.java
src/org/university/core/Essay.java
+5
-0
FinancialAccount.java
src/org/university/core/FinancialAccount.java
+35
-0
FinancialSystem.java
src/org/university/core/FinancialSystem.java
+33
-0
Main.java
src/org/university/core/Main.java
+1
-1
Master.java
src/org/university/core/Master.java
+11
-1
Payroll.java
src/org/university/core/Payroll.java
+9
-2
ServiceEmployee.java
src/org/university/core/ServiceEmployee.java
+28
-4
Student.java
src/org/university/core/Student.java
+4
-0
Teacher.java
src/org/university/core/Teacher.java
+31
-5
Type.java
src/org/university/core/Type.java
+13
-0
No files found.
src/org/university/core/AbstarctEmployee.java
View file @
d5277887
...
...
@@ -2,27 +2,51 @@ package org.university.core;
import
java.util.ArrayList
;
public
abstract
class
AbstarctEmployee
extends
Person
{
public
abstract
class
AbstarctEmployee
extends
Person
implements
AccountingInterface
{
protected
ArrayList
<
Payroll
>
payrolls
;
protected
ArrayList
<
Payroll
>
payrolls
=
new
ArrayList
<
Payroll
>()
;
protected
int
defPay
;
protected
int
income
;
protected
String
state
;
public
AbstarctEmployee
(
String
firstName
,
String
lastName
,
String
ID
,
int
joiningYear
,
Department
department
,
int
defPay
,
ArrayList
<
Payroll
>
payrolls
)
{
public
AbstarctEmployee
(
String
firstName
,
String
lastName
,
String
ID
,
int
joiningYear
,
Department
department
,
int
defPay
,
ArrayList
<
Payroll
>
payrolls
,
String
state
)
{
super
(
firstName
,
lastName
,
ID
,
joiningYear
,
department
);
this
.
defPay
=
defPay
;
this
.
payrolls
=
payrolls
;
this
.
state
=
state
;
this
.
income
=
0
;
}
public
ArrayList
<
Payroll
>
getPayrolls
()
{
return
this
.
payrolls
;
}
public
void
addPayroll
(
Payroll
payroll
)
{
this
.
payrolls
.
add
(
payroll
);
}
public
int
getDefPay
()
{
return
defPay
;
}
abstract
public
int
incomeCalculate
();
public
abstract
int
incomeCalculate
();
public
abstract
boolean
isPromoteable
();
public
int
getIncome
()
{
return
income
;
}
public
void
setIncome
(
int
income
)
{
this
.
income
=
income
;
}
public
void
setDefPay
(
int
defPay
)
{
this
.
defPay
=
defPay
;
}
public
String
getState
()
{
return
state
;
}
abstract
public
boolean
isPromoteable
();
}
src/org/university/core/AccountingInterface.java
0 → 100644
View file @
d5277887
package
org
.
university
.
core
;
public
interface
AccountingInterface
{
public
int
calCurrentIncome
();
public
AbstarctEmployee
callEmployee
();
}
src/org/university/core/Bachler.java
View file @
d5277887
package
org
.
university
.
core
;
import
org.university.core.Course
;
import
org.university.core.Department
;
import
org.university.core.Student
;
import
java.util.ArrayList
;
public
class
Bachler
extends
Student
{
public
Bachler
(
String
firstName
,
String
lastName
,
String
ID
,
int
joiningYear
,
Department
department
,
ArrayList
<
Course
>
courses
)
{
private
Type
field
;
public
Bachler
(
String
firstName
,
String
lastName
,
String
ID
,
int
joiningYear
,
Department
department
,
ArrayList
<
Course
>
courses
,
Type
field
)
{
super
(
firstName
,
lastName
,
ID
,
joiningYear
,
department
,
courses
);
this
.
field
=
field
;
}
public
void
setField
(
Type
field
)
{
this
.
field
=
field
;
}
public
Type
getField
()
{
return
field
;
}
}
src/org/university/core/Essay.java
View file @
d5277887
...
...
@@ -5,6 +5,11 @@ public class Essay {
private
String
title
;
private
int
modYear
;
public
Essay
(
String
title
,
int
modYear
){
this
.
title
=
title
;
this
.
modYear
=
modYear
;
}
public
String
getTitle
()
{
return
title
;
}
...
...
src/org/university/core/FinancialAccount.java
0 → 100644
View file @
d5277887
package
org
.
university
.
core
;
public
class
FinancialAccount
{
private
AbstarctEmployee
owner
;
private
int
stock
;
private
int
creditor
;
public
FinancialAccount
(
AbstarctEmployee
owner
,
int
amount
)
{
this
.
owner
=
owner
;
this
.
stock
=
amount
;
this
.
creditor
=
0
;
}
public
AbstarctEmployee
getOwner
()
{
return
owner
;
}
public
int
getCreditor
()
{
return
creditor
;
}
public
void
setCreditor
(
int
creditor
)
{
this
.
creditor
+=
creditor
;
}
public
void
setStock
(
int
stock
)
{
this
.
stock
+=
stock
;
}
public
void
checkOut
(
int
amount
)
{
this
.
stock
+=
amount
;
this
.
creditor
=
0
;
}
}
src/org/university/core/FinancialSystem.java
0 → 100644
View file @
d5277887
package
org
.
university
.
core
;
import
java.util.ArrayList
;
public
class
FinancialSystem
{
private
int
stock
;
private
ArrayList
<
FinancialAccount
>
financialAccounts
;
private
ArrayList
<
Payroll
>
payrolls
;
public
void
addAccount
(
FinancialAccount
account
)
{
this
.
financialAccounts
.
add
(
account
);
}
public
void
checkOut
(
FinancialAccount
account
)
{
this
.
stock
-=
account
.
getCreditor
();
account
.
checkOut
(
account
.
getCreditor
());
}
public
void
settle
(
AccountingInterface
employee
)
{
for
(
FinancialAccount
fc
:
financialAccounts
)
{
if
(
fc
.
getOwner
()
==
employee
)
{
if
(
fc
.
getCreditor
()
>
0
)
{
this
.
stock
-=
fc
.
getCreditor
();
fc
.
checkOut
(
fc
.
getCreditor
());
}
}
}
}
}
src/org/university/core/Main.java
View file @
d5277887
...
...
@@ -3,6 +3,6 @@ package org.university.core;
public
class
Main
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
"
Hello World
!"
);
System
.
out
.
println
(
"
This is not the real main
!"
);
}
}
src/org/university/core/Master.java
View file @
d5277887
...
...
@@ -5,13 +5,23 @@ import java.util.ArrayList;
public
class
Master
extends
Student
{
private
ArrayList
<
Essay
>
essays
;
private
Teacher
teacher
;
public
Master
(
String
firstName
,
String
lastName
,
String
ID
,
int
joiningYear
,
Department
department
,
ArrayList
<
Course
>
courses
,
ArrayList
<
Essay
>
essays
)
{
public
Master
(
String
firstName
,
String
lastName
,
String
ID
,
int
joiningYear
,
Department
department
,
ArrayList
<
Course
>
courses
,
ArrayList
<
Essay
>
essays
,
Teacher
teacher
)
{
super
(
firstName
,
lastName
,
ID
,
joiningYear
,
department
,
courses
);
this
.
essays
=
essays
;
this
.
teacher
=
teacher
;
}
public
ArrayList
<
Essay
>
getEssays
()
{
return
essays
;
}
public
void
addEssay
(
Essay
essay
)
{
this
.
essays
.
add
(
essay
);
}
public
Teacher
getTeacher
()
{
return
teacher
;
}
}
src/org/university/core/Payroll.java
View file @
d5277887
...
...
@@ -5,7 +5,14 @@ public class Payroll {
private
int
id
;
private
int
income
;
private
int
date
;
private
Person
owner
;
private
AbstarctEmployee
owner
;
public
Payroll
(
int
id
,
int
income
,
int
date
,
AbstarctEmployee
owner
)
{
this
.
id
=
id
;
this
.
income
=
income
;
this
.
date
=
date
;
this
.
owner
=
owner
;
}
public
int
getIncome
()
{
return
income
;
...
...
@@ -19,7 +26,7 @@ public class Payroll {
return
date
;
}
public
Person
getOwner
()
{
public
AbstarctEmployee
getOwner
()
{
return
owner
;
}
}
src/org/university/core/ServiceEmployee.java
View file @
d5277887
...
...
@@ -4,17 +4,41 @@ import java.util.ArrayList;
public
class
ServiceEmployee
extends
AbstarctEmployee
{
public
ServiceEmployee
(
String
firstName
,
String
lastName
,
String
ID
,
int
joiningYear
,
Department
department
,
int
defPay
,
ArrayList
<
Payroll
>
payrolls
)
{
super
(
firstName
,
lastName
,
ID
,
joiningYear
,
department
,
defPay
,
payrolls
);
int
overTime
;
int
passedDays
;
public
ServiceEmployee
(
String
firstName
,
String
lastName
,
String
ID
,
int
joiningYear
,
Department
department
,
int
defPay
,
ArrayList
<
Payroll
>
payrolls
,
String
state
)
{
super
(
firstName
,
lastName
,
ID
,
joiningYear
,
department
,
defPay
,
payrolls
,
state
);
this
.
overTime
=
0
;
this
.
passedDays
=
0
;
}
public
int
incomeCalculate
()
{
public
void
setPassedDays
(
int
passedDays
)
{
this
.
passedDays
+=
passedDays
;
}
public
int
incomeCalculate
()
{
this
.
income
=
(
overTime
*
500
)
+
this
.
defPay
;
return
this
.
income
;
}
@Override
public
boolean
isPromoteable
()
{
if
(
this
.
passedDays
>
365
*
3
)
{
this
.
passedDays
=
0
;
return
true
;
}
else
return
false
;
}
@Override
public
int
calCurrentIncome
()
{
return
0
;
}
@Override
public
AbstarctEmployee
callEmployee
()
{
return
null
;
}
}
src/org/university/core/Student.java
View file @
d5277887
...
...
@@ -11,6 +11,10 @@ public class Student extends Person {
this
.
courses
=
courses
;
}
public
void
addCourse
(
Course
course
)
{
courses
.
add
(
course
);
}
public
ArrayList
<
Course
>
getCourses
()
{
return
this
.
courses
;
}
...
...
src/org/university/core/Teacher.java
View file @
d5277887
...
...
@@ -5,25 +5,51 @@ import java.util.ArrayList;
public
class
Teacher
extends
AbstarctEmployee
{
private
ArrayList
<
Course
>
courses
;
private
ArrayList
<
Essay
>
essays
;
private
String
group
;
public
Teacher
(
String
firstName
,
String
lastName
,
String
ID
,
int
joiningYear
,
Department
department
,
int
defPay
,
ArrayList
<
Payroll
>
payrolls
,
ArrayList
<
Course
>
courses
)
{
super
(
firstName
,
lastName
,
ID
,
joiningYear
,
department
,
defPay
,
payrolls
);
public
Teacher
(
String
firstName
,
String
lastName
,
String
ID
,
int
joiningYear
,
Department
department
,
int
defPay
,
ArrayList
<
Payroll
>
payrolls
,
String
state
,
String
group
)
{
super
(
firstName
,
lastName
,
ID
,
joiningYear
,
department
,
defPay
,
payrolls
,
state
);
this
.
courses
=
courses
;
this
.
group
=
group
;
}
private
void
addCourse
(
Course
course
)
{
this
.
courses
.
add
(
course
);
}
private
void
removeCourse
(
Course
course
){
private
void
removeCourse
(
Course
course
)
{
this
.
courses
.
remove
(
course
);
}
public
int
incomeCalculate
(){
public
void
addEssay
(
Essay
essay
)
{
this
.
essays
.
add
(
essay
);
}
public
ArrayList
<
Essay
>
getEssays
()
{
return
essays
;
}
public
int
incomeCalculate
()
{
this
.
income
=
(
this
.
essays
.
size
()
*
1000
)
+
this
.
defPay
;
return
this
.
income
;
}
@Override
public
boolean
isPromoteable
()
{
if
(
essays
.
size
()
>
10
)
return
true
;
else
return
false
;
}
@Override
public
int
calCurrentIncome
()
{
return
0
;
}
@Override
public
AbstarctEmployee
callEmployee
()
{
return
null
;
}
}
src/org/university/core/Type.java
0 → 100644
View file @
d5277887
package
org
.
university
.
core
;
public
class
Type
{
private
String
type
;
public
Type
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getType
()
{
return
type
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment