/** * The Lab class have the whole datails of all studentsof the lab . * * @authr Saba * @version 0.0 */ package com.company; public class Lab{ //array of students private Student[] students; //the average of the lab private int avg; //the capacity of the lab private int capacity; //the current size of the lab private int currentSize; //the day of the lab private String day; /** * create a new lab with given capacity and day. * @param cap capacity of the lab * @param d day of the lab */ public Lab(int cap,String d){ students = new Student[cap]; avg = 0; capacity = cap; day = d; currentSize = 0; } /** * adds students to the lab. * @param std new student which is going to be added */ public void enrollStudent(Student std){ if (currentSize < capacity){ students[currentSize] = std ; currentSize++; } else System.out.println("lab is full!"); } /** * get the students of the lab. * @return students field */ public Student[] getStudents(){ return students; } /** * set the students * @param stds students */ public void setStudents(Student[] stds){ students = stds; } /** * set the average of the students. * @return avg field */ public int getAvg(){ return avg; } /** * calculates the average of the lab based on students' grades. */ public void calculateAvg(){ int sum = 0; for (int i=0 ; i