0.Introduction. In this assignment you are required to develop and test the following two classes:
The class diagrams for these classes are provided.
The relevant information about a Programming 2 student includes: the first name, surname, and marks for Lab Test, Assignment1, Assignment2, and Final Exam.
The ranges for each of the assessment task marks are given below, also it is explained how to calculate the final grade:
A total mark is the sum of the previous four marks, so it is an integer from 0 to 100.
A student passes the unit if and only if (Assignment1 Mark + Assignment2 Mark) >= 20 and (Lab Test Mark + Final Exam Mark) >= 30
There are 5 grades, which are calculated according to the following rules:
You are required to develop your application using Java in the Eclipse environment.
Develop class Programming2Student using the following diagram and explanations that follow the diagram. Public set and get methods for the instance variables are not included in the diagram for space considerations. However, you should provide them. See image.
(1) The data fields have self-explanatory identifiers, and their meanings should be clear from the Introduction.
(2) The first constructor creates a “default” student object – it should be you – and sets all the marks to 0. The second constructor creates a student object with specified name and surname and zero marks for all assessment tasks. The third constructor creates a student object with full name and all the marks specified.
(3) The “set” methods allow the user to set the assessment task marks within the specified margins, e.g. setExamMark must ensure that the examMark is in the range from 0 to 50.
(4) The method getGrade() returns the student’s grade, calculated as specified in the Introduction. The rest of the “get” methods simply return the values of the corresponding fields.
(5) The method passed() returns true if this student has passed the course, and returns false otherwise (see the Introduction).
(6) The method toString() returns a string representation of a Programming2Student object in the following printable format:
Assignment 1 8
Assignment 2 16
Lab Test 0
Develop class Programming2Class using the following diagram and explanations that follow the diagram. Public set and get methods for the instance variables are not included in the diagram for space considerations. However, you should provide them. Objects of this class represent Programming2 teaching classes (student groups). See image.
(1) There are three instance variables in the class:
(2) There are two constructors - a default constructor that creates an empty class with the default capacity equal to 20, and a constructor that creates an empty class with a specified capacity.
(3) addStudent(Programming2Student s) method adds a Programming2Student object to the group if the capacity of the class is greater then the number of students in the class, else it just prints that the class is full. Make sure that every time you add a student to the class the value of the numberOfStudents variable increases by one.
(4) toString() method returns the list of all students from the class in a printable string format. In the implementation you should use the Programming2Student's toString() method.
Write a test program to test the Programming2Student and Programming2Class classes. You should perform the following tasks in the main method of the Test class: