You are on page 1of 4

BACHELOR OF INFORMATION TECHNOLOGY (HONS)

JANUARY 2022 MAIN EXAMINATION

COURSE: OBJECT-ORIENTED PROGRAMMING

COURSE CODE: TCS3064

DATE: 12 JANUARY 2022

TIME ALLOWED: 2.00 PM – 5.00 PM (3 HOURS)

INSTRUCTIONS TO CANDIDATES:

1. This is a timed online examination via Blackboard. Please adhere to all standard
examination rules and regulations.

2. Answer ALL questions in the paper.

3. This is an Open Book Examination. You are allowed to refer to any forms of references,
including online or offline materials. However, any form of discussion with peers,
classmates or external parties is prohibited until after the Blackboard submission time.

4. You have THREE (3) hours to answer the questions AND THIRTY (30) MINUTES to
upload your answers to the Blackboard.

5. LATE submission will be awarded FAIL for the module, and NO appeal will be
granted for the following reasons:
a. Lack of knowledge on using Blackboard in submission.
b. Poor internet connection / no internet connection.
c. No computer for submission.
Read carefully the case study and the instructions that follows.

CASE STUDY :

OurSecurity Sdn. Bhd. has appointed you as their new system security developer. Your first
task is to code a new Java program that implements your teammates' new encryption
procedures/steps.

The encryption steps are as follows:

Step 1 : The program will ask the user to enter a text via console. Convert all the
characters to lower case.

Meet me at 10AM ➔ meet me at 10am

Step 2 : Swap all the vowels in the text using the following rules:

a. Swap 'a' with 'u'


b. Swap 'e' with 'a'
c. Swap 'i' with 'e'
d. Swap 'o' with 'i'
e. Swap 'u' with 'o'

meet me at 10am ➔ maat ma ut 10um

Step 3 : Inverse the swapped text without inverting the words.

maat ma ut 10um ➔ 10um ma maat

Step 4 : Replace all alphabets and numbers in the inversed text with Morse Code
alphabet using the following setting:

Note : in Morse Code, each alphabet is separated by one (1) white space and
each word is separated by two (2) white spaces.

Step 4 : The program will display the final encrypted message.

.----*-----*..-*--**..-*-**--*.-**--*.-*.-*-
(Note : * represent empty space)

2
QUESTION 1 :

Table 1 : Class and methods

Class Name Method In Purpose of the Method


Class
Input getInput() 1. Ask the user to enter a text
2. Return the original text
Swap getSwap() 1. Receive the original text from the caller.
2. Swap all the vowels based on the setting given in the
case study
3. Return the processed text
Inverse getInverse() 1. Receive the swapped text from the caller
2. Inverse the swapped text using the rule given in the
case study
3. Return the inversed text
MorseCode convertMorse 1. Receive the inversed text from the caller
Code() 2. Convert all alphabet and numeric to Morse Code
alphabets
3. Return the final Morse Code text
Encrypt main() 1. The main class and method in the program
2. Call methods of other classes following the
steps given in the case study
3. Display the final Morse Code text to console
4. Ask the user if they wish to try again or not.
5. If the user chooses to try again, restart from the first
step. If not, the program will display “Thank you”
and ends.

Using the information given in Table 1, draw a complete class diagram to represent the
communication between the classes. Each method must include the possible parameter and
return data type. (20 marks)

QUESTION 2 :

In one (1) Java file, write a program implementing all the five (5) classes and their methods
mentioned in Question 1. The body of each method is based on the encryption steps given in
the case study.

The implementation must include suitable control and data structure. But you are not restricted
to the one discussed in class. The program must also have proper documentation/comments
explaining key point of your program. This will assist with the code readability and tracing.

The program will be graded based on correctness, program logic, implementation of control
and data structure and documentations. (80 marks)

3
Example of expected output :

Please enter a text : Meet me at 10AM


Encrypted text : .---- ----- ..- -- ..- - -- .- -- .- .- -

Do you want to try again? Press y or n : y

Please enter a text : 123456


Encrypted text : .---- ..--- ...-- ....- ..... -....

Do you want to try again? Press y or n : n

Thank you.

-END OF QUESTION –

You might also like