Ask Pak Chairul | whenever you need online assistance…
TASK 1 - Algorithm: Input – Process - OutputTask 1.1 MANUFACTURINGInputProcessOutputBambooPapersStringKnifePencilRulerOil pasteMeasuringRemarkingCuttingTyingGluingDrawingPaintingKite COLLEGE/SCHOOLInputProcessOutputClassworkHomeworkSummative testProjectParticipationMarkingFormulatingTotalingAveragingCoursework Mark DATA PROCESSINGInputProcessOutputLength = 25 cmWidth= 10 cmHeight x WidthArea = 250 cm2Task 1.2 Pseudocode and Programming script of ”Adding two numbers”:INPUTPseudocodeProgramming scriptINPUT NUMBER1INPUT NUMBER2VBNUMBER1 = CONSOLE.READLINE()NUMBER2 = CONSOLE.READLINE()INPUT NUMBER1INPUT NUMBER2PythonNUMBER1 = INPUT()NUMBER2 = INPUT()INPUT NUMBER1INPUT NUMBER2PascalReadln(NUMBER1)Readln(NUMBER2) PROCESSPseudocodeProgramming scriptSUM NUMBER1 + NUMBER2VBSUM = NUMBER1 + NUMBER2SUM NUMBER1 + NUMBER2PythonSUM = NUMBER1 + NUMBER2SUM NUMBER1 + NUMBER2PascalSUM:=(NUMBER1 + NUMBER2); OUTPUTPseudocodeProgramming scriptOutput SUMVBConsole.Writeline(SUM)Output SUMPythonPrint SUMOutput SUMPascalWriteln(SUM); Task 1.3 Logic Statements:FlagA TRUEFlagB FALSEFlagC TRUEMyNum 27Evaluate the following expressions:ExpressionEvaluates toFlagA AND FlagBFALSEFlagB AND FlagCFALSEFlagB OR FlagCTRUEFlagA AND (FlagB OR FlagC)TRUEFlagB AND (NOT FlagB)FALSE(MyNum > 27) AND FlagCFALSE(MyNum >= 27) AND (FlagC = FALSE)FALSETASK 2 - Programming Basics: LOOPSTask 2.1 FOR Count 1 TO 100OUTPUT CountENDFORA Post-Condition loop (POST-TEST):Declare Count: IntegerCount 1REPEATPRINT CountCount Count + 1UNTIL Count > 100A Pre-Condition loop (PRE-TEST):Declare Count: IntegerCount 1WHILE Count <= 100Print CountCount Count + 1ENDWHILETask 2.2 Modify the solutions from Task 2.1 to:1Prompt for the input of the Start and End value.2Output 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.1A Post-Condition loop (POST-TEST):Declare Count, StartValue, EndValue: IntegerInput StartValueInput EndValueCount StartValueREPEATIF MOD(Count, 3) = 0 Then Print CountENDIFCount Count + 1UNTIL Count > EndValueA Pre-Condition loop (PRE-TEST):Declare Count, StartValue, EndValue: IntegerInput StartValueInput EndValueCount StartValueWHILE Count <= EndValueIF MOD(Count, 3) = 0 Then Print CountENDIFCount Count + 1ENDWHILETASK 3 – Program design and codingA string exists in CamelCase format. For example: “ThisIsACamelCaseString”.A procedure is required that will:Prompt for the original stringSeparate each word of the stringStore each word in a separate array elementFill 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 StringTask 3.2 Expression of the requirements using structured EnglishAsk the user to enter the original stringUse a regular expression to insert a space between each word in the original stringSplit the new string by space into the arrayLoop into the array and for each empty location found, add the word “Empty”Task 3.3 Write the pseudocode for this designDeclare ArrayWords: Array[0:9] of StringDim OriginalString, NewText As StringInput OriginalStringNewText = InsertSpaceBetweenCamelCase(OriginalString)ArrayWords = NewText.Split(“ “)For Count = 0 to 9IF ArrayWords(count) = ““ THENArrayWords(count) = “Empty”End IFEndForTask 3.4 Write the program code for this designModule 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 9If arrayWords(count) = “” ThenarrayWords(count) = “Empty”End IfNextEnd SubTask 3.5 Amend the program code in Task 3.4 to print out the content of the arrayModule 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 9If 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 dataExampleJustificationNormal test dataThisIsACamelCaseStringValid data - acceptedAbnormal test dataAbc #2ydfj Invalid data - rejectedExtreme test dataNot applicable for this sample, because there is no numeric data involved.NoneTASK 4 – File HandlingTask 4.1 Write a pseudocodeTask 4.2 Write a pseudocodeTask 4.3 Write a pseudocodeTask 4.4 Write program codeTASK 4.1 Program codeTASK 4.1 Sample of Input and OutputTASK 4.2 Program codeTASK 4.2 Sample of Input and OutputTASK 4.3 Program codeTASK 4.3 Sample of Input and OutputTask 4.5 Extend the program code from TASK 4.4. ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- why you need an education
- what you need to buy a house
- what you need to become a lawyer
- why you need a will
- why do you need a business plan
- do you need love
- school supplies you need for 7th grade
- things you need for a new house
- what you need to start a business
- do you need a will
- need housing assistance immediately
- why you need to travel