web viewoil paste. measuring. remarking. cutting. tying. gluing. drawing. painting. kite....
TRANSCRIPT
TASK 1 - Algorithm: Input – Process - Output
Task 1.1
MANUFACTURINGInput Process Output
BambooPapersStringKnifePencilRulerOil paste
MeasuringRemarkingCuttingTyingGluingDrawingPainting
Kite
COLLEGE/SCHOOLInput Process Output
ClassworkHomeworkSummative testProjectParticipation
MarkingFormulatingTotalingAveraging
Coursework Mark
DATA PROCESSINGInput Process Output
Length = 25 cmWidth = 10 cm Height x Width Area = 250 cm2
Task 1.2 Pseudocode and Programming script of ”Adding two numbers”:
INPUT
Pseudocode Programming script
INPUT NUMBER1INPUT NUMBER2
VB
NUMBER1 = CONSOLE.READLINE()NUMBER2 = CONSOLE.READLINE()
INPUT NUMBER1INPUT NUMBER2
Python
NUMBER1 = INPUT()NUMBER2 = INPUT()
INPUT NUMBER1INPUT NUMBER2
Pascal
Readln(NUMBER1)Readln(NUMBER2)
PROCESS
Pseudocode Programming script
SUM NUMBER1 + NUMBER2 VB
SUM = NUMBER1 + NUMBER2
SUM NUMBER1 + NUMBER2 Python
SUM = NUMBER1 + NUMBER2
SUM NUMBER1 + NUMBER2 Pascal
SUM:=(NUMBER1 + NUMBER2);
OUTPUT
Pseudocode Programming script
Output SUM VB
Console.Writeline(SUM)
Output SUM Python
Print SUM
Output SUM Pascal
Writeln(SUM);
Task 1.3 Logic Statements:
FlagA TRUEFlagB FALSEFlagC TRUEMyNum 27
Evaluate the following expressions:
Expression Evaluates to
FlagA AND FlagB FALSE
FlagB AND FlagC FALSE
FlagB OR FlagC TRUE
FlagA AND (FlagB OR FlagC) TRUE
FlagB AND (NOT FlagB) FALSE
(MyNum > 27) AND FlagC FALSE
(MyNum >= 27) AND (FlagC = FALSE) FALSE
TASK 2 - Programming Basics: LOOPS
Task 2.1
FOR Count 1 TO 100OUTPUT Count
ENDFOR
A Post-Condition loop (POST-TEST):Declare Count: IntegerCount 1REPEAT
PRINT CountCount Count + 1
UNTIL Count > 100
A Pre-Condition loop (PRE-TEST):Declare Count: IntegerCount 1WHILE Count <= 100
Print CountCount Count + 1
ENDWHILE
Task 2.2 Modify the solutions from Task 2.1 to:
1 Prompt for the input of the Start and End value.2 Output all the numbers between the Start and End values that are exactly divisible by 3.
For the Built-in functions list, refer to the Appendix on page 7.
1 A Post-Condition loop (POST-TEST):
Declare Count, StartValue, EndValue: IntegerInput StartValueInput EndValueCount StartValueREPEAT
IF MOD(Count, 3) = 0 Then Print Count
ENDIFCount Count + 1
UNTIL Count > EndValue
2 A Pre-Condition loop (PRE-TEST):Declare Count, StartValue, EndValue: IntegerInput StartValueInput EndValueCount StartValueWHILE Count <= EndValue
IF MOD(Count, 3) = 0 Then Print Count
ENDIFCount Count + 1
ENDWHILE
TASK 3 – Program design and coding
A string exists in CamelCase format. For example: “ThisIsACamelCaseString”.
A procedure is required that will: Prompt for the original string Separate each word of the string Store each word in a separate array element Fill unused array elements with a rogue string such as “(Empty)”.
After processing the preceding example, the array contents will look like this.
ThisIsACamelCaseString(Empty)(Empty)(Empty)(Empty)
Task 3.1 Declare an arrayUse pseudocode to declare the array that can be used to store the separate words of the original string. You can assume that the original string will contain no more than 10 separate words.
Declare ArrayWords: Array[0:9] of String
Task 3.2 Expression of the requirements using structured English
Ask the user to enter the original string Use a regular expression to insert a space between each word in the original string Split the new string by space into the array Loop into the array and for each empty location found, add the word “Empty”
Task 3.3 Write the pseudocode for this design
Declare ArrayWords: Array[0:9] of StringDim OriginalString, NewText As StringInput OriginalStringNewText = InsertSpaceBetweenCamelCase(OriginalString)ArrayWords = NewText.Split(“ “)For Count = 0 to 9
IF ArrayWords(count) = ““ THENArrayWords(count) = “Empty”
End IFEndFor
Task 3.4 Write the program code for this design
Module Module1Sub Main()
Dim arrayWords() As StringDim OriginalString, NewText As StringOriginalString = Console.Readline()‘Use regular expression to have a space between the wordsNewText = Regex.Replace(OriginalString, “([a-z](?=[A-Z0-9])|[A-Z][a-z]))”, “S1 “)arrayWords = NewText.Split(“ “)‘Change the size of the array dynamically to 10 while retaining contentReDim Preserve arrayWords(9)For count = 0 to 9
If arrayWords(count) = “” ThenarrayWords(count) = “Empty”
End IfNext
End Sub
Task 3.5 Amend the program code in Task 3.4 to print out the content of the array
Module Module1Sub Main()
Dim arrayWords() As StringDim OriginalString, NewText As StringOriginalString = Console.Readline()‘Use regular expression to have a space between the wordsNewText = Regex.Replace(OriginalString, “([a-z](?=[A-Z0-9])|[A-Z][a-z]))”, “S1 “)arrayWords = NewText.Split(“ “)‘Change the size of the array dynamically to 10 while retaining contentReDim Preserve arrayWords(9)For count = 0 to 9
If arrayWords(count) = “” ThenarrayWords(count) = “Empty”
End IfConsole.WriteLine(arrayWords(count))
NextEnd Sub
Task 3.6 Test data to test the code thoroughly.
Type of test data Example Justification
Normal test data ThisIsACamelCaseString Valid data - accepted
Abnormal test data Abc #2ydfj Invalid data - rejected
Extreme test dataNot applicable for this sample, because there is no numeric data involved.
None
TASK 4 – File Handling
Task 4.1 Write a pseudocode
Task 4.2 Write a pseudocode
Task 4.3 Write a pseudocode
Task 4.4 Write program code
TASK 4.1 Program code
TASK 4.1 Sample of Input and Output
TASK 4.2 Program code
TASK 4.2 Sample of Input and Output
TASK 4.3 Program code
TASK 4.3 Sample of Input and Output
Task 4.5 Extend the program code from TASK 4.4.