COCS203 Programming II
Lab 02
Question 01:
Given the following program, draw a class diagram. Trace the program and show what will
be displayed by the program. cfw_You may use a separate sheet of paper to write your answer.
Make sure you write your name,
COCS203 Programming II
Exercise 07
Question 01:
Given the following program. Determine the memory layout for the ArrayList that is being created.
Trace the program and show how the content of the ArrayList is being processed.
1
2
3
4
5
6
7
8
9
10
11
12
13
COCS203 Programming II
Lab 01
Question 01:
Draw the class diagram and write a complete Java program for the following problem:
A class named RetailItem that contains the data about an item in a retail store. The class should
have the following members:
a.
COCS203 Programming II
Lab 03
Question 01:
Given the class diagram of Rectangle class with additional of a copy constructor i.e. Rectangle
(Rectangle) and three instance method i.e. toString(), equals(), and copy().
Rectangle
- length : int
- width : int
COCS203 Programming II
Lab 04
Question 01:
Given the class diagram of Book class.
Book
- title : String
- author : String
- yearPublish : int
- price : double
+ Book()
+ Book (String, String, int, double)
+ setTitle(String): void
+ setAuthor(String): void
COCS203 Programming II
Exercise 06
Question 01:
Import class ArrayList
Question 02:
Declare an ArrayList reference variable, named townList.
Question 03:
Invoke add() method to populate the list with 5 String objects that represent town in the Kingdom
of
COCS203 Programming II
Exercise 03
Question 01:
Which of the following codes is correct to compare between two objects of a Rectangle?
(a)
1
2
3
4
5
6
Rectangle rect1 = new
Rectangle rect2 = new
if (rect1 = rect2)
System.out.println
else
System.out.printl
COCS203 Programming II
Exercise 05
Question 01:
Create a class named Student that contains the following:
i. A string instance variable named name for the students name.
ii. A double instance variable named cpa for the students cumulative point average.
i
COCS203 Programming II
Exercise 04
Question 01:
Declare a two dimensional array of type integer that have four rows and three columns named
medal. Show the memory layout of the array.
Question 02:
Complete the following code to input values from the keybo
COCS203 Programming II
Exercise 01
Question 01:
Given the class diagram and the Java programming code for the Rectangle class. Use Java Netbeans
to write, compile and run the code. Save the program file as Rectangle.java.
Rectangle
- length : int
- width
KING ABDULAZIZ UNIVERSITY
Faculty of Computing and Information
Technology
Information Systems Department
CPIS - 342
Lab Manual : Lab 3 - Data Pre-Processing Techniques
By Mr. Farrukh Saleem
Mrs. Sarah Zaidan
Spring 2014-2015
Lab 3 & 4: Data Pre-Processing
CPCS-204
Data
Structures-I
LAB 10: Binary Search Trees
Statement Purpose:
Purpose of this Lab is to familiarize the students with the use of Binary Search Trees
data structure in writing simple Java programs. Another aim is to teach the students
how to im
CPCS-204
Data
Structures-I
LAB 1: Arrays
Statement Purpose:
Purpose of this Lab is to familiarize the students with the use of elementary data
structure-Arrays. Another aim is to teach the students how to implement one
dimensional and two dimensional arra
CPCS-204
Data
Structures-I
LAB 6: Recursion 2
Statement Purpose:
Purpose of this Lab is to familiarize the students with the use and power of recursion
in Java. They will learn what types of problems can be solved using recursion. They
will also be taught
CPCS-204
Data
Structures-I
LAB 3: Linked List 1
Statement Purpose:
Purpose of this Lab is to familiarize the students with Linked List data structure.
Another aim is to teach the students the disadvantages of using arrays and
advantages of using linked li
CPCS-204
Data
Structures-I
LAB 5: Recursion 1
Statement Purpose:
Purpose of this Lab is to familiarize the students with the use and power of recursion
in Java. They will learn what types of problems can be solved using recursion. They
will also be taught
CPCS-204
Data
Structures-I
LAB 4: Linked List 2
Statement Purpose:
Purpose of this Lab is to familiarize the students with writing simple Java programs
using Linked List. The students are given small tasks related to Linked List which they
complete during
CPCS-204
Data
Structures-I
LAB 9: Queue
Statement Purpose:
Purpose of this Lab is to familiarize the students with the use of queue data structure
in writing simple Java programs. Another aim is to teach the students how to
implement queue data structure
CPCS-204
Data
Structures-I
LAB 7: Algorithms Analysis
Statement Purpose:
Purpose of this lab is to introduce the concepts of Big-O running time of the
Algorithms to the students. The students are also familiarized with the time and space
complexity of alg
CPCS-204
Data
Structures-I
LAB 2: Linear Search VS Binary Search
Statement Purpose:
Purpose of this Lab is to familiarize the students with the code of linear search and
binary search. Another aim is to teach the students the difference between the
runnin
CPCS-204
Data
Structures-I
LAB 8: Stack
Statement Purpose:
Purpose of this Lab is to familiarize the students with the use of stack data structure
in writing simple Java programs. Another aim is to teach the students how to
implement stack data structure
Summer
Lab 1-Logic and Proof (Chapter 1.1,1.2)
ePurposStatement
.solving exercises from the text book
Activity Outcome
By the end of this lab students will understand basic logic concepts, , and will be able to solve
shorter/easier or longer / harder prob
CPCS222 Fall 2013
Lecture #5
Chapter 1.6
Foundations:
Introduction to Proofs
Prof. Dr. Wafaa El-Haweet & Dr. Zeinab Eid
Motivation
Mathematical proofs are, in a sense, the only
true knowledge we have.
They provide us with a guarantee as well as an
expla
CPCS222 Fall 2013
Lecture #8
Basic Structures:
Functions
Dr. Zeinab Eid & I. Asmaa Ashenkity
Functions
Let A and B be nonempty sets. A function f from A to
B is an assignment of exactly one element of B to
each element of A. We write f (a) = b, if b is t
CPCS222 Fall 2012/2013
Lecture#9
Basic Structures:
Sequences &
Summations
Prof. Dr. Wafaa El-Haweet & I.Asmaa Ashenkity
Sequences
Sequences represent ordered lists of elements.
A sequence is defined as a function from a subset
of integers( either cfw_0,
CPCS222 Spring 2012
Lecture#3
Foundations:
Logic and Proofs
Prof. Dr. Wafaa El-Haweet & I.Asmaa Ashenkity
Predicates
x is greater than 3
This statement is neither true nor false when the
value of the variable is not specified
This statement has two par
CPCS222 Fall 2012/2013
Lecture#7
Basic Structures:
Sets
Prof. Dr. Wafaa El-Haweet & I.Asmaa Ashenkity
Sets
Set is the fundamental discrete structure on
which all other discrete structures are built.
Sets are used to group objects together. Often,
the ob
CPCS222 - Spring 2014
Lecture #4
Chapter 1.6
Foundations:
Logic and Proofs
Rules of Inference 1.6
Goals
Understand the basic notion of a proof in a
formal system.
Derive and recognize mathematically valid
proofs.
Understand basic proof techniques.
2
7/