Professional Documents
Culture Documents
Procedural vs.
OOP Paradigm
Course Introduction 3
Class Rules 4
Grading System 9
Review 11
2
Course Introduction
3
Class Rules
ATTENDANCE
Students are expected to attend all classes, arrive on time, and participate
actively in class discussions and activities. Students with complete attendance
will receive an additional 10% of their major exam grade.
It is not allowed to have 3 consecutive absences. Acceptable reasons for
missing class include illness (with a medical certificate or prescription), the
death of an immediate family member or a family emergency, religious
observance, and school events. If the absence is deemed valid, the student
may make up any missed quizzes, activities, or machine problems on a date
specified by the instructor, with a proper excuse letter.
4
Class Rules
QUIZZES
If the lecturer cannot provide an answer sheet, only yellow paper will be used
for quizzes and activities. Students must use a black ballpen. No erasing is
allowed. If a mistake is made, students may use correction tape or pen, or put
parenthesis around the incorrect portion and add their signature.
5
Class Rules
TECHNOLOGY USE
Students are expected to use technology appropriately and responsibly in the
classroom and to avoid activities that are distracting or disruptive to others.
ACADEMIC INTEGRITY
Students are expected to adhere to academic standards of honesty and integrity
and to avoid plagiarism, cheating, and other forms of academic misconduct.
Please be aware that a first offense for plagiarism or cheating will result in a
heavy suspension of one week, and a second offense will result in dismissal or
transfer, as outlined in the school's Memorandum of Understanding.
6
Class Rules
LATE WORK
Students are expected to submit work on time. Late submissions (assignments)
will incur a 10% grade deduction per day.
APPROPRIATE BEHAVIOR
Students are expected to maintain appropriate behavior during class, as
directed by the instructor. This includes refraining from eating, drinking, or
using cell phones during class. If a student needs to answer a call, they should
excuse themselves and take the call outside.
7
Class Rules
COMMUNICATION WITH INSTRUCTOR
During the class, students are encouraged to communicate with their
instructor regarding any questions, concerns, or needs related to the course.
Private messages between the student and the instructor are strictly
prohibited. All concerns and questions should be directed to the class
president first, and the president will be the one to communicate with the
instructor.
Note: This rule is in place to promote a transparent and organized
communication process within the class, and to ensure that all students have
equal access to the instructor and to information related to the course.
8
GRADING SYSTEM
ASYNCHRONOUS 30%
WRITTEN QUIZZES, HOMEWORKS
SYNCHRONOUS 30%
EXERCISES, MACHINE PROBLEMS
TOTAL 100%
9
Procedural vs. OOP
Procedural
Procedural programming is a type of
programming that follows a structured
approach and is based on the use of
procedures. Procedures, also referred to as
routines, subroutines, or functions, consist of a
set of computational steps to perform. These
procedures can be called at any time during
program execution, including by other
procedures or by the procedure itself.
10
Procedural vs. OOP
OOP
Object-oriented programming (OOP) is a
programming paradigm based on the concept
of objects. Objects in OOP contain both data
(attributes) and code (methods). This
programming model is designed to represent
real-world objects and the interactions
between them. OOP languages can vary, but
the most commonly used are class-based,
where objects are instances of classes that
define their type.
11
Procedural vs. OOP
Procedural OOP
• In procedural programming, the program is • In object-oriented programming, the
divided into small parts called functions. program is divided into small parts called
• Procedural programming follows a top- objects.
down approach. • Object-oriented programming follows a
• There is no access specifier in procedural bottom-up approach.
programming. • Object-oriented programming has access
• Procedural programming does not have any specifiers like private, public, protected, etc.
proper way of hiding data so it is less • Object-oriented programming provides data
secure. hiding so it is more secure.
• Procedural programming uses the concept • Object-oriented programming uses the
of procedure abstraction. concept of data abstraction.
12
Procedural vs. OOP
Procedural OOP
• In procedural programming, overloading is • Overloading is possible in object-oriented
not possible. programming.
• In procedural programming, there is no • In object-oriented programming, the concept
concept of data hiding and inheritance. of data hiding and inheritance is used.
• In procedural programming, the function is • In object-oriented programming, data is more
more important than the data. important than function.
• Procedural programming is based on the • Object-oriented programming is based on the
unreal world. real world.
• Code reusability absent in procedural • Code reusability is present in object-oriented
programming, programming.
• Examples: C, FORTRAN, Pascal, Basic, etc. • Examples: C++, Java, Python, C#, etc.
13
REVIEWING JAVA BASIC SYNTAX
Terminator (semi-colon)
14
REVIEWING JAVA BASIC SYNTAX
15
REVIEWING JAVA BASIC SYNTAX
Declaration and Assignment Statements
16
REVIEWING JAVA BASIC SYNTAX
Booleans
17
REVIEWING JAVA BASIC SYNTAX
Comparison Operators
18
REVIEWING JAVA BASIC SYNTAX
Anatomy of an if statement
19
REVIEWING JAVA BASIC SYNTAX
Anatomy of an if-else statement Condition that holds a Boolean value
If block,
executed
if true
else block,
executed
if false
20
REVIEWING JAVA BASIC SYNTAX
Anatomy of an if-else statement Condition that holds a Boolean value
If block,
executed
if true
else block,
executed
if false
21
REVIEWING JAVA BASIC SYNTAX
Anatomy of a While Loop
Initialization
22
REVIEWING JAVA BASIC SYNTAX
Anatomy of a Do-while Loop
Initialization
23
REVIEWING JAVA BASIC SYNTAX
Anatomy of a For Loop Condition
Update Expression
Initialization Loop control variable
*Curly braces
Loop Body -
are optional
when the loop
Executed as long
body is a single as the condition
statement is true
24
REVIEWING JAVA BASIC SYNTAX
Anatomy of an Array New Keyword Base type (Datatype)
25
REVIEWING JAVA BASIC SYNTAX
Declaring and Populating an Array
Square
Bracket Comma (after every
elements) Closing Curly Braces
26
REVIEWING JAVA BASIC SYNTAX
PARAMETER
Anatomy of a Java Method Are input values that are passed
to a method when it is called.
Specified in the method
signature.
Method Signature
METHOD BODY
Contains the code
that executes when
the method is called.
STATIC KEYWORD It is enclosed in curly
Used to define a method as VOID KEYWORD
braces.
a class method or a static Used as a return type for a method
method. Static method that does not return any value and
Access Modifier means that the method can does not have a return statement.
be called directly on the
class, without the need to
create an instance of a class
27
REVIEWING JAVA BASIC SYNTAX
PARAMETER
Anatomy of a Java Method Are input values that are passed
to a method when it is called.
Specified in the method
signature.
Method Signature
METHOD BODY
Contains the code
that executes when
the method is called.
RETURN STATEMENT RETURN TYPE It is enclosed in curly
Is used to specify the value It is specified immediately before braces.
that the method should the method name. The value that a
return to the calling code. method returns must be
Access Modifier compatible with the return type of
the method.
28
CC3L Computer Programming 2
LABORATORY
(Basic Review)
Arrays (30pts)
Write a program to find the largest and smallest number in an array of integers.
Elements are : 5,6,26,45,14,4,13,12,15,10
Laboratory Exercise
Conditional statement (50pts)
Write a program that takes two integers as input and prints the larger one. If
the first number is the larger one print "Integer1 is larger", if the second
number is larger print "Integer2 is larger", and if both numbers are equal print
"Both numbers are equal."
Arrays (30pts)
Given an array of integers, find the sum of all elements in the array.
Laboratory Exercise
Conditional statement (30pts)
Write a program that checks the age of the user. If the user enters age 17 and
below display "You are a minor", if the age is 18 and above display "You are in
legal age" and if the age is less than 0 and over 100 display "Invalid age".
Arrays (30pts)
Write a program to find the SUM of all the numbers in an array of integers.
Elements are : 15,52,89,45,45,20,13,12,5,75
CC3L Computer Programming 2
LABORATORY
(EXERCISE 1)
The End