0% found this document useful (0 votes)
16 views2 pages

LAB 01 (2)

The document outlines two programming tasks for a lab in SE 116 Introduction to Programming II. Task 1 involves developing a simulation of the OASIS Student Information System, requiring the creation of Student and Instructor classes with specific methods for managing student data. Task 2 focuses on writing a Java program to calculate the natural logarithm and exponential functions using series approximations, with user-defined limits for calculations.

Uploaded by

esin tan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

LAB 01 (2)

The document outlines two programming tasks for a lab in SE 116 Introduction to Programming II. Task 1 involves developing a simulation of the OASIS Student Information System, requiring the creation of Student and Instructor classes with specific methods for managing student data. Task 2 focuses on writing a Java program to calculate the natural logarithm and exponential functions using series approximations, with user-defined limits for calculations.

Uploaded by

esin tan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SE 116 Introduction to Programming II

Lab No: 01

Topic: SE 115 RECAP

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 sum of reciprocal of factorials “𝑒 𝑥 ” can be calculated like this:


𝑖
𝑘 𝑥
∑𝑖=1
𝑖!

HINT: You will need an additional helper function to calculate factorial of i.

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:

calcEStep (int k, int x);


calcLnStep (int k, int x);

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 𝑥” .

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy