Ics 2201 Object Oriented Programming Ii
Ics 2201 Object Oriented Programming Ii
(a) State the main difference between the following terms as used in Object
Oriented Programming.
(b) List and explain any three main Access Control Modifiers in a class
declaration that are used in Java Programming. (6 marks)
x y
1 0.1
2 0.2
Other value 0
1
Write down java switch structure for the problem. (3 marks)
(e) All variables used in any program should be associated with their
respective data types. Explain any four primitive data types used in java.
(f) Describe a constructor and explain four rules for a valid constructor in
java programming. (4 marks)
(g) Explain the parts of the main method “Public static void main
(Strings [I args]” (4 marks)
6
(h) Given a = x5 + y 3 write a program that allows user to enter the values of x
and y and give output of a and b. (4 marks)
QUESTION TWO (20 MARKS)
(b) State and explain four characteristics of Java programming which give
advantage over other high level programming languages. (4 marks)
(c) Design and write a Java program that allow the user to enter the mass (in
kg) and Height (in metres) the program then compute the body mass index
(BMI) of patient in hospital and output appropriate interpretation using the
following table.
(d) i) Explain the term jave development tool kit (jdk) (2 marks)
(a) With examples state the major difference between Java stand alone
applications and Java applets. (4 marks)
2
(b) Define the term array and write object oriented program that uses an array
to store four names and display the names. (4 marks)
(c) Using switch statement write a java program to display the day depending
on the choice entered by the user form the key board i.e. is Monday, 2 is
Tuesday, 3 is Wednesday…..7 is Sunday. (6 marks)
i) a>b&b>c
(e) With example of java program explain the difference between static and
instance variables. (4 marks)
(b) Write a java program which allows the user to input three integers in then
output the maximum of the integers. (5 marks)
i) Encapsulation
ii) Polymorphism
(a) Explain the different steps used in developing a java application.(6 marks)
(b) Java Library classes are organized into packages. Explain the use of the
following classes:
i) java.util
ii) java.awt
3
iii) javax.swing (3 marks)
i) Prompt the user to input five decimal places and convert each decimal
number to the nearest integer
ii) Prints the sum and average of the five integers (5 marks)