Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
B
Behnam Va Turkashvand-Jalase 2
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
9831133
Behnam Va Turkashvand-Jalase 2
Commits
a4ba78a6
Commit
a4ba78a6
authored
Mar 07, 2020
by
9831133
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Lab.java
parent
b32b0f8a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
11 deletions
+28
-11
Lab.java
Lab.java
+28
-11
No files found.
Lab.java
View file @
a4ba78a6
public
class
Lab
{
Student
[]
students
=
new
Student
[
6
];
private
int
avg
;
// the average
private
String
day
;
// the day
private
int
capacity
;
// the capacity of the class
private
int
currentSize
;
// the current size of the class
public
Lab
(
int
cap
,
String
d
){
capacity
=
cap
;
day
=
d
;
currentSize
=
0
;
capacity
=
cap
;
day
=
d
;
currentSize
=
0
;
}
public
void
calculateavg
(){
int
x
;
int
sum
=
0
;
for
(
int
i
=
0
;
i
<
3
;
i
++){
x
=
students
[
i
].
getGrade
();
sum
=
sum
+
x
;
int
x
;
int
sum
=
0
;
for
(
int
i
=
0
;
i
<
3
;
i
++){
x
=
students
[
i
].
getGrade
();
sum
=
sum
+
x
;
}
avg
=
sum
/
3
;
}
/**
* @param calculateavg set find average
*/
// This function calculates the average
public
void
enrollStudent
(
Student
std
)
{
if
(
currentSize
<
capacity
)
{
students
[
currentSize
]
=
std
;
...
...
@@ -29,29 +31,44 @@ public void enrollStudent(Student std) {
System
.
out
.
println
(
"Lab is full!!!"
);
}
}
// This function checks the capacity of the class
public
void
print
()
{
System
.
out
.
println
(
"avg="
+
avg
+
"tedad"
+
currentSize
);
}
// A function for printing
public
Student
[]
getStudents
()
{
return
students
;
}
/**
* @param students The students of the class
*/
public
void
setStudents
(
Student
[]
students
)
{
this
.
students
=
students
;
}
public
int
getAvg
()
{
return
avg
;
}
/**
* @param avg The average of grades
*/
// A function for getting the average
public
String
getDay
()
{
return
day
;
}
/**
* @param day day of the year
*/
// A function for getting the day
public
void
setDay
(
String
day
)
{
this
.
day
=
day
;
}
public
int
getCapacity
()
{
return
capacity
;
}
// A function that gets the capacity
public
void
setCapacity
(
int
capacity
)
{
this
.
capacity
=
capacity
;
}
// A function that sets the capacity
}
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