Вы находитесь на странице: 1из 7

INTERNATIONAL DIPLOMA IN COMPUTING INTERNATIONAL DIPLOMA IN BUSINESS COMPUTING INFORMATICS COMPUTER DIPLOMA INTERNATIONAL DIPLOMA IN INFORMATION TECHNOLOGY &

COMMUNICATION

INTRODUCTION TO JAVA (C1022/CS153/CPG101) ASSIGNMENT TERM 2 2012 Student declaration: I declare that: I understand what is meant by plagiarism The implication of plagiarism has been explained to me by my institution This assignment is all my own work and I have acknowledged any use of the published and unpublished works of other people. Students signature:. Total number of pages including this cover page Submission Date Students ID Students Full Name Lecturers Name OFFICIAL USE ONLY Markers comments Due Date Class Code Date:

Markers name

Initial marks awarded Penalty on late submission Final marks awarded

/100

/100

T212 C1022/CS153/CPG101 ASSIGNMENT QP

Page 1 of 7

Name of Student Student ID Module Code

: ___________________________________________________ : ___________________________________________________ : C1022/CS153/CPG101

Criteria Q1. (a) Write a program segment to display what the different letters mean using the IF construct. (b) Rewrite the above codes using the SWITCH construct. (c) Convert the code from part(a) to a flowchart.

Base Mark Graded Mark

Comments

9 marks

9 marks

9 marks

Q2. Write a program in Java programming using the nested while Loop statement that will produce the following output. (in Question Q2)

8 marks

Q3. A factorial of a number X is equal to X*(X-1)*(X2)**1. For example, 3! is equal 3*2*1=6. Create a class called FactorialAlgorithm which will compute and print the factorial of an integer number on the screen.

8 marks

T212 C1022/CS153/CPG101 ASSIGNMENT QP

Page 2 of 7

Q4.Write a Java program for a bank that will calculate the monthly interest earned on a cash deposit. The user enters the amount deposited, the term, and interest rate. The program will then display a table listing for the month, interest, total interest, and account balance for each period.

10 marks

Q5.Explain the following three basic concepts with the use of JAVA program one for each of them. (i) (ii) (iii) Encapsulation Polymorphism Inheritance

30 marks

Q6. Binary search is one of the methods use to search for a particular record. Explain the steps how binary search is performed. Provide suitable java program.

17 marks

Total

100 marks

T212 C1022/CS153/CPG101 ASSIGNMENT QP

Page 3 of 7

Instructions to Students: 1. Complete the cover sheet (page 1), which forms the first page of your assignment submission. 2. The assessment criteria include:

(a)

Content of Work. This includes the amount of research done to provide accurate and credible information necessary for this assignment.

(b)

Creativity, Originality and Style of Work. This refers to the uniqueness and artistic element of the final assignment.

(c)

Presentation of the Final Assignment. This refers to the clarity, organization and final project.

3.

Independent research on the relevant topic area is encouraged. Work that demonstrates an in-depth analysis of the question and that provides a coherent answer will be awarded a higher grade compared to that which simply regurgitates answers from the texts.

4.

A minimum of three (3) references from academic journals are required aside from the textbook of the course.

5.

The document must include page number; use Times New Roman Font (Size 12) with top, bottom margins of 1 and right, left margins of 1.25 and with Justify alignment.

6.

The assignment should be organized as follows: (a) (b) (c) Cover Page. (found on the first page of this questions paper) Table of Contents. Main body of the assignment. (This should observe the given word count limit) (d) References: Example: Berko, R., Rosenfeld, L., and Samovar, L. (1997), Connecting, Harcourt Brace & Company, USA.

T212 C1022/CS153/CPG101 ASSIGNMENT QP

Page 4 of 7

Complete the mark criteria list with your name and id and submit it together in your assignment.

7.

Assignments must be presented in hard copy with CD well secured in the hardcopy. The CD should contain the following documents: Softcopy of the assignment that is submitted. Retain a photocopy of your course assignment. Complete your assignment and hand it in by: 10th Lesson

8.

9.

Lecturer has the discretion of applying a penalty of 20% for late submission.

T212 C1022/CS153/CPG101 ASSIGNMENT QP

Page 5 of 7

ASSIGNMENT QUESTIONS:

Q1. (a) When students were promoted to secondary level, they have to be stream according to 3 different streams which are as follows: S to represent special stream, E to represent express stream and N to represent normal stream. Any other letters represent no such stream. Write a program segment to display what the different letters mean using the IF construct. [9 marks]

(b) Rewrite the above codes using the SWITCH construct.

[9 marks]

(c) Convert the code from part(a) to a flowchart.

[9 marks]

Q2. Write a program in Java programming using the nested while Loop statement that will produce the following output. NO 5 10 15 Odd numbers 1 3 5 1 3 5 7 1 3 5 7 [8 marks]

9 9

11

13

15

Q3. A factorial of a number X is equal to X*(X-1)*(X-2)**1. For example, 3! is equal 3*2*1=6. Create a class called FactorialAlgorithm which will compute and print the factorial of an integer number on the screen. [8 marks]

T212 C1022/CS153/CPG101 ASSIGNMENT QP

Page 6 of 7

Q4. Write a Java program for a bank that will calculate the monthly interest earned on a cash deposit. The user enters the amount deposited, the term, and interest rate. The program will then display a table listing for the month, interest, total interest, and account balance for each period. For example, if the amount deposited is $2000.00, the term is 6 months and the interest rate is 2%, the following output will be displayed: Period 1 2 3 4 5 6 Interest 6.66 6.69 6.71 6.74 6.75 6.78 Total Interest 6.66 13.35 20.06 26.80 33.55 40.33 Total Balance 2006.60 2013.35 2020.06 2026.80 2033.55 2040.33 [10 marks]

Initial deposit: $2000.00 Total Interest: $40.33 Total Balance: $2040.33

Q5. Explain the following three basic concepts with the use of JAVA program one for each of them. (i) Encapsulation [30 marks]

(ii) Polymorphism (iii) Inheritance

Q6. Binary search is one of the methods use to search for a particular record. Explain the steps how binary search is performed. Provide suitable java program. [17 marks]

- END OF ASSIGNMENT -

T212 C1022/CS153/CPG101 ASSIGNMENT QP

Page 7 of 7

Вам также может понравиться