Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
APLAB-SESSION9
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
9731044
APLAB-SESSION9
Commits
6744c3ef
Commit
6744c3ef
authored
May 14, 2019
by
9731044
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
second commit
parent
54f71a19
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
163 additions
and
13 deletions
+163
-13
AbstractEmployee.java
src/org/university/core/AbstractEmployee.java
+25
-3
Account.java
src/org/university/core/Account.java
+15
-1
AccountingInterface.java
src/org/university/core/AccountingInterface.java
+8
-0
AccountingManagement.java
src/org/university/core/AccountingManagement.java
+22
-0
Article.java
src/org/university/core/Article.java
+16
-0
GraduateStudent.java
src/org/university/core/GraduateStudent.java
+27
-1
Person.java
src/org/university/core/Person.java
+9
-0
Professor.java
src/org/university/core/Professor.java
+5
-8
ServiceEmployee.java
src/org/university/core/ServiceEmployee.java
+5
-0
Statement.java
src/org/university/core/Statement.java
+29
-0
Undergrad.java
src/org/university/core/Undergrad.java
+2
-0
No files found.
src/org/university/core/AbstractEmployee.java
View file @
6744c3ef
...
@@ -2,7 +2,7 @@ package org.university.core;
...
@@ -2,7 +2,7 @@ package org.university.core;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
public
abstract
class
AbstractEmployee
extends
Person
{
public
abstract
class
AbstractEmployee
extends
Person
implements
AccountingInterface
{
ArrayList
<
Statement
>
bankStatements
;
ArrayList
<
Statement
>
bankStatements
;
String
position
;
String
position
;
double
basicIncome
,
currentIncome
;
double
basicIncome
,
currentIncome
;
...
@@ -13,6 +13,29 @@ public abstract class AbstractEmployee extends Person{
...
@@ -13,6 +13,29 @@ public abstract class AbstractEmployee extends Person{
this
.
basicIncome
=
basicIncome
;
this
.
basicIncome
=
basicIncome
;
bankStatements
=
new
ArrayList
<>();
bankStatements
=
new
ArrayList
<>();
}
}
public
abstract
boolean
isPromotable
();
public
abstract
double
calCurrentIncome
();
@Override
public
AbstractEmployee
callEmployee
()
{
return
this
;
}
@Override
public
double
callCurrentIncome
()
{
return
callCurrentIncome
();
}
public
void
setBasicIncome
(
double
basicIncome
)
{
this
.
basicIncome
=
basicIncome
;
}
public
double
getBasicIncome
()
{
return
basicIncome
;
}
public
void
setPosition
(
String
p
)
{
this
.
position
=
p
;
}
public
String
getPosition
()
{
public
String
getPosition
()
{
return
position
;
return
position
;
...
@@ -30,7 +53,6 @@ public abstract class AbstractEmployee extends Person{
...
@@ -30,7 +53,6 @@ public abstract class AbstractEmployee extends Person{
this
.
currentIncome
=
currentIncome
;
this
.
currentIncome
=
currentIncome
;
}
}
public
abstract
double
calCurrentIncome
();
...
...
src/org/university/core/Account.java
View file @
6744c3ef
package
org
.
university
.
core
;
package
org
.
university
.
core
;
import
java.util.ArrayList
;
public
class
Account
{
public
class
Account
{
private
AbstractEmployee
owner
;
private
AbstractEmployee
owner
;
double
credit
;
private
double
credit
;
public
boolean
flag
=
true
;
public
Account
(
AbstractEmployee
owner
,
double
credit
)
{
public
Account
(
AbstractEmployee
owner
,
double
credit
)
{
this
.
credit
=
credit
;
this
.
credit
=
credit
;
...
@@ -11,6 +15,14 @@ public class Account {
...
@@ -11,6 +15,14 @@ public class Account {
this
.
credit
=
0
;
this
.
credit
=
0
;
}
}
private
void
checkout
(
AbstractEmployee
e
)
{
credit
+=
e
.
calCurrentIncome
();
setCredit
(
credit
);
flag
=
false
;
}
public
AbstractEmployee
getOwner
()
{
public
AbstractEmployee
getOwner
()
{
return
owner
;
return
owner
;
}
}
...
@@ -26,4 +38,6 @@ public class Account {
...
@@ -26,4 +38,6 @@ public class Account {
}
}
src/org/university/core/AccountingInterface.java
0 → 100644
View file @
6744c3ef
package
org
.
university
.
core
;
public
interface
AccountingInterface
{
public
AbstractEmployee
callEmployee
();
public
double
callCurrentIncome
();
}
src/org/university/core/AccountingManagement.java
View file @
6744c3ef
package
org
.
university
.
core
;
package
org
.
university
.
core
;
import
java.util.ArrayList
;
public
class
AccountingManagement
{
public
class
AccountingManagement
{
private
ArrayList
<
Account
>
accounts
;
private
ArrayList
<
Statement
>
statements
;
public
void
settle
(
AccountingInterface
employee
)
{
for
(
Account
account:
accounts
)
{
if
(
account
.
getOwner
()==
employee
)
{
double
amount
=
employee
.
callCurrentIncome
();
account
.
setCredit
(
account
.
getCredit
()+
amount
);
Statement
s
=
new
Statement
(
employee
.
callEmployee
(),
amount
);
statements
.
add
(
s
);
}
}
}
public
ArrayList
<
Statement
>
getStatements
(){
return
statements
;
}
}
}
src/org/university/core/Article.java
View file @
6744c3ef
...
@@ -2,4 +2,20 @@ package org.university.core;
...
@@ -2,4 +2,20 @@ package org.university.core;
public
class
Article
{
public
class
Article
{
String
name
;
String
datePublished
;
public
Article
(
String
name
,
String
datePublished
)
{
this
.
name
=
name
;
this
.
datePublished
=
datePublished
;
}
public
String
getName
()
{
return
name
;
}
public
String
getDate
()
{
return
datePublished
;
}
}
}
src/org/university/core/GraduateStudent.java
View file @
6744c3ef
package
org
.
university
.
core
;
package
org
.
university
.
core
;
public
class
GraduateStudent
{
import
java.util.ArrayList
;
public
class
GraduateStudent
extends
Student
{
ArrayList
<
Article
>
articles
;
Professor
advisor
;
public
GraduateStudent
(
String
firstName
,
String
lastName
,
String
ID
,
int
joiningYear
,
Department
department
,
Professor
advisor
)
{
super
(
firstName
,
lastName
,
ID
,
joiningYear
,
department
);
articles
=
new
ArrayList
<>();
this
.
advisor
=
advisor
;
}
public
void
addArticle
(
Article
a
)
{
articles
.
add
(
a
);
}
public
ArrayList
<
Article
>
getArticle
(){
return
articles
;
}
public
Professor
getAdvisor
()
{
return
advisor
;
}
}
}
src/org/university/core/Person.java
View file @
6744c3ef
...
@@ -31,5 +31,14 @@ public class Person {
...
@@ -31,5 +31,14 @@ public class Person {
return
department
;
return
department
;
}
}
public
void
setDepartment
(
Department
d
)
{
this
.
department
=
d
;
}
// public AbstractEmployee callEmployee() {
// return null;
// }
}
}
src/org/university/core/Professor.java
View file @
6744c3ef
...
@@ -15,18 +15,10 @@ public class Professor extends AbstractEmployee {
...
@@ -15,18 +15,10 @@ public class Professor extends AbstractEmployee {
articles
=
new
ArrayList
<>();
articles
=
new
ArrayList
<>();
}
}
public
void
setPosition
(
String
position
)
{
this
.
position
=
position
;
}
public
void
setGroup
(
String
group
)
{
public
void
setGroup
(
String
group
)
{
this
.
group
=
group
;
this
.
group
=
group
;
}
}
public
void
setBasicIncome
(
double
basicIncome
)
{
this
.
basicIncome
=
basicIncome
;
}
public
void
addCourse
(
Course
c
)
{
public
void
addCourse
(
Course
c
)
{
courses
.
add
(
c
);
courses
.
add
(
c
);
}
}
...
@@ -50,5 +42,10 @@ public class Professor extends AbstractEmployee {
...
@@ -50,5 +42,10 @@ public class Professor extends AbstractEmployee {
}
}
@Override
public
boolean
isPromotable
()
{
return
false
;
}
}
}
src/org/university/core/ServiceEmployee.java
View file @
6744c3ef
...
@@ -14,6 +14,11 @@ public class ServiceEmployee extends AbstractEmployee {
...
@@ -14,6 +14,11 @@ public class ServiceEmployee extends AbstractEmployee {
}
}
@Override
public
boolean
isPromotable
()
{
return
false
;
}
...
...
src/org/university/core/Statement.java
View file @
6744c3ef
package
org
.
university
.
core
;
package
org
.
university
.
core
;
public
class
Statement
{
public
class
Statement
{
AbstractEmployee
employee
;
double
paymentFee
;
String
paymentNo
;
String
paymentDate
;
public
Statement
(
AbstractEmployee
employee
,
double
paymentFee
)
{
this
.
employee
=
employee
;
this
.
paymentFee
=
paymentFee
;
}
public
void
setEmployee
(
AbstractEmployee
emp
)
{
this
.
employee
=
emp
;
}
public
AbstractEmployee
getEmployee
()
{
return
employee
;
}
public
void
setFee
(
double
amount
)
{
this
.
paymentFee
=
amount
;
}
public
double
getFee
()
{
return
paymentFee
;
}
}
}
src/org/university/core/Undergrad.java
View file @
6744c3ef
...
@@ -6,4 +6,6 @@ public class Undergrad extends Student {
...
@@ -6,4 +6,6 @@ public class Undergrad extends Student {
super
(
firstName
,
lastName
,
ID
,
joiningYear
,
department
);
super
(
firstName
,
lastName
,
ID
,
joiningYear
,
department
);
}
}
}
}
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