0% found this document useful (0 votes)
16 views

OOP Lecture 1

Uploaded by

haziq aizat
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

OOP Lecture 1

Uploaded by

haziq aizat
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

TFB1033 / TEB1043 /

TDB2153
Object Oriented Programming
January 2024 Semester
About this class
● TEB 1043 / TFB 1033 / TDB 2153
● Object-Oriented Programming
● Sem: 2 / 3
At the end of this course...
You will understand better about modularity and software design

You will understand better how large-scale software is developed

You will be a better programmer.


Credits
3 credits

Lecture: 2 hours/week

Lab: 2 hours/week
Prerequiste
You have no nightmare with Structured Programming:

● Variables and arrays:


https://www.tutorialspoint.com/cplusplus/cpp_arrays.htm
● Loop and conditional:
https://www.tutorialspoint.com/cplusplus/cpp_loop_types.htm,
https://www.tutorialspoint.com/cplusplus/cpp_decision_making.htm
● Function, function call and parameters:
https://www.tutorialspoint.com/cplusplus/cpp_functions.htm
● Variable scope:
https://www.tutorialspoint.com/cplusplus/cpp_variable_scope.htm
Ice breaking Activities
Declare variables for the following:

● Student name String name;


● Student cgpa float cgpa;
● Grade for structured programming char grade;
● Marks for Test 1 float t1mark;
Given the following:

int x;

cin >> x;

Declare 2 other variables, and assign to both the value of x.


Declare an array that can stores 5 integers
int arr[5];

Assign the value 99 to the first element of the array

arr[0] = 99;

Write a loop that reads in values into arr.


for (int i=0; i<5; i++)
cin >> arr[i];
1. Write a function for each of the following:
a. to calculate the sum of the elements of the array.
b. to calculate the average of the elements of the array.
c. to calculate the sum of all even numbers in the array.

2. Write application code (main function) that shows how you invoke
the functions defined in Q1.
Add function to compute the average (1b)

1. Write a function for each of the following:


a. to calculate the sum of the elements of the array.

int sum (int num[]) { // declaration


int total = 0;
for (int i=0; i<10; i++) {
total += num[i];
}
return total;
}
Skeleton for Q2
2. Write application code to show how the function in Q1 is used.

int main() {
int myarr[] = {1,23,4,5,6,6,,67,..};

// invoking/calling the function

int result = sum(myarr);


out << result;
}
Add function to sum all even numbers (1c)
Declare a function/method that determines whether a number
is odd or even.

Write code to show how you would invoke the function.


How to declare a function?
1. What is the name of the function?
2. Should it return anything?
3. Does it need any parameter?
Write a function to sum up 2 integers and return the result (3 minutes)
Your lecturers
Name Email Phone No Office

AP Dr Mohd Soperi Mohd [email protected] 019 02.03.0


Zahid 3129260 3
Dr Nur Syadhila Che Lah [email protected]. 014 01.03.1
my 3613101 9
Dr Arafat M Rashad Al- [email protected] 011
Dhaqm 11155401
Dr Shashi Bhushan [email protected]
Course objectives
● explore essential concepts of OOP especially on encapsulation, inheritance and
­

polymorphism.
● ­explore tools and techniques to capture requirement and to design solution based
on object-oriented paradigm.
● ­utilize an appropriate object-oriented language, libraries and standard classes to
implement software.
● explore issues related to software development and how object-orientation can be
used to address some of the issues.
Programming language
● Java (https://www.learnjavaonline.org/)
Java IDE
IntelliJ: https://www.jetbrains.com

IntelliJ Installation help:


https://www.tutorialspoint.com/step-by-step-guide-to-install-intellij-idea
Note… OOP != Java
Evaluation
Test 1: 15%

Test 2: 15%

Quiz 1: 5%

Quiz 2: 5%

Project: 20%

Final: 40%
Tentative Test and Quiz dates
Quiz 1: Week 5 (in class time)

Test 1: Thursday 22 February at 4-6pm, Location: TBA

Quiz 2: Week 10 (in class time)

Test 2: Thursday 21 March at 4-6pm, Location TBA


Working together...
Class and Labs

● Attendance is a must - 100% attendance and attention expected…


● Participate in class… communicate with me in and out of class. The more I
know you, the more I can help you.
● Print out notes and exercises, and file it properly
● Revise your notes weekly and read ahead of class.

Labs

● Although not graded, please ensures to complete all lab exercises.


● Some questions in test, quiz, or final exam may be based on some lab exercises.
Project
In groups of 4, design, develop and present an object-oriented Java program for an
application.

Everyone will be presenting, each a piece of the code.

Marks will be awarded individually.

Deadlines

● Proposal: Week 4
● Project Progress Report: Week 8
● Presentation: Week 12

You might also like