0% found this document useful (0 votes)
5 views2 pages

Workshop 1

ef

Uploaded by

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

Workshop 1

ef

Uploaded by

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

Practical Exam – PRO192

Duration: 60’
======================================================================
Software Requirements
 Netbean 8.2 or later, JDK 8, Notepad, Command Prompt, WinRAR / WinZip with Windows
Explorer (File Explorer) on Windows 7 and above.
Students are ONLY Allowed to use:
 His / her study materials like sample codes and program examples are stored on his / her
computer only.
Instructions
 Step 1: Students download the given materials from the exam software.
 Step 2: Students read questions and prepare answers in the given template.
 Step 3: Prepare to submit the answer:
o For each question (e.g., question 1), please create two sub-folders: run and src.
o Copy the *.jar file into the run folder, and the entire project source code file into the
src folder.
 Step 4: Submit a solution for each question:
o Choose the question number (e.g., 1) in PEA software, and then attach the
corresponding solution folder (e.g., 1). Click the Submit button to finish submitting
this question.
o

Note:
o Solutions will be marked by Automated Marking Software.
o The use of tools other than those allowed in the above section whether intentionally or
unintentionally, is considered a violation of the exam rules, and the exam result will be 0.
o Do not change the names of the folders and files specified (or required ) in the exam and the
name of the submit folders in Step 04 must be correct. If you change it (incorrectly), the
marking software can not find the execute file (.jar) to mark, thus the exam result will be 0.
======================================================================

 Question 1: (5 marks)
Write a class JavaBasic (in the default package of the NetBean) with the following information:

1
JavaBasic Where:
 calculate(a : int, b: int, op: char): void – print
the result is printed out to the monitor of the
operator a with b (Format real numbers with
+ calculate(a : int, b: int, op: char): void
2 decimal places)
+ indexOf(a: int[], int key): int
 indexOf(a: int[], int key): int – return the
+ minOf(a: int[]): int index of key in array a, otherwise return -1
 minOf(a: int[]): int - return the minimum
value in array a

Do not format the result.


The program output might look something like this:
1.Test calculate() 1.Test calculate() 1.Test calculate() 1.Test calculate()
2.Test indexOf() 2.Test indexOf() 2.Test indexOf() 2.Test indexOf()
3.Test minOf() 3.Test minOf() 3.Test minOf() 3.Test minOf()
Enter TC(1/2/3):1 Enter TC(1/2/3):1 Enter TC(1/2/3):2 Enter TC(1/2/3):3
Enter a:1 Enter a:2 Enter a[0]:1 Enter a[0]:1
Enter b:0 Enter b:3 Enter a[1]:2 Enter a[1]:2
Enter operator(+ , -, *, /):/ Enter operator(+ , -, Enter a[2]:3 Enter a[2]:3
OUTPUT: *, /):/ Enter a[3]:4 Enter a[3]:4
Divisor 0 OUTPUT: Enter a[4]:5 Enter a[4]:5
0.67 Enter key:6 Enter key:6
OUTPUT: OUTPUT:
-1 1

 Question 2: (5 marks)
Write a class MyString (in the default package of the NetBean) with the following information:
MyString Where:
 reverseWords(s: String): String
– return the reverse words of
string s
+ reverseWords(s: String): String
 capitalizeFullName((s: String):
+ capitalizeFullName((s: String): String
String – return the capitalize
of string.

Do not format the result.


The program output might look something like this:
Enter string:The code's oop course is Enter string:The code's oop course is PRO192
PRO192 1.Test reverseWords
1.Test reverseWords 2.Test capitalizeFullName
2.Test capitalizeFullName Enter TC(1 or 2):2
Enter TC(1 or 2):1 OUTPUT:
OUTPUT: The Code's Oop Course Is PRO192
PRO192 is course oop code's The

You might also like