MEMORANDUM

NAME OF LEARNER:

TOTAL QUESTION 1:

TOTAL QUESTION 2:

TOTAL QUESTION 3:

TOTAL QUESTION 4:

TOTAL

/40

/40

/40

/30

/150

 

QUESTION 1: GENERAL PROGRAMMING SKILLS

MAX. MARKS

MARKS ACHIEVED

1.1

Button [1.1 Display Club name]

  • Get name from edit box
  • Join system date (converted to a string)  to the end of the name
  • Display name in panel
  • Change font size of the panel to 24
  • Change font style of panel to bold

6

 

1.2

Button [1.2 Process]

  • Get weight as a number
  • divide by 1000
  • remove decimals from weight (trunc or any other method)
  • use global variables  initialise the global variables  
  • Use case or IF
    • Multiply correct amount per category
    • Add to totals
    • Display amounts in correct panels
    • for all three waste products
    • formatted to currency  2 decimal places

16

 
    MAX. MARKS MARKS ACHIEVED

1.3

Button [1.3 Test for leap year]

  • Obtain the year from edit box  convert to integer
  • If year mod 400 = 0
  • then use message component to display leap year

else

  • If year mod 100 = 0
  • then use message component to display NOT leap year

else

  • if year mod 4 = 0
  • then use message component to display leap year

else

  • use message component to display NOT leap year

Alternative solution using a Boolean flag:

  • Obtain the year from edit box  convert to integer
  • If year mod 400= 0
  • then set Boolean variable to true

else

  • If year mod 100 = 0
  • then set Boolean variable to false

else

  • if year mod 4 = 0
  • then set Boolean variable to true
  • if Boolean flag is true
  • use message component to display leap year

else

  • use message component to display NOT leap year

12

 

1.4

Button [1.4 Pattern]

  • Initialise string  Initialise char  
  • Use a loop
    • Skip 2 characters using any correct method
    • Join third character to string
  • Display line after the loop in the richedit

6

 

TOTAL QUESTION 1

40

 

QUESTION 2: OBJECT-ORIENTATED PROGRAMMING

MAX. MARKS

MARKS ACHIEVED

2.1.1

Constructor Create:

  • Correct name  with two string parameters
  • Set fname and fleader to correct parameter values
  • Set ftrees and fassistants to 0

5

 

2.1.2

Function calculatefunds : real

  • Correct method – function Real data type
  • Calculation:
    • ftrees x 2  + 250  + fassistants x 100
    • Return result

6

 

2.1.3

Procedure addnumber;

  • Correct method – procedure
  •  Two integer parameters
  • Add  values to ftrees  and fassistants
  • Call calculatefunds  to set ffunds attribute

7

 

2.1.4

Function tostring: string;

  • Correct method – function
    • String data type  
  • Compile string  
  • Correct attributes
  • Convert fassistants and ftrees to integers  
  • Convert ffunds to currency and two decimals  
  • Use #13 correctly
  • Return the string

8

 
 

2.1 Subtotal: Object class

26

 

2.2.1

Button [Q2.2.1]

  • Instantiate the object
  • Object name =  tcountry.create
    • With two string parameters
    • In correct order
  • Load picture into image component
  • Enable the panel pnlQ2

6

 

2.2.2

  • Get values from two spinedits
  • Use both values as parameters and the object  to call
  • procedure addnumbers
  • Display in the label using the object name  and tostring function

8

 
 

2.2 Subtotal: Form class

14

 

TOTAL QUESTION 2

40

 

QUESTION 3: DATABASE PROGRAMMING

MAX. MARKS

MARKS ACHIEVED

3.1.1

Button: [3.1.1]

4

 

SQL: select MaterialType from Material order by MaterialType DESC

Concepts:

  • SELECT correct field
  • FROM correct table
  • ORDER BY correct field  DESC

3.1.2

Button: [3.1.2]

5

 

SQL: Select MaterialType from Material where MaterialType like ' + quotedstr('%' + SLINE + '%')

Concepts:

  • SELECT correct field  
  • FROM correct table  
  • WHERE materialtype
  • LIKE  Quoted string (sline)
  • Wildcards (%) in correct places

3.1.3

Button: [3.1.3]

5

 

SQL: Select Datedisposed, MaterialType from Material where Month(DateDisposed) = 10

Concepts:

  • SELECT two correct fields
  • FROM correct table
  • WHERE MONTH  (datedisposed)
  • Equal to 10

3.1.4

Button: [3.1.4]

4

 

SQL: update Disposal set Employees = Employees + Employees*10/100

Concepts:

  • UPDATE Disposal
  • Set Employees =
  • Employees +  Employees x 10%
  • (also accept: employees x 1.1 or employees x 110/100)

3.1.5

Button: [3.1.5]

7

 

SQL: Select sum(Quantity) As Total_Quantities, DisposalMethod from Material, Disposal where

Material.Disposalcode = Disposal.Disposalcode group by DisposalMethod

Concepts:

  • Select sum  (Quantity)  
  • AS total_quantities  Disposalmethod
  • FROM Material, Disposal
  • Where clause to join two tables
  • Group by Disposalmethod
 

3.1 Subtotal: SQL

25

 

3.2.1

Button: [3.2.1]

  • Move to first record of tblmaterial
    • Loop while not end of table
      •  If disposalcode = 6
    •  Then tblmaterial.edit
      • Set greenhousefactor = 2
      • tblmaterial.post
  • Move to next record before end of loop

7

 

3.2.2

Button: [3.2.2]

  • Move to first record of tblmaterial
  • Loop while not end of table
    • Running Total of greenhousefactor  x quantity
    • Move to next record before end of loop
  • Display total at end of edit box text
    • Converted to real number

8

 
 

3.2 Subtotal: Code constructs

15

 

TOTAL QUESTION 3

40

 

QUESTION 4: PROBLEM SOLVING

MAX. MARKS

MARKS ACHIEVED

4.1

Combobox option [Total weight of All waste]

  • Use case or nested IF for all options
  • Loop using icount
    • Add total to weights in array
  • Display in panel converted to string after the loop

4

 

4.2

Combobox option [Total weight of RECYCLED waste]

  • Initialise total variable
  • Loop  using icount
    • If arrdata contains ‘Recycled’
      • Then Add total to weights in array
  • Display in panel  converted to string after the loop

5

 

4.3

Combobox   option    [Percentage    of                        RECYCLED waste]

  • Recycled/total x 100
  • rounded
  • Display in panel converted to string

3

 

4.4

Combobox option [TOTAL weight of EACH waste product]

  • Initialise local totalling array with 15 indices to zeros
  • Loop from 1 to 15 (for arrtypes)
  • Loop from 1 to icount (for arrdata)
  • If  arrdata (correct loop index)
  • Contains arrtypes content (correct loop index)
  • Then add weight
  • from arrweights (correct loop index)
  • to totalling array (correct loop index)
  • assignfile statement for report.txt
  • rewrite statement  loop from 1 to 15  write to textfile
  • a compiled string using arrtypes array
  • and new total array  converted to string
  • closefile statement

18

 

TOTAL QUESTION 4

30

 

SAMPLE SOLUTIONS

QUESTION 1

1 ajgd

9 jgauyd

10 au ygd

QUESTION 3

11 agduya

12 aygduyad

13 ajgduya

QUESTION 4

14 aygdyuad

Last modified on Friday, 25 February 2022 08:12