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
9731088
lab9
Commits
03ae383a
Commit
03ae383a
authored
May 17, 2019
by
Roham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Third
parent
64450784
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
183 additions
and
55 deletions
+183
-55
Account.java
src/org/university/core/Account.java
+0
-12
AccountInterface.java
src/org/university/core/AccountInterface.java
+11
-0
AccountingManagement.java
src/org/university/core/AccountingManagement.java
+9
-9
Course.java
src/org/university/core/Course.java
+1
-1
Employee.java
src/org/university/core/Employee.java
+6
-5
GradStudent.java
src/org/university/core/GradStudent.java
+38
-2
Person.java
src/org/university/core/Person.java
+3
-1
Professor.java
src/org/university/core/Professor.java
+56
-14
ServiceEmployee.java
src/org/university/core/ServiceEmployee.java
+55
-7
Statement.java
src/org/university/core/Statement.java
+4
-4
No files found.
src/org/university/core/Account.java
View file @
03ae383a
...
...
@@ -8,16 +8,4 @@ public class Account {
this
.
employee
=
employee
;
balance
=
0
;
}
public
void
checkout
(
double
income
){
balance
+=
income
;
}
public
Employee
getEmployee
()
{
return
employee
;
}
public
double
getBalance
()
{
return
balance
;
}
}
src/org/university/core/AccountInterface.java
0 → 100644
View file @
03ae383a
package
org
.
university
.
core
;
public
interface
AccountInterface
{
public
double
checkout
();
public
double
getBalance
();
public
double
calCurrentIncome
();
public
Person
getSender
();
}
src/org/university/core/AccountingManagement.java
View file @
03ae383a
...
...
@@ -3,7 +3,7 @@ package org.university.core;
import
java.util.ArrayList
;
public
class
AccountingManagement
{
private
ArrayList
<
Account
>
accounts
;
private
ArrayList
<
Account
Interface
>
accounts
;
private
ArrayList
<
Statement
>
transactions
;
public
AccountingManagement
()
{
...
...
@@ -11,16 +11,16 @@ public class AccountingManagement {
this
.
transactions
=
new
ArrayList
<>();
}
public
void
addAccount
(
Account
account
)
{
public
void
addAccount
(
AccountInterface
account
)
{
this
.
accounts
.
add
(
account
);
}
public
void
settle
()
{
for
(
int
i
=
0
;
i
<
accounts
.
size
();
i
++)
{
accounts
.
get
(
i
).
checkout
(
accounts
.
get
(
i
).
getEmployee
().
calCurrentIncome
()
+
accounts
.
get
(
i
).
getEmployee
().
getBasicIncome
());
transactions
.
add
(
new
Statement
(
accounts
.
get
(
i
).
getEmployee
().
calCurrentIncome
()
+
accounts
.
get
(
i
).
getEmployee
().
getBasicIncome
()
,
accounts
.
get
(
i
).
getEmployee
()));
public
void
settle
()
{
for
(
int
i
=
0
;
i
<
accounts
.
size
();
i
++)
{
double
income
=
0
;
income
+=
accounts
.
get
(
i
).
checkout
();
income
+=
accounts
.
get
(
i
).
calCurrentIncome
();
transactions
.
add
(
new
Statement
(
income
,
accounts
.
get
(
i
).
getSender
()));
}
}
...
...
src/org/university/core/Course.java
View file @
03ae383a
...
...
@@ -38,7 +38,7 @@ public class Course {
return
students
;
}
public
void
addStudent
(
Student
student
){
public
void
addStudent
(
Student
student
)
{
this
.
students
.
add
(
student
);
}
}
src/org/university/core/Employee.java
View file @
03ae383a
...
...
@@ -7,16 +7,18 @@ public abstract class Employee extends Person {
protected
String
position
;
protected
double
basicIncome
;
protected
double
requiredIncome
;
protected
double
balance
;
public
Employee
(
String
firstName
,
String
lastName
,
String
id
,
int
joiningYear
,
Department
department
,
String
position
,
double
basicIncome
)
{
super
(
firstName
,
lastName
,
id
,
joiningYear
,
department
);
public
Employee
(
String
firstName
,
String
lastName
,
String
id
,
int
joiningYear
,
Department
department
,
String
position
,
double
basicIncome
,
int
currentYear
)
{
super
(
firstName
,
lastName
,
id
,
joiningYear
,
department
,
currentYear
);
this
.
position
=
position
;
this
.
bankStatements
=
new
ArrayList
<>();
this
.
basicIncome
=
basicIncome
;
this
.
balance
=
0
;
}
public
void
addBankStatements
(
Statement
s
)
{
public
void
addBankStatements
(
Statement
s
)
{
this
.
bankStatements
.
add
(
s
);
}
...
...
@@ -36,6 +38,5 @@ public abstract class Employee extends Person {
return
basicIncome
;
}
public
abstract
double
calCurrentIncome
();
public
abstract
Boolean
isPromotable
();
}
src/org/university/core/GradStudent.java
View file @
03ae383a
...
...
@@ -2,15 +2,18 @@ package org.university.core;
import
java.util.ArrayList
;
public
class
GradStudent
extends
Student
{
public
class
GradStudent
extends
Student
implements
AccountInterface
{
private
ArrayList
<
Publication
>
publications
;
private
Professor
advisor
;
private
double
balance
;
private
double
requiredIncome
;
private
double
basicIncome
;
public
GradStudent
(
String
firstName
,
String
lastName
,
String
id
,
int
joiningYear
,
Department
department
,
ArrayList
<
Course
>
courses
,
Professor
advisor
)
{
super
(
firstName
,
lastName
,
id
,
joiningYear
,
department
,
courses
);
this
.
publications
=
publications
;
this
.
publications
=
new
ArrayList
<
Publication
>();
this
.
advisor
=
advisor
;
this
.
balance
=
0
;
}
public
ArrayList
<
Publication
>
getPublications
()
{
...
...
@@ -21,4 +24,37 @@ public class GradStudent extends Student {
{
this
.
publications
.
add
(
publication
);
}
public
void
setRequiredIncome
(
double
requiredIncome
)
{
this
.
requiredIncome
=
requiredIncome
;
}
public
void
setBasicIncome
(
double
basicIncome
)
{
this
.
basicIncome
=
basicIncome
;
}
@Override
public
double
checkout
()
{
this
.
balance
+=
requiredIncome
;
return
requiredIncome
;
}
@Override
public
double
getBalance
()
{
return
balance
;
}
@Override
public
double
calCurrentIncome
()
{
this
.
balance
+=
basicIncome
+
publications
.
size
()
*
1000
;
return
basicIncome
+
publications
.
size
()
*
1000
;
}
@Override
public
Person
getSender
()
{
return
this
;
}
}
src/org/university/core/Person.java
View file @
03ae383a
...
...
@@ -6,13 +6,15 @@ public class Person {
protected
String
id
;
protected
int
joiningYear
;
protected
Department
department
;
protected
int
currentYear
;
public
Person
(
String
firstName
,
String
lastName
,
String
id
,
int
joiningYear
,
Department
department
)
{
public
Person
(
String
firstName
,
String
lastName
,
String
id
,
int
joiningYear
,
Department
department
,
int
currentYear
)
{
this
.
firstName
=
firstName
;
this
.
lastName
=
lastName
;
this
.
id
=
id
;
this
.
joiningYear
=
joiningYear
;
this
.
department
=
department
;
this
.
currentYear
=
currentYear
;
}
public
String
getFirstName
()
{
...
...
src/org/university/core/Professor.java
View file @
03ae383a
...
...
@@ -2,40 +2,82 @@ package org.university.core;
import
java.util.ArrayList
;
public
class
Professor
extends
Employee
{
public
class
Professor
extends
Employee
implements
AccountInterface
{
private
ArrayList
<
Course
>
courses
;
private
ArrayList
<
Publication
>
publications
;
private
String
group
;
private
int
articles
;
public
Professor
(
String
firstName
,
String
lastName
,
String
id
,
int
joiningYear
,
Department
department
,
String
position
,
double
basicIncome
,
String
group
)
{
super
(
firstName
,
lastName
,
id
,
joiningYear
,
department
,
position
,
basicIncome
);
public
Professor
(
String
firstName
,
String
lastName
,
String
id
,
int
joiningYear
,
Department
department
,
String
position
,
double
basicIncome
,
String
group
,
int
currentYear
,
int
articles
)
{
super
(
firstName
,
lastName
,
id
,
joiningYear
,
department
,
position
,
basicIncome
,
currentYear
);
this
.
group
=
group
;
this
.
courses
=
new
ArrayList
<
Course
>();
this
.
courses
=
new
ArrayList
<>();
this
.
publications
=
new
ArrayList
<>();
this
.
articles
=
articles
;
}
public
double
getCurrentIncome
()
{
public
double
getCurrentIncome
()
{
return
super
.
basicIncome
;
}
public
ArrayList
<
Course
>
getCourses
()
{
public
ArrayList
<
Course
>
getCourses
()
{
return
this
.
courses
;
}
public
void
addCourse
(
Course
course
)
{
public
ArrayList
<
Publication
>
getPublications
()
{
return
publications
;
}
public
void
addCourse
(
Course
course
)
{
this
.
courses
.
add
(
course
);
}
public
void
addPublication
(
Publication
publication
)
{
this
.
publications
.
add
(
publication
);
}
public
String
getGroup
()
{
return
group
;
}
public
double
calCurrentIncome
()
{
public
int
getArticles
()
{
return
articles
;
}
@Override
public
double
checkout
()
{
this
.
balance
+=
requiredIncome
;
return
requiredIncome
;
}
public
Boolean
isPromotable
()
{
@Override
public
double
getBalance
()
{
return
balance
;
}
@Override
public
double
calCurrentIncome
()
{
this
.
balance
+=
basicIncome
+
publications
.
size
()
*
1000
;
return
basicIncome
+
publications
.
size
()
*
1000
;
}
@Override
public
double
getBasicIncome
()
{
return
basicIncome
;
}
@Override
public
Person
getSender
()
{
return
this
;
}
public
Boolean
isPromotable
()
{
if
(
articles
-
publications
.
size
()
==
10
)
{
articles
=
publications
.
size
();
return
true
;
}
return
false
;
}
}
src/org/university/core/ServiceEmployee.java
View file @
03ae383a
package
org
.
university
.
core
;
public
class
ServiceEmployee
extends
Employee
{
public
ServiceEmployee
(
String
firstName
,
String
lastName
,
String
id
,
int
joiningYear
,
Department
department
,
String
position
,
double
basicIncome
)
{
super
(
firstName
,
lastName
,
id
,
joiningYear
,
department
,
position
,
basicIncome
);
public
class
ServiceEmployee
extends
Employee
implements
AccountInterface
{
private
int
extraDays
;
private
int
promotionYear
;
public
ServiceEmployee
(
String
firstName
,
String
lastName
,
String
id
,
int
joiningYear
,
Department
department
,
int
currentYear
,
String
position
,
double
basicIncome
,
int
extraDays
,
int
promotionYear
)
{
super
(
firstName
,
lastName
,
id
,
joiningYear
,
department
,
position
,
basicIncome
,
currentYear
);
this
.
extraDays
=
extraDays
;
this
.
promotionYear
=
promotionYear
;
}
public
double
calCurrentIncome
()
{
public
int
getPromotionYear
()
{
return
promotionYear
;
}
public
void
setPromotionYear
(
int
promotionYear
)
{
this
.
promotionYear
=
promotionYear
;
}
public
int
getExtraDays
()
{
return
extraDays
;
}
public
void
setExtraDays
(
int
extraDays
)
{
this
.
extraDays
=
extraDays
;
}
@Override
public
double
checkout
()
{
this
.
balance
+=
requiredIncome
;
return
requiredIncome
;
}
public
Boolean
isPromotable
()
{
@Override
public
double
getBalance
()
{
return
balance
;
}
@Override
public
double
calCurrentIncome
()
{
this
.
balance
+=
basicIncome
+
extraDays
*
500
;
return
basicIncome
+
extraDays
*
500
;
}
@Override
public
double
getBasicIncome
()
{
return
basicIncome
;
}
@Override
public
Person
getSender
()
{
return
this
;
}
public
Boolean
isPromotable
()
{
if
(
currentYear
-
promotionYear
==
3
)
{
promotionYear
=
currentYear
;
return
true
;
}
return
false
;
}
}
src/org/university/core/Statement.java
View file @
03ae383a
...
...
@@ -2,9 +2,9 @@ package org.university.core;
public
class
Statement
{
private
double
amount
;
Employee
reciever
;
Person
reciever
;
public
Statement
(
double
amount
,
Employee
reciever
)
{
public
Statement
(
double
amount
,
Person
reciever
)
{
this
.
amount
=
amount
;
this
.
reciever
=
reciever
;
}
...
...
@@ -13,7 +13,7 @@ public class Statement {
return
amount
;
}
public
Employee
getReciever
()
{
public
Person
getReciever
()
{
return
reciever
;
}
...
...
@@ -21,7 +21,7 @@ public class Statement {
this
.
amount
=
amount
;
}
public
void
setReciever
(
Employee
reciever
)
{
public
void
setReciever
(
Person
reciever
)
{
this
.
reciever
=
reciever
;
}
}
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