You are on page 1of 2

LAB01

In this LAB, you will create a basic data management system for students in the
Department of Computer Science. Department Office wants to create an object that
contains student data - name (note - the name of the student's last name appears first.
All the names in English, and of course a capital first letter: Muhammad not
muhammad), ID number and grades. All students may have grades for five courses:
introduction to programming, Introduction to Management, Data Structures,
Foundations of Economic Theory and Introduction to Mathematics (grade is an
integer between 40 and 100).
Write a class - Student. Student class consists of student data. For this purpose, you
must fulfill the following methods (note - fields of the objects should be marked as
private).
Student class:
Constructors:

Student(String name, long Construct Student object with name and id as


id) parameters.
Copy Constructor: constructs Student object with
Student(Student st) Student object as a parameter.

Methods:
Return
Type Method name Operation
String )(getName Returns student name
long )(getId Returns student id

Returns student grade in a course with number course as follows:


1- Introduction to Programming
2- Introduction to Management
3- Data Structures
4- Foundations of Economic Theory
5- Introduction to Mathematics
int getGrade(int course) If the student does not have a specific course grade, the method returns -1
Sets the name of the student assuming that the received input string input is
void setName(String name) right input.
Sets the student's identification number, you can assume that the input of the
void setId(long id) ID card is correctly received, ie right input

void setGrade(int course, int Assigns the grade of the student course (according to the above key).
grade)
Assigns the student's grades in his courses. You can enter grades in the way
void setGrades() you want, or by receiving grades from the user within the system.
double )(getAverage Returns the student average.

boolean equals(Student student) Gets student object and decides if this is the same student.
Returns a string containing the students data as follows:

Name: Muhammad Shareef


ID: 123456789
Grades:
Introduction to Programming – 85, Introduction to Management – 85, Data
Structures – no grade, Introduction to Economics – 85, Introduction to
Mathematics – no grade
String )(toString If you do not have score in a course replace it by the string "no grade".

It is recommended to write tester to present all the methods of the


class and to check that they actually work.

You might also like