Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
lab2
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
9731001
lab2
Commits
ef49f3a2
Commit
ef49f3a2
authored
May 14, 2019
by
9731001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lab-2
parents
Pipeline
#605
failed with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
0 deletions
+72
-0
Lab.java
Lab.java
+27
-0
Main.java
Main.java
+18
-0
Student.java
Student.java
+27
-0
No files found.
Lab.java
0 → 100644
View file @
ef49f3a2
package
com
.
company
;
public
class
Lab
{
private
int
dayOfTheWeek
;
private
int
currenCapacity
=
0
;
private
int
capacity
;
Student
[]
students
;
public
Lab
(
int
capacity
,
int
dayOfTheWeek
){
this
.
capacity
=
capacity
;
students
=
new
Student
[
capacity
];
}
public
void
enrollStudent
(
Student
std
){
if
(
currenCapacity
<
capacity
){
students
[
currenCapacity
]
=
std
;
currenCapacity
++;
}
}
public
float
getAverage
(){
int
i
;
float
sum
=
0
;
for
(
i
=
0
;
i
<
capacity
;
i
++){
sum
=
sum
+
students
[
i
].
getGrade
();
}
float
m
=
sum
/
capacity
;
return
m
;
}
}
Main.java
0 → 100644
View file @
ef49f3a2
package
com
.
company
;
public
class
Main
{
public
static
void
main
(
String
[]
args
)
{
Student
s1
=
new
Student
(
"Fatemeh"
,
"Ahmadzadeh"
,
"9731001"
);
s1
.
setGrade
(
17
);
if
(
s1
.
getFirstName
()==
"Fatemeh"
);
System
.
out
.
println
(
"true"
);
Student
s2
=
new
Student
(
"Zahra"
,
"Ahmadzadeh"
,
"9731010"
);
s2
.
setGrade
(
18
);
Lab
test1
=
new
Lab
(
2
,
1
);
test1
.
enrollStudent
(
s1
);
test1
.
enrollStudent
(
s2
);
float
miangin
=
test1
.
getAverage
();
System
.
out
.
println
(
miangin
);
}
}
Student.java
0 → 100644
View file @
ef49f3a2
package
com
.
company
;
public
class
Student
{
private
String
firstName
;
private
String
lastName
;
private
String
studentNo
;
private
float
grade
;
public
void
setFirstName
(
String
firstName
){
this
.
firstName
=
firstName
;
}
public
void
setLastName
(
String
lastName
){
this
.
lastName
=
lastName
;
}
public
void
setStudentNO
(
String
studentNo
){
this
.
studentNo
=
studentNo
;
}
public
void
setGrade
(
float
grade
){
this
.
grade
=
grade
;
}
public
Student
(
String
firstName
,
String
lastName
,
String
studentNo
){}
public
String
getFirstName
(){
return
""
;
}
public
float
getGrade
(){
return
grade
;
}
}
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