Asm 04
Asm 04
Duration: 70’
======================================================================
Software Requirements
• Netbean 8.2 or later, JDK 8 or later, Notepad, Command Prompt, WinRAR / WinZip with
Windows Explorer (File Explorer) on Windows 7 and above.
Instructions
• Step 1: Students download the given materials from LMS.
• 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 Q1, Q2, Q3,…), 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 Create a folder named : RollNumber_FullName_ASM0x (x : 1,2,..,6) that contains
folders (created Step 03 ) as the below figure:
IUtilities Where:
1
+ checkIntegerNumber(value:String, min: int, • checkIntegerNumber(value:String,min: int,
max: int):int max: int):int – convert value to an integer
+ removeDuplicatedWords(value: String): String have 2 to 10 digits between min and max.
+ checkFormatString(value:String):int
If value is invalid then return length of the
+ sumNumbers(value:String):double
value. [2.5 marks]
• removeDuplicatedWords (value: String):
String:– convert value to title case with
duplicated words are removed and each
word seperated by a space. [2.5 marks]
• checkFormatString(value:String): String:–
check the value formatted : A.B.C with A
is 03 uppercase letters, B is 06 digits, C in
[@#$]. If value is valid then return an
integer of B, otherwise return length of the
value. [2.5 marks]
• sumNumbers(value:String):double –
extract all digits to integer then sum of
them.[2.5 marks]
Write a class named MyUtilities, which implements the interface IUtilities. The class MyUtilities
implements all methods in IProcess as below:
+checkIntegerNumber(value:String, min: int, max: int):int []
+convertString (value: String): String
+checkFormatString(value:String):int
+sumNumbers(value:String):double
Hints: you can use the isDigit() method of Character class) to check whether a character is a digit or not and
charAt() method to get a character in the string.