You are on page 1of 9

Table of content:

1- Introduction

2- How to build Specialization & courses

3- Explanations for the methods and operations

Introduction:
A program that has been established to organize the information system of college, that college has specialization contains title, location, and name of chairman, which integrates to other specialization. And also contains different courses which are title, teacher name, and credit hours that linked to other courses. That program contains menu that have different operations, first we need to insert specializations that take specializations detailed and add to the list, second we need to insert courses that include information for both specialization and courses and add the list under the right specialization. Then you can search for courses by taking courses name and check if it is exist in the information system and then print it out, after that the program can print the content for all specialization and its subcourses, and also you can print individuals specialization that takes the specializations name from the user and print the information for all courses under that specialization, and also you can find the highest number of courses

How to build Specialization & courses:


First : public class Specialization Now we build specialization that is contains the data of specialization such as: Title, location, and name of chairman here we make link to another specialization and include courses1 And it contains two constructors: 1-public Specialization(String ti, String lo,String cN) This constructor used when we store first specialization, and we pass to it 3 parameters one for title, one for location, and the last one for chairman name, we make next link to null and courses1 null. 2-public Specialization(String ti, String lo,String cN, Specialization ne) this constructor used when specialization is not empty (their is data stored before) ,and we pass to it four parameters one for title , one for location , and one for chairman name , and the last one Specialization n to the next.

Second :

public class course1 Starting with courses as edge of graph this class should contains the data of the courses such as: Title, teachers name, credit hours, here we make link to another courses as instance variable And this class contains two constructors 1public course1(String ti, String tech, int Cr) This constructor has three parameter to pass values to the instance variable, in this constructor we make the link null because it is used for the first time

2public course1(String ti, String tech, int Cr, course1 ne) this constructor has four parameter to pass values to the instance variable , the last parameter Course1 ne is pass to the link because we are use this constructor in the case of the course1 not empty .

Explanations for the methods and operations:

Now we integrate our two classes into one class called col this class contains all operation we are need to process our graph, in this class we make specialization instance variable as a vertex for the graph because specialization contains the courses edge. public void addtospecialization(String ti,String lo,String cn) After the user insert the title of specialization, location, and chairman name in the menu class. We check the current specialization if it is null we use our first constructor of specialization, else we use the second constructor of specialization.

public void addtoCourse(String ti, String thN,int cr, String v) First we ask the user to enter the title of specialization that we need to enter the data of course under it then the user insert the title of course, teacher name, and credit hours in the menu class. it search using for loop that start from the beginning of specialization until we find our title then , we get the course data and insert it into this specialization using the first course constructor incase of first insert. ,Else we use the second constructer. If the title not found we display message not found.

public void serarch(String f) In this method we search under specialization, we get the course title from the user using scanner in the menu class. Then we make two loops the outer loop is to go through specialization until we reach the end of it The inner loop is to search for our course title that enters by the user, if we find it we register our specialization data into suitable variable. Then we print the course data and specialization data. Else we display message not Found.

public void print() In this method we print all content of specialization. Then we make two loops the outer loop is to go through specialization and print the specialization data until we reach the end of it The inner loop is to print the course data.

public void printone(String u) In this method we print one specialization we get specialization title as a parameter and we make loop that start from the start of specialization with the condition specialization title not equal our parameter this loop will do nothing. If we find our tmp is null that means this specialization is not found Else we print the data of specialization and make another loop for this tmp course1 to print the course data for all courses that included into this specialization.

public void HINumber() This method idea is to print specialization with highest number of course. Here we make clac and bigN value and set them to zero. We make loop through specialization and another loop into it. In the inner loop we increase a counter by one. After we finish inner loop of courses we go to outer loop of specialization and make check for the counter and high variable. If the pointer which called calc is bigger than the bigN we make bigN equal calc and save the current specialization title to be used later. And then we make counter zero for the next specialization loop. When we finish specialization loop we print the high value and the saved value of our specialization.

public void averageCr() In this method we need to print the average of number of courses credit hours for all specialization so we need to calculate the total of credit hours and the number of courses to find out the average. So we just make two loop Outer loop for specialization and inner loop to go through courses in this loop we increase our calc by one and calculate SUM of credit hours, after loop finish we use the equation for calculate the average( aver=sum/calc )and print the results of aver.

public void total() In this method we need to print the total of number of courses credit hours for all specialization so we need to calculate the total of credit hours. So we just make two loop Outer loop for specialization and inner loop to go through courses in this loop we calculate the sum of credit hours. At the end of method we print the sum.

College Project

Name : Abdulaziz alomran

ID : 28110134

Mr. Zaid T. Jalal

You might also like