Commit 0173a004 authored by 9831017's avatar 9831017

Upload New File

parent 0a561aa5
Pipeline #2091 canceled with stages
public class Lab{
Student[] students= new Student[6];
private int avg;
private String day;
private int capacity;
private int currentSize;
public Lab(int cap,String d){
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;
}
avg=sum/3;
}
public void enrollStudent(Student std) {
if (currentSize < capacity) {
students[currentSize] = std;
currentSize++;
} else {
System.out.println("Lab is full!!!");
}
}
public void print() {
System.out.println("avg="+avg+"tedad"+currentSize);
}
public Student[] getStudents() {
return students;
}
public void setStudents(Student[] students) {
this. students=students;
}
public int getAvg() {
return avg;
}
public String getDay() {
return day;
}
public void setDay(String day) {
this. day=day;
}
public int getCapacity() {
return capacity;
}
public void setCapacity(int capacity) {
this. capacity=capacity;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment