THE EAST AFRICAN UNIVERSITY
SCHOOL OF COMPUTER SCIENCE AND IT
UNIVERSITY COURSE UNIT
COURSE UNIT: JAVA PROGRAMMING
COURSE CODE: CIT 1201
SESSION: SEP – DEC 2021 TIME: 2HRS
INSTRUCTIONS: QUESTION ONE IS COMPULSORY AND
ATTEMPT ANY OTHER TWO QUESTIONS
QUESTION ONE:
a) Name and explain two types of programs that can be created by java (4 marks)
b) Describe five features of JAVA. (10 marks)
c) Explain the four Object Oriented programming principles. (8 marks)
d) Differentiate between println and printf system. out methods. (2 marks)
e) Write the code for a java application that will display the string “Hello World”.
(6 marks)
QUESTION TWO:
a) Name and explain three control structures used in java. (6 marks)
b) Differentiate between an algorithm and pseudocode. (4 marks)
c) The following is a pseudocode algorithm that uses counter-controlled repetition to solve the class-
average problem.
1 Set total to zero
2 Set grade counter to one
3
4 While grade counter is less than or equal to ten
5 Prompt the user to enter the next grade
6 Input the next grade
7 Add the grade into the total
8 Add one to the grade counter
9
10 Set the class average to the total divided by ten
11 Print the class average
Write a java class that will implement the pseudocode. (10 marks)
QUESTION THREE:
a) Develop a java applet that will draw a display a welcome message. (10 marks)
b) Using examples differentiate between while and do while loops.
(6 marks)
c) List four essentials of counter-controlled repetition. (4 marks)
QUESTION FOUR:
a) Describe the following escape sequences as used in JAVA. (5 marks)
\n
\t
\r
\\
\”
b) Name and explain variable passing mechanisms used in Java. (4 marks)
c) Write a Java application program that will prompt the user to enter two numbers then
calculate and display their sum and difference. (11marks)
QUESTION FIVE
a) You are requested by a bank manager to develop a desktop application that will do the
following:
Display account details for account holders
Receive deposits from account holders
Allow account holders to withdraw
Write a java application with at least 4 classes that will perform the tasks above
and a fourth class that will have the main method. (20 marks)