LAB 01 (2)
LAB 01 (2)
Lab No: 01
TASK 1:
You are responsible for developing a small simulation of OASIS (the Student Information
System of IUE).
(OASIS will not be a seperate class; it will be your main class. Act accordingly.)
In OASIS, there will be students and instructors. Each student has a corresponding id,
name, age, and GPA. You will determine the data types of these class fields.
In the Student class, there will be a method to display the corresponding Student object’s
information, along with accessor (getter) and mutator (setter) methods to set and get the
class fields. Implement a parameterized constructor for creating objects from this class.
Additionally, each Instructor has a corresponding id, name, age, and a list of
students they are responsible for.
• This list’s size is fixed at 3, and you are not allowed to use collection classes such as
ArrayList, LinkedList, etc.
• Implement a parameterized constructor for creating objects from this class, initiliaze
the list of students in that constructor.
The instructors should be able to add and remove Students into their Student Lists with the
following methods;
addStudent(Student student);
removeStudent(int id); : Be careful about the removed slot of the array what
happens to it?
Also the instructor should be able to find the requested Student by its id and change his/her
GPA with the following methods:
findStudent(String id);
changeGPA(Student student, double newGPA);
You will use the 2 methods above in a single method below, they are helper methods to this
method;
findStudentAndChangeGPA(String id, double newGPA);
Finally, the instructor should be able to see his/her list of students he/she’ve to be dealed with
the following method:
displayAllStudents();
Create some Student and Instructor objects and try each functionality one by one.
TASK 2:
In math, the natural “log” or “ln 𝑥” is the inverse of “𝑒 𝑥 ”. There are series that help you to
calculate “𝑒 𝑥 ” and “ln 𝑥”.
Through Exponential and logarithm series you can calculate “ln 𝑥” like:
𝑘 (−1)𝑛−1 (𝑥 − 1)𝑛
∑
𝑛=1 𝑛
Note: These series approximate the answer as they go towards infinity. We will limit “k” to a
value that is entered by user. Therefore, calculation will stop at that value.
Write a JAVA program which calculates “ln 𝑥” or “e” depending on the user’s wish, with 2
functions. The name for the functions is like below:
You cannot change or add parameters to these functions. Also, you don’t need to use any extra
functions. In your main function take “k” and “x” values from user and call the appropriate
functions to calculate “𝑒 𝑥 ” second to calculate “ln 𝑥” .