Commit 80b2a54c authored by nargessalehi98's avatar nargessalehi98

Faculty

parent 77f0cdfe
Pipeline #2467 canceled with stages
# Default ignored files
/workspace.xml
\ No newline at end of file
<html>Simple <b>Java</b> application that includes a class with <code>main()</code> method</html>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" value="$PROJECT_DIR$/javadoc" />
</component>
<component name="ProjectKey">
<option name="state" value="project://e2804f05-5315-4fc6-a121-c522a6c26470" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_13_PREVIEW" default="false" project-jdk-name="13" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Lab/Lab.iml" filepath="$PROJECT_DIR$/Lab/Lab.iml" />
<module fileurl="file://$PROJECT_DIR$/untitled104.iml" filepath="$PROJECT_DIR$/untitled104.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<template>
<input-field default="com.company">IJ_BASE_PACKAGE</input-field>
</template>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
File added
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
import java.sql.SQLOutput;
/**
* this Lab class present information about Lab student
*
* @author Narges
* @version 0.0
*/
public class Lab {
//the array of student's class
private Student[] students;
//the student average grade
private int avg;
// the day which lab take place
private String day;
// the capacity of the class
private int capacity;
// the current student whom register
private int currentSize;
/**
* creat a new lab with given capacity and day
*
* @param cap the capacity of the class
* @param d the day which lab take place
*/
public Lab(int cap, String d) {
students = new Student[cap];
day = d;
currentSize = 0;
}
/**
* assign student to this Lab
*
* @param std student's name
*/
public void enrollStudent(Student std) {
if (currentSize < students.length) {
students[currentSize++] = std;
} else {
System.out.println("Lab is full!!!");
}
}
/**
* print the student information and average grade
*/
public void print() {
for (Student student : students) {
System.out.println("std fname: " + student.getFirstName()
+ " std id:" + student.getId()
+ " std grade:" + student.getGrade());
}
System.out.println("Lab AVG:" + avg);
}
/**
* @return students
*/
public Student[] getStudents() {
return students;
}
/**
* @param students list of student
*/
public void setStudents(Student[] students) {
this.students = students;
}
/**
* @return avg the average of grades
*/
public int getAvg() {
return avg;
}
/**
* to calculate average of grades
*/
public void calculateAvg() {
avg = 0;
int counter = 0;
for (Student student : students) {
avg += student.getGrade();
counter++;
}
avg = avg / counter;
}
/**
* @return day of the lab
*/
public String getDay() {
return day;
}
/**
* @param day day of lab
*/
public void setDay(String day) {
this.day = day;
}
/**
* return capacity value
*
* @return capacity
*/
public int getCapacity() {
return students.length;
}
/**
* @param capacity change the value of capacity
*/
public void setCapacity(int capacity) {
this.capacity = capacity;
}
}
/**
* this class gives a test to the whole program and method is inside this class
* @author Lab Master
* @version 0.1
*/
public class Run {
public static void main(String[] args) {
Lab group4 = new Lab(3, "saturday");
Student std1 = new Student("Ehsan", "Edalat", "9031066");
Student std2 = new Student("Seyed", "Ahmadpanah", "9031806");
Student std3 = new Student("Ahmad", "Asadi", "9031054");
std1.print();
std1.setGrade(15);
std1.print();
std2.print();
std2.setGrade(11);
std2.print();
std3.print();
std3.setFirstName("HamidReza");
std3.print();
group4.enrollStudent(std1);
group4.enrollStudent(std2);
group4.enrollStudent(std3);
group4.calculateAvg();
//group4.print();
System.out.println("/student object before modify :" + std1);
System.out.println("/student first name befor modify :" + std1.getFirstName());
modifyObject(std1);
System.out.println("//student object after modify :" + std1);
System.out.println("//student first name after modify :" + std1.getFirstName());
}
public static Student modifyObject(Student student) {
System.out.println("student inside modify before new :" + student);
System.out.println("student first name inside modify before new :" + student.getFirstName());
student.setFirstName("narges");
student = new Student("maryam", "mohamadi", "9731022");
student.setFirstName("sanaz");
System.out.println("student inside modify after new :" + student);
System.out.println("student first name inside modify after new :" + student.getFirstName());
return student;
}
}
/**
* The Student class represents a student in a student
* administration system.
* It holds the student details relevant in our context. *
*
* @author Ehsan
* @version 0.0
*/
public class Student {
// the student’s first name
private String firstName;
// the student’s last name
private String lastName;
// the student ID
private String id;
//the grade
private int grade;
/**
* 
* Create a new student with a given name and ID number. *
*
* @param fName first name of student
* @param lname last name of student
* @param sID student ID
*/
public Student(String fName, String lname, String sID) {
firstName = fName;
lastName = lname;
id = sID;
grade = 0;
}
/**
* get the first name of student
*
* @return firstName field
*/
public String getFirstName() {
return firstName;
}
public String getId(){
return id;
}
public void setId(String id){
this.id=id;
}
public int getGrade(){
return grade;
}
/**
* @param fName set first name of a student
*/
public void setFirstName(String fName) {
firstName = fName;
}
/**
* Print the student’s last name and ID number to the output terminal.
*/
public void print() {
System.out.println(lastName + ", student ID: "
+ id + ", grade: " + grade);
}
/**
* *
* @param num set the grade of student
*/
public void setGrade(int num) {
grade = num;
}
}
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (13.0.2) on Thu Mar 12 20:08:21 IRST 2020 -->
<title>Run</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="dc.created" content="2020-03-12">
<meta name="description" content="declaration: class: Run">
<meta name="generator" content="javadoc/ClassWriterImpl">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="script-dir/jquery-ui.css" title="Style">
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="script-dir/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="script-dir/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="script-dir/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="script-dir/jquery-3.4.1.js"></script>
<script type="text/javascript" src="script-dir/jquery-ui.js"></script>
</head>
<body class="class-declaration">
<script type="text/javascript">var data = {"i0":9,"i1":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "./";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-files/index-1.html">Index</a></li>
<li><a href="help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<div class="navListSearch"><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</div>
</div>
<a id="skip.navbar.top">
<!-- -->
</a>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<h1 title="Class Run" class="title">Class Run</h1>
</div>
<div class="contentContainer">
<div class="inheritance" title="Inheritance Tree">java.lang.Object
<div class="inheritance">Run</div>
</div>
<section class="description">
<hr>
<pre>public class <span class="typeNameLabel">Run</span>
extends java.lang.Object</pre>
<div class="block">this class gives a test to the whole program and method is inside this class</div>
</section>
<section class="summary">
<ul class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<li class="blockList">
<section class="constructorSummary"><a id="constructor.summary">
<!-- -->
</a>
<h2>Constructor Summary</h2>
<div class="memberSummary">
<table>
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<thead>
<tr>
<th class="colFirst" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">Run</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
</tbody>
</table>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li class="blockList">
<section class="methodSummary"><a id="method.summary">
<!-- -->
</a>
<h2>Method Summary</h2>
<div class="memberSummary">
<div role="tablist" aria-orientation="horizontal"><button role="tab" aria-selected="true" aria-controls="memberSummary_tabpanel" tabindex="0" onkeydown="switchTab(event)" id="t0" class="activeTableTab">All Methods</button><button role="tab" aria-selected="false" aria-controls="memberSummary_tabpanel" tabindex="-1" onkeydown="switchTab(event)" id="t1" class="tableTab" onclick="show(1);">Static Methods</button><button role="tab" aria-selected="false" aria-controls="memberSummary_tabpanel" tabindex="-1" onkeydown="switchTab(event)" id="t4" class="tableTab" onclick="show(8);">Concrete Methods</button></div>
<div id="memberSummary_tabpanel" role="tabpanel">
<table aria-labelledby="t0">
<thead>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr class="altColor" id="i0">
<td class="colFirst"><code>static void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#main(java.lang.String%5B%5D)">main</a></span>&#8203;(java.lang.String[]&nbsp;args)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor" id="i1">
<td class="colFirst"><code>static <a href="Student.html" title="class in &lt;Unnamed&gt;">Student</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#modifyObject(Student)">modifyObject</a></span>&#8203;(<a href="Student.html" title="class in &lt;Unnamed&gt;">Student</a>&nbsp;student)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="inheritedList">
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<a id="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a><code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<li class="blockList">
<section class="constructorDetails"><a id="constructor.detail">
<!-- -->
</a>
<h2>Constructor Details</h2>
<ul class="blockList">
<li class="blockList">
<section class="detail">
<h3><a id="&lt;init&gt;()">Run</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="memberName">Run</span>()</div>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ METHOD DETAIL ========== -->
<li class="blockList">
<section class="methodDetails"><a id="method.detail">
<!-- -->
</a>
<h2>Method Details</h2>
<ul class="blockList">
<li class="blockList">
<section class="detail">
<h3><a id="main(java.lang.String[])">main</a></h3>
<div class="memberSignature"><span class="modifiers">public static</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">main</span>&#8203;(<span class="arguments">java.lang.String[]&nbsp;args)</span></div>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="modifyObject(Student)">modifyObject</a></h3>
<div class="memberSignature"><span class="modifiers">public static</span>&nbsp;<span class="returnType"><a href="Student.html" title="class in &lt;Unnamed&gt;">Student</a></span>&nbsp;<span class="memberName">modifyObject</span>&#8203;(<span class="arguments"><a href="Student.html" title="class in &lt;Unnamed&gt;">Student</a>&nbsp;student)</span></div>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-files/index-1.html">Index</a></li>
<li><a href="help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
</footer>
</body>
</html>
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (13.0.2) on Thu Mar 12 20:08:21 IRST 2020 -->
<title>S-Index</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="dc.created" content="2020-03-12">
<meta name="description" content="index: S">
<meta name="generator" content="javadoc/SplitIndexWriter">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../script-dir/jquery-ui.css" title="Style">
<script type="text/javascript" src="../script.js"></script>
<script type="text/javascript" src="../script-dir/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../script-dir/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../script-dir/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../script-dir/jquery-3.4.1.js"></script>
<script type="text/javascript" src="../script-dir/jquery-ui.js"></script>
</head>
<body class="split-index">
<script type="text/javascript">var pathtoroot = "../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../package-summary.html">Package</a></li>
<li>Class</li>
<li><a href="../overview-tree.html">Tree</a></li>
<li><a href="../deprecated-list.html">Deprecated</a></li>
<li class="navBarCell1Rev">Index</li>
<li><a href="../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<div class="navListSearch"><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</div>
</div>
<a id="skip.navbar.top">
<!-- -->
</a>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<main role="main">
<div class="header">
<h1>Index</h1>
</div>
<div class="contentContainer"><a href="index-1.html">A</a>&nbsp;<a href="index-2.html">C</a>&nbsp;<a href="index-3.html">E</a>&nbsp;<a href="index-4.html">F</a>&nbsp;<a href="index-5.html">G</a>&nbsp;<a href="index-6.html">H</a>&nbsp;<a href="index-7.html">I</a>&nbsp;<a href="index-8.html">L</a>&nbsp;<a href="index-9.html">M</a>&nbsp;<a href="index-10.html">P</a>&nbsp;<a href="index-11.html">R</a>&nbsp;<a href="index-12.html">S</a>&nbsp;<br><a href="../allclasses-index.html">All&nbsp;Classes</a>&nbsp;<a href="../allpackages-index.html">All&nbsp;Packages</a><a id="I:S">
<!-- -->
</a>
<h2 class="title">S</h2>
<dl>
<dt><span class="memberNameLink"><a href="../Course.html#setCapacity(int)">setCapacity(int)</a></span> - Method in class <a href="../Course.html" title="class in &lt;Unnamed&gt;">Course</a></dt>
<dd>&nbsp;</dd>
<dt><span class="memberNameLink"><a href="../Faculty.html#setCourses(Course%5B%5D)">setCourses(Course[])</a></span> - Method in class <a href="../Faculty.html" title="class in &lt;Unnamed&gt;">Faculty</a></dt>
<dd>&nbsp;</dd>
<dt><span class="memberNameLink"><a href="../Professor.html#setCourses(Course%5B%5D)">setCourses(Course[])</a></span> - Method in class <a href="../Professor.html" title="class in &lt;Unnamed&gt;">Professor</a></dt>
<dd>&nbsp;</dd>
<dt><span class="memberNameLink"><a href="../Lab.html#setCurrentSize(int)">setCurrentSize(int)</a></span> - Method in class <a href="../Lab.html" title="class in &lt;Unnamed&gt;">Lab</a></dt>
<dd>&nbsp;</dd>
<dt><span class="memberNameLink"><a href="../Lab.html#setDay(java.lang.String)">setDay(String)</a></span> - Method in class <a href="../Lab.html" title="class in &lt;Unnamed&gt;">Lab</a></dt>
<dd>&nbsp;</dd>
<dt><span class="memberNameLink"><a href="../Student.html#setFirstName(java.lang.String)">setFirstName(String)</a></span> - Method in class <a href="../Student.html" title="class in &lt;Unnamed&gt;">Student</a></dt>
<dd>&nbsp;</dd>
<dt><span class="memberNameLink"><a href="../Student.html#setGrade(int)">setGrade(int)</a></span> - Method in class <a href="../Student.html" title="class in &lt;Unnamed&gt;">Student</a></dt>
<dd>
<div class="block">*</div>
</dd>
<dt><span class="memberNameLink"><a href="../Student.html#setId(java.lang.String)">setId(String)</a></span> - Method in class <a href="../Student.html" title="class in &lt;Unnamed&gt;">Student</a></dt>
<dd>&nbsp;</dd>
<dt><span class="memberNameLink"><a href="../Course.html#setName(java.lang.String)">setName(String)</a></span> - Method in class <a href="../Course.html" title="class in &lt;Unnamed&gt;">Course</a></dt>
<dd>&nbsp;</dd>
<dt><span class="memberNameLink"><a href="../Course.html#setProfessor(Professor)">setProfessor(Professor)</a></span> - Method in class <a href="../Course.html" title="class in &lt;Unnamed&gt;">Course</a></dt>
<dd>&nbsp;</dd>
<dt><span class="memberNameLink"><a href="../Faculty.html#setProfessors(Professor%5B%5D)">setProfessors(Professor[])</a></span> - Method in class <a href="../Faculty.html" title="class in &lt;Unnamed&gt;">Faculty</a></dt>
<dd>&nbsp;</dd>
<dt><span class="memberNameLink"><a href="../Course.html#setStudents(Student%5B%5D)">setStudents(Student[])</a></span> - Method in class <a href="../Course.html" title="class in &lt;Unnamed&gt;">Course</a></dt>
<dd>&nbsp;</dd>
<dt><span class="memberNameLink"><a href="../Faculty.html#setStudents(Student%5B%5D)">setStudents(Student[])</a></span> - Method in class <a href="../Faculty.html" title="class in &lt;Unnamed&gt;">Faculty</a></dt>
<dd>&nbsp;</dd>
<dt><span class="memberNameLink"><a href="../Lab.html#setStudents(Student%5B%5D)">setStudents(Student[])</a></span> - Method in class <a href="../Lab.html" title="class in &lt;Unnamed&gt;">Lab</a></dt>
<dd>&nbsp;</dd>
<dt><span class="memberNameLink"><a href="../Lab.html#setTA(java.lang.String)">setTA(String)</a></span> - Method in class <a href="../Lab.html" title="class in &lt;Unnamed&gt;">Lab</a></dt>
<dd>
<div class="block">set a TA</div>
</dd>
<dt><a href="../Student.html" title="class in &lt;Unnamed&gt;"><span class="typeNameLink">Student</span></a> - Class in <a href="../package-summary.html">&lt;Unnamed&gt;</a></dt>
<dd>
<div class="block">The Student class represents a student in a student
administration system.</div>
</dd>
<dt><span class="memberNameLink"><a href="../Student.html#%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String)">Student(String, String, String)</a></span> - Constructor for class <a href="../Student.html" title="class in &lt;Unnamed&gt;">Student</a></dt>
<dd>
<div class="block">
Create a new student with a given name and ID number.</div>
</dd>
</dl>
<a href="index-1.html">A</a>&nbsp;<a href="index-2.html">C</a>&nbsp;<a href="index-3.html">E</a>&nbsp;<a href="index-4.html">F</a>&nbsp;<a href="index-5.html">G</a>&nbsp;<a href="index-6.html">H</a>&nbsp;<a href="index-7.html">I</a>&nbsp;<a href="index-8.html">L</a>&nbsp;<a href="index-9.html">M</a>&nbsp;<a href="index-10.html">P</a>&nbsp;<a href="index-11.html">R</a>&nbsp;<a href="index-12.html">S</a>&nbsp;<br><a href="../allclasses-index.html">All&nbsp;Classes</a>&nbsp;<a href="../allpackages-index.html">All&nbsp;Packages</a></div>
</main>
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../package-summary.html">Package</a></li>
<li>Class</li>
<li><a href="../overview-tree.html">Tree</a></li>
<li><a href="../deprecated-list.html">Deprecated</a></li>
<li class="navBarCell1Rev">Index</li>
<li><a href="../help-doc.html">Help</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
</footer>
</body>
</html>
...@@ -15,8 +15,6 @@ public class Course { ...@@ -15,8 +15,6 @@ public class Course {
private Student[] students; private Student[] students;
// the list of course's lab // the list of course's lab
private Lab[] labs; private Lab[] labs;
// the limit number of course capacity
private int maxCapacity;
// the number of current capacity // the number of current capacity
private int currentCapacity; private int currentCapacity;
...@@ -27,13 +25,13 @@ public class Course { ...@@ -27,13 +25,13 @@ public class Course {
* @param professor of course * @param professor of course
* @param credit of course * @param credit of course
*/ */
public Course(String name, Professor professor, int credit) { public Course(String name, Professor professor, int credit ,int maxCapacity) {
students = new Student[15]; students = new Student[15];
labs = new Lab[20]; labs = new Lab[20];
this.name = name; this.name = name;
this.professor = professor; this.professor = professor;
credit = 4; credit = 4;
maxCapacity = 15; // the limit number of course capacity
} }
/** /**
......
...@@ -141,7 +141,7 @@ public class Faculty { ...@@ -141,7 +141,7 @@ public class Faculty {
public void printF() { public void printF() {
System.out.println("\nABOUT FACULTY:the faculty name is :" + getName()); System.out.println("\nABOUT FACULTY:the faculty name is :" + getName());
for (Course i : getCourses()) { for (Course i : getCourses()) {
System.out.println("the students are :" + i.getName()); System.out.println("the course are :" + i.getName());
} }
for (Student i : getStudents()) { for (Student i : getStudents()) {
...@@ -149,7 +149,7 @@ public class Faculty { ...@@ -149,7 +149,7 @@ public class Faculty {
} }
for (Professor i : getProfessors()) { for (Professor i : getProfessors()) {
System.out.println("the students are :"+i.getFirstName()); System.out.println("the professor are :"+i.getFirstName());
} }
} }
} }
...@@ -24,13 +24,13 @@ public class Lab { ...@@ -24,13 +24,13 @@ public class Lab {
* @param course the lab's name * @param course the lab's name
* @param capacity the limit of lac * @param capacity the limit of lac
*/ */
public Lab(String TA, String day, Course course, int capacity){ public Lab(String TA, String day, Course course ,int capacity){
students=new Student[15]; students=new Student[15];
this.TA=TA; this.TA=TA;
this.day=day; this.day=day;
this.course=course; this.course=course;
currentSize=0; currentSize=0;
capacity=15; this.capacity=capacity;
} }
/** /**
...@@ -96,9 +96,10 @@ public class Lab { ...@@ -96,9 +96,10 @@ public class Lab {
*/ */
public void enrollStudent(Student student){ public void enrollStudent(Student student){
if (currentSize < capacity) { currentSize=0;
if (currentSize < capacity)
students[currentSize++] = student; students[currentSize++] = student;
} else { else {
System.out.println("Lab is full!!!"); System.out.println("Lab is full!!!");
} }
} }
......
...@@ -8,9 +8,9 @@ public class Main { ...@@ -8,9 +8,9 @@ public class Main {
Professor EE = new Professor("Ehsan", "Edalat"); Professor EE = new Professor("Ehsan", "Edalat");
Course AP = new Course("AP", EE, 4 ); Course AP = new Course("AP", EE, 4,20 );
Course ML = new Course("ML", EE, 4); Course ML = new Course("ML", EE, 4,20);
Course DL=new Course("DL",EE,4 ); Course DL=new Course("DL",EE,4,20 );
Lab APLAb = new Lab("TA", "saturday", AP, 15); Lab APLAb = new Lab("TA", "saturday", AP, 15);
...@@ -21,7 +21,7 @@ public class Main { ...@@ -21,7 +21,7 @@ public class Main {
S1.print(); S1.print();
EE.setCourses(new Course[]{AP, ML}); EE.setCourses(new Course[]{AP, ML});
EE.addCourse(new Course("DL", EE, 4)); EE.addCourse(new Course("DL", EE, 4,20));
EE.setCourses(new Course[]{AP, ML,DL}); EE.setCourses(new Course[]{AP, ML,DL});
EE.printp(); EE.printp();
...@@ -30,28 +30,28 @@ public class Main { ...@@ -30,28 +30,28 @@ public class Main {
APLAb.setDay("saturday"); APLAb.setDay("saturday");
APLAb.hasCapacity(); APLAb.hasCapacity();
APLAb.enrollStudent(S2); APLAb.enrollStudent(S2);
APLAb.setStudents(new Student[]{S1}); APLAb.setStudents(new Student[]{S2});
APLAb.printL(); APLAb.printL();
AP.setProfessor(new Professor("Narges", "Salehi")); AP.setProfessor(new Professor("Ehsannnn", "Edalattt"));
AP.setStudents(new Student[]{S1}); AP.setStudents(new Student[]{S2});
AP.setCapacity(13); AP.setCapacity(13);
AP.addLab(APLAb); AP.addLab(APLAb);
AP.enrollStudent(S2); AP.enrollStudent(S2);
AP.printC(); AP.printC();
Computer.setCourses(new Course[]{AP,ML}); Computer.setCourses(new Course[]{AP,ML});
Computer.addCourse(new Course("DL",EE,4)); Computer.addCourse(new Course("DL",EE,4,20));
Computer.setCourses(new Course[]{AP,ML}); Computer.setCourses(new Course[]{AP,ML});
Computer.setStudents(new Student[]{S1}); Computer.setStudents(new Student[]{S2});
Computer.setProfessors(new Professor[]{EE}); Computer.setProfessors(new Professor[]{EE});
Computer.enrollStudent(S2); Computer.enrollStudent(S2);
Computer.addCourse(DL); Computer.addCourse(DL);
Computer.addProfessor(EE); Computer.addProfessor(EE);
Computer.isCourseValid(DL); Computer.isCourseValid(DL);
Computer.isProfessorValid(EE); Computer.isProfessorValid(EE);
Computer.isStudentValid(S1); Computer.isStudentValid(S2);
Computer.printF(); Computer.printF();
} }
......
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