0% found this document useful (0 votes)
48 views

DL - BIT 2204A - Java Programming - Part 2

This document provides instructions for a Java programming exam consisting of two sections worth 20 marks each. Section A contains four questions: (1) write a class to check if a number is even or odd, (2) write an ATM class, (3) write a class to compute the area and perimeter of a circle, and (4) write a class to determine a grade based on marks entered by the user. Section B contains five questions: (1) explain a Java code snippet, (2) write a commented program to print personal details, (3) write a triangle area computation program with objects and methods, (4) create a class to store student names in an array and print them, and (5

Uploaded by

Travis Danny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

DL - BIT 2204A - Java Programming - Part 2

This document provides instructions for a Java programming exam consisting of two sections worth 20 marks each. Section A contains four questions: (1) write a class to check if a number is even or odd, (2) write an ATM class, (3) write a class to compute the area and perimeter of a circle, and (4) write a class to determine a grade based on marks entered by the user. Section B contains five questions: (1) explain a Java code snippet, (2) write a commented program to print personal details, (3) write a triangle area computation program with objects and methods, (4) create a class to store student names in an array and print them, and (5

Uploaded by

Travis Danny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

UNIVERSITY EXAMINATIONS: 2019/2020

EXAMINATION FOR THE DEGREE OF BACHELOR OF SCIENCE IN


INFORMATION TECHNOLOGY/ BACHELOR OF BUSINESS IN
INFORMATION TECHNOLOGY
BIT 2204A /BBIT 310: JAVA PROGRAMMING

DISTANCE LEARNING

DATE: MAY, 2020 TIME: 6 HOURS

INSTRUCTIONS: Answer ALL Questions

SECTION B:
QUESTION ONE (20 MARKS)

(a) Write a java class that implements the following pseudocode [4 Marks]

1 Start
2. Read number N,
3. Set remainder as N modulus 2,
4. If remainder is equal to 0 then number N is even, else number N is odd
5. Print output.
6. Stop

(b) Write a java class that implements the following ATM pseudocode [5 Marks]

1
(c) Write a program called CircleComputation, which prompts user for a radius (of double) and
compute the area and perimeter of a circle. The output shall look like: [6 Marks]
Enter the radius: 1.2
The area is 4.5239
The perimeter is 7.5

(d) Write a program that performs the following tasks [5 Marks]


1. Declare variables for storing Marks
2. Prompts the user to enter total KCSE Marks.
3. Utilize switch structure to determine the grade (e.g. A,B ...)
4. Prints the grade

SECTION C:

QUESTION TWO (20 MARKS)

(a) Briefly explain the following java code [4 Marks]

public class PROG


{ public static void main(String[] args)
{ Int x,y,results,diff;
x = 9;
y = 4;
sum = x + y;
diff = x – y;
System.out.println(“sum is " + results);
System.out.println(“diff is " + diff);
}}

(b) Write a well commented java program that prints the following output. [4 Marks]

Age is: 30
Name is: job
Course is: Information Technology
Faculty is: FOCIM

(c) Write a java program for computing area of a triangle. The program should contain the following
features [4 Marks]

i. objects
ii. More than one methods

(d) Create class named student_names that prompts the user to enter three names of three students,
puts them in an Array, utilize do – while loop to read the names in the array and prints all the
of them [4 Marks]

(e) Write while-loop structure using a well commented java programming code that can print the
following five numbers [4 Marks]
1,2,3,4,5

You might also like