Search Header Logo
Object Oriented Programming Lesson 1

Object Oriented Programming Lesson 1

Assessment

Presentation

Computers

University

Practice Problem

Medium

Created by

Jerry Jackson Bent

Used 2+ times

FREE Resource

24 Slides • 9 Questions

1

media

Object Oriented Programming
Lecture 1: Introduction to OOP

[Holborn – Group 1]

2

media

Lesson outcomes

Workshop learning objectives to be discussed today are:

What is programming? Flowcharts and pseudo-code

IDE, installation and use.

Recap of Java programming (ITP).

Introduction to OOP

UML (Class and sequence diagrams)

3

media

Icebreaker

Introduction and assignment

4

Multiple Choice

OOP is a programming model based on the concept of what?

1

Hardware

2

Objects

3

Compiler

4

Laptops

5

Multiple Choice

Java is owned by what company?

1

Oracle

2

Microsoft

3

Google

4

Apple

6

Multiple Choice

Java is open source and free to use

1

True

2

False

7

Multiple Choice

Everything in Java programming begins what?

1

Class name

2

Attribute

3

Method

8

Open Ended

Every Java program has a class name which must match the ________ and that every program must contain a _______ method.

(Type 2 answers separating them with a space or comma)

9

Multiple Select

What are the two main data types in Java programming?

1

Primitive

2

Loops

3

Automated

4

Non-Primitive

10

Multiple Choice

Primitive data types include the following except...

1

Short

2

Boolean

3

Strings

4

Integer

11

Multiple Choice

What will be the output of the following code:

int x = 52;

int y = 43;

if (x > y) {

System.out.println ("X-men"); }

else {

System.out.println ("Avengers"); }

1

X-men

2

Avengers

3

52

4

43

12

Multiple Choice

int time = 1300;

if (time > 1100) { System.out.println("Good afternoon."); }

else { System.out.println("Good morning."); }

1

1100

2

1300

3

Good morning

4

Good afternoon

13

media

Java program design

Topic 1

14

media

Activity

15

media

Practice problem 1

Draw the flowchart and write the pseudo-code for the problem given below.
1.A logistics company charges £2 for a parcel weighing 2Kg or less. If the weight of the parcel is more than 2Kg, each kg of the excess weight is charged at £3.

You can use Smartdraw.com, Lucid.app or microsoft visio to complete this task

Time for activity 15 minutes

16

media

Tea and
Coffee Break

10 minutes

17

media

Java programming recap

Topic 2

18

media

Activity

19

media

Practice problem(s) 2

1. Write the syntax of prefix and postfix increment operator and write the difference between them.

2. Determine the value of each of the following logical expressions if a = 5, b = 10 and c = – 6

a) a>b && a<c

b) a <b && a>c

c) a==c|| b>a

d) b>15 && c<0 || a>0

Time for activity 15 minutes

20

media

Tea and
Coffee Break

10 minutes

21

media

Arrays and Strings

Topic 3

22

media

Activity

23

media

Practice problem(s), Task 1

A palindrome is a word or phrase that reads the same forward or backwards. Write a recursive method that returns a boolean value indicating if its only String argument is a palindrome or not. The method must be recursive and have the following signature: public static boolean isPalindrome( String arg ) In testing for palindrome you should ignore upper/lower case as well as whitespace.

Time for activity 20 minutes

24

media

Practice problem(s) 3 cont.,

That is, the following phrases should be legal palindromes.

No Sir prefer prison

Racecar

Straw Warts

never odd or even

Oozy rat in a sanitary zoo

Place the isPalindrome method in a class named Palindrome. Write a main method in
Palindrome which prompts for a string from the keyboard, test if it is a palindrome, and print out
the result. Below is a sample output. The string: ’No Sir prefer prison’ is a palindrome The string:
’Try this’ is NOT a palindrome

25

media

Practice problem(s) 3 Task 2

2.a. Declare on one line a two-dimensional array of int values called intArr. On the second line, allocate memory for 5 rows. On subsequent lines, allocate memory for each row to have 8 columns.

b. Fill in each cell of the intArr array from the previous question with the result of multiplying that cell's column index by its row index. Do not hardcode the length of the array in any way.

c. Print each row of the intArr array from the previous question in order on separate lines.
Entries should be separated by a single space. The last entry in each row should be followed by a colon (:) and then the sum of the entries in that row. Do not hardcode the length of the array in any way.

26

media

Practice problem(s) 3, Task 3

3. Write a method that takes an array of numbers and a number and returns
true if the array contains the number, false otherwise. You will need a loop, and
your loop must not execute more iterations than necessary, and you cannot use
break or continue.

27

media

Tea and
Coffee
Break

10 minutes

28

media

Introduction to UML

Topic 4

29

media

Activity

30

media

Practice problem(s) 4

1. Draw a Class diagram for a library system.

2. Draw a sequence diagram for the registration of a new library member.

Time for activity 10 minutes

31

media

Workshop Summary

Introduction to programming

Java programming basics

Arrays and Strings

UML

32

media

Student support

Note taking
Presentation
Paraphrasing
Referencing

33

media

[Jerry Bent]

media

Object Oriented Programming
Lecture 1: Introduction to OOP

[Holborn – Group 1]

Show answer

Auto Play

Slide 1 / 33

SLIDE