0% found this document useful (0 votes)
4 views41 pages

q1 q2 only

This lesson plan outlines practical questions for Paper 1, providing guidance on answering questions related to general programming skills, databases, object-oriented programming, and problem-solving. It includes specific tasks for coding, such as displaying user input, manipulating data, and calculating averages, along with examples and expected outputs. Additionally, it emphasizes the importance of understanding key concepts and practicing relevant skills for each question type.

Uploaded by

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

q1 q2 only

This lesson plan outlines practical questions for Paper 1, providing guidance on answering questions related to general programming skills, databases, object-oriented programming, and problem-solving. It includes specific tasks for coding, such as displaying user input, manipulating data, and calculating averages, along with examples and expected outputs. Additionally, it emphasizes the importance of understanding key concepts and practicing relevant skills for each question type.

Uploaded by

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

LESSON PLAN

PRACTICAL QUESTIONS – PAPER 1

GENERAL NOTES ON ANSWERING PRACTICAL QUESTIONS

1. Three past papers have been provided in this document per question for Paper
1.

2. Refer to Learner Resource files for Data files per question


.
3. Study the Exam Guideline document for Paper 1.

4. Study the Concept document provided.

5. Question 1 - General
a. Grade 10/11 problem solving/algorithm skills must be known.
b. Consult Exam Guideline Document for examples of possible
questions/list of components/math functions.
c. GUI manipulation through code.
6. Question 2 - Databases
a. 2.1 – code construct manipulating databases from grade 11 (20 marks)
b. 2.2 – SQLs (select/update/delete/insert) (20 marks)
7. Question 3 – OOP
a. Understand the following key concepts/methods
i. Attributes
ii. Constructor
iii. Mutator method
iv. Assessor method
v. toString
vi. Auxillary methods
vii. Parameters
viii. Object Instantiation
b. Take note of keywords in questions like:
i. Return – always a function
ii. Receive – receive parameters
8. Question 4 – Problem Solving
a. One dimensional and two dimensional arrays must be
understood well and practiced for this problem solving question.
b. Parallel arrays/sorting/searching must be practiced.

Page 1 of 106
LESSON PLAN
QUESTION 1 – GENERAL PROGRAMMING SKILLS

1. NOVEMBER 2023 Q1

1.1 Button [1.1 - Display name and age]

The user must do the following:

 Enter a name in the edit box edtQ1_1.


 Enter/Select the person's age in the spin edit box spnQ1_1.

Write code to do the following:

 Extract the name entered from the edit box edtQ1_1 and store
the name in the provided sName variable.
 Extract the age entered/selected from the spin edit spnQ1_1
and store the age in the provided iAge variable.
 Display the name and age, one below the other, using an
output dialogue box.

Example of input:

Example of output:

(5)

Page 2 of 106
LESSON PLAN

1.2 Button [1.2 - Hockey teams]

Learners who are interested in playing hockey are divided into teams of
11 players. A total of 11 players represents a full team in hockey.
The remainder of the learners who could not make up a full team
will be placed onto a reserve list.

A constant variable which is declared as PLAYERS = 11 has been

provided. Write code to do the following:

 Extract the total number of learners from the edit box edtQ1_2.
 Use the total number of learners and the constant PLAYERS to
calculate the following:
o Number of hockey teams made up of 11 players
o Number of learners on the reserve list

(9)

1.4 Button [1.4 - Marathon results]

Participants who complete a marathon and finish in one of the top


20 positions will receive a gold, silver or bronze medal, based on
their finishing position. All other participants who finish after the
20th position will receive a participation certificate.

Code has been provided using an input dialogue box for the user to
enter the finishing position of a participant. The user input is
assigned to the variable iPosition.

Write code that uses a case statement to display an appropriate


message in the label lblQ1_4 based on the information in the table
below.

Finishing position Award


1 Gold medal
2 and 3 Silver medal
4 to 20 Bronze medal
After 20 Participation
certificate

Page 3 of 106
LESSON PLAN

Example of input and output if a learner achieved the first place:

Example of input and output if a learner achieved the 20th place:

Example of input and output if a learner achieved the 21st place:

(6)

1.5 Button [1.5 - Average mark]

A text file called 'Details.txt' contains the names and marks of


learners in the following format:

<Name>#<Mark>

Example of the first five lines of text in the text file:


Erinn Stansell#87
Michael Dinjes#90
Gabrielle
Wadhams#23 Mirelda
Berendsen#47 Elmore
Skalls#32

Page 4 of 106
LESSON PLAN

Write code to do the following:


 Open the text file Details.txt, read through the lines of text in
the text file and determine the average mark for all the
learners.
 Display the average mark on the panel pnlQ1_5, rounded to the
nearest integer.

NOTE: Your code must work correctly for any number of lines of
text in the file.

HINT: Use the position of the hash character (#) to extract the
mark for each learner.

Example of output:

(15)

TOTAL : 40

2. NOVEMBER 2022 Q1

Page 5 of 106
LESSON PLAN

1.1 Button [1.1 - Properties]

Write code to change the properties of panel pnlQ1_1 as follows:

 Set the colour to yellow.


 Set the font to italics.
 Change the caption to 'I love programming!'.

Example of output:

(3)

1.2 Button [1.2 - Leave month]

An employee selects the month during which he/she wants to take


leave. The company is closed from June to August and leave cannot
be taken during this period of time.

The combo box cmbQ1_2 has been populated with the names of the
months from January to December.

The user must select a month from combo box cmbQ1_2.

Write code to do the following:


 Extract the month selected from combo box cmbQ1_2.
 If the company is open in the selected month, display a
message on the label lblQ1_2 using this format:

"Your leave in " <month> " has been granted."


 If the company is closed during the selected month, do the following:
o Display a message on the label lblQ1_2 using this format:
"Company closed, select another month."
o Clear the selection of the month from combo box cmbQ1_2.

Page 6 of 106
LESSON PLAN

Example of output if April is selected:

Example of output if July is selected:

(7)

1.3 Button [1.3 - Calculate]

The result of the following formula is required:

C = √𝐴5 + 𝜋𝐵2

The user must enter the values for A and B in the edit boxes

provided. Write code to do the following:


 Extract the value of A from edit box edtQ1_3_1 and the value of
B from edit box edtQ1_3_2.
 Use appropriate mathematical functions to calculate the value
of C, using the formula provided.
 Display the truncated value of C in edit box edtQ1_3_3.

Example with the values of 3.15 (A) and 1.07 (B) as input and the
result (C) as output:

(8)

Page 7 of 106
LESSON PLAN

1.4 Button [1.4 - Marks]

The number of subjects that learners are enrolled for varies. The
marks achieved by a learner for each subject must be entered, and
the average mark must be calculated based on the number of
marks that was entered.

Write code to do the following:


 Allow the user to enter the marks achieved by a learner per
subject, starting from subject number 1.
 Use a conditional loop and an input box to enter the marks. The
loop must terminate when a mark of -1 is entered.
 As marks are entered, a numbered list of subjects and marks
must be displayed in the redQ1_4 output area, as shown in the
examples that follow.
 After the loop for input has been terminated, calculate the
average mark achieved by the learner. Display the average mark
in the redQ1_4 output area, formatted to TWO decimal places.

Example of input of marks:

Examples of output:
Marks for two subjects and the average:

Page 8 of 106
LESSON PLAN

Marks for eight subjects and the average:

(11)

1.5 Button [1.5 - Anagram]

Two words must be analysed to determine whether the words form


a perfect anagram or not. A perfect anagram is when another word
is formed by rearranging the letters of the original word. For
example, the word cat formed from the word act, peach from cheap
and dusty from study.

Code has been provided to extract two words from edit boxes edtQ1_5_1
and edtQ1_5_2 and convert them to lower case.

Write code to determine whether the two words extracted from the
edit boxes form an anagram or not and display a suitable message
in memo memQ1_5.

Examples of input and output:

(11)

TOTAL : 40

Page 9 of 106
LESSON PLAN

3. NOVEMBER 2021 Q1

1.1 FormCreate event

Write code to change the format of the label lblQ1_1 as follows:


 Display the text 'Coding is' when the program is executed.
 Change the colour of the text to green (clGreen).
 Change the size of the font to 16 pt.
 Change the font to
'Arial'. Example of
output:

(4)

Page 10 of
106
LESSON PLAN

1.2 Button [1.2 - Number of rolls]

Energy sweets recommended for hikers to have during each break


while hiking are packaged in rolls of eight sweets per roll. Hikers
normally eat four sweets during each break. Use the spnQ1_2 spin
edit to select/enter the number of breaks a hiker plans on taking.
The program must determine the number of sweet rolls that must
be purchased for the hike.
Write code to do the following:
 Create a constant SWEETS_PER_ROLL to store the value of 8.
 Declare suitable integer variables for the number of breaks,
the total number of sweets and the number of rolls to
purchase.
 Extract the number of breaks to be taken during a hike from the spnQ1_2
spin edit.
 Calculate the total number of sweets that a hiker will have
during the hike. Assume that hikers will consume four sweets
during each break.
 Calculate the minimum number of rolls that need to be
purchased to supply the hiker with enough sweets for the hike.
 Display the number of rolls on the lblQ1_2 label.

Example of output for seven breaks: Example of output for eight breaks:

(8)

1.3 Button [1.3 - Calculate volume]


The figure shown below was compiled using a combination of half a

sphere and a tetrahedron (a solid shape with four flat sides that are
triangles). The program must calculate and display the volume of
the combined figure.

Page 11 of
106
LESSON PLAN
The following information is provided:

1
 The formula to calculate the volume of the combined figure is:
𝑉 = 𝑣𝑜𝑙𝑢𝑚𝑒 𝑜𝑓 𝑡𝑒𝑡𝑟𝑎ℎ𝑒𝑑𝑟𝑜𝑛 + (𝑣𝑜𝑙𝑢𝑚𝑒 𝑜𝑓 𝑠𝑝ℎ𝑒𝑟𝑒)
2

Page 12 of
106
LESSON PLAN

 The volume of the tetrahedron in the figure is given as 133 cm3


.

4
 The formula to calculate the volume of a sphere is:
𝑉=
𝜋𝑟3
3

Use the information provided and write code to do the following:


 Calculate the volume of the combined figure if the radius of the
sphere is 3 cm.
 Display the volume in a ShowMessage box formatted to ONE
decimal place.
Example of output:

(7)

1.4 Button [1.4 - Display pattern]

A pattern with a symbol selected from the cmbQ1_4 combo box


must be displayed. The pattern is a square which consists of the
same number of rows and columns. The number of rows and
columns is obtained from the position of the symbol that has been
selected from the combo box.

NOTE: The first item (@) in the combo box is situated in position one.

Page 13 of
106
LESSON PLAN

The first eight symbols in the combo box are shown below.

Write code to do the following:


 Clear the output area redQ1_4.
 Extract the symbol selected by the user from the cmbQ1_4 combo box.
 Obtain the position of the symbol selected in the combo box to
determine the number of rows and columns.
 Use nested loop structures to display the pattern (block) in
the rich edit, using the selected symbol.

Example of output if the first item (@) is selected in cmbQ1_4:

Example of output if the third item ($) is selected in cmbQ1_4:

(11)

1.5 Button [1.5 - Characters]

A string must be compiled by randomly generating upper-case


letters of the alphabet until the same letter is generated
consecutively.

Code has been provided to clear the rich edit and to initialise an

output string. Write code to do the following:

Page 14 of
106
LESSON PLAN
 Randomly generate a capital letter from the alphabet in the range 'A'..'Z'.
 Compile a string using the generated letters.
 Repeat the process until the generated letter is a duplicate of
the previous (last) letter that was generated.
 Display the generated string in the redQ1_5 rich edit. Each time
the output string must include the final duplicate characters, as
shown in the example output.

HINT: The ASCII values for the letters 'A' to 'Z' start at 65 for the
letter 'A', 66 for the letter 'B', and so on up to the value of 90
for the letter 'Z'.

Example of output:

In the example above, the process was terminated because the


letter 'U' was generated consecutively.

In the example above, the process was terminated because the


letter 'C' was generated consecutively.

NOTE: The output your program generates may differ from the
output examples, because the letters are randomly
generated. The string that is generated can contain less or
more characters than the strings
supplied in the examples. (10)

TOTAL : 40

Page 15 of
106
LESSON PLAN
QUESTION 2 – DATABASE PROGRAMMING

1. NOVEMBER 2023 Q2

Universities rely on effective administration and communication to facilitate


the smooth running of their processes.

A database called UniversityDB.mdb, which contains information on the


different lecturers and the courses they teach, has been developed.

The database contains two tables, tblLecturers and tblCourses.

NOTE: The data pages attached at the end of this question provide information on
the design of the database and its contents.

Do the following:
 Open the incomplete project file called Question2_P.dpr in the Question 2 folder.
 Enter your examinationnumber as a comment in the first line of the
Question2_U.pas unit file.
 Compile and execute the program. The program has no functionality
currently. The contents of the tables are displayed, as shown below on
the selection of tab sheet
2.2 - Delphi code.

Page 16 of
106
LESSON PLAN

 Follow the instructions below to complete the code for each section as
described in QUESTION 2.1 and QUESTION 2.2.
 Use SQL statements to answer QUESTION 2.1 and Delphi code to
answer QUESTION 2.2.

NOTE:
 The 'Restore database' button is provided to restore the data contained
in the database to the original content.
 The content of the database is password-protected, i.e. you will NOT
be able to gain direct access to the content of the database using
Microsoft Access.
 Code is provided to link the GUI components to the database. Do NOT
change any of the provided code.
 TWO variables are declared as public variables, as described in the table below.

Variable Data type Description


tblLecturers TADOTable Refers to the table tblLecturers
tblCourses TADOTable Refers to the table tblCourses

2.1 Tab sheet [2.1 - SQL]

Example of graphical user interface (GUI) for QUESTION 2.1:

Page 17 of
106
LESSON PLAN

NOTE:
 Use ONLY SQL statements to answer QUESTION 2.1.1 to
QUESTION 2.1.5.
 Code to execute the SQL statements and display the results of the
queries is provided. The SQL statements assigned to the variables
sSQL1, sSQL2, sSQL3, sSQL4 and sSQL5 are incomplete.

Complete the SQL statements to perform the tasks described


in QUESTION 2.1.1 to QUESTION 2.1.5 below.

2.1.1 Button [2.1.1 - Large enrolments]

Display the details of all the courses in the tblCourses table,


that can accommodate 100 or more students.

Example of output of the first five records:

(3)

2.1.2 Button [2.1.2 - Lecturer gender]

Display the LecturerName, LecturerSurname and the first letter


of the gender of all the lecturers. Display the gender using a
column heading called Gender (M/F).

Example of output of the first five records:

(4)

2.1.3 Button [2.1.3 - Multilingual lecturers]

Display the CourseID and CourseName of all courses that have a


multilingual lecturer. The results must be sorted in alphabetical
order according to the course name.

Page 18 of
106
LESSON PLAN
Example of output of the first five records:

(6)

2.1.4 Button [2.1.4 - Lecturer salaries]

A lecturer's salary is determined by the number of courses


facilitated by that lecturer. An amount of R10 000 is paid for
each course facilitated by the lecturer. For example, if a
lecturer facilitates three courses, the lecturer will get a total
salary of R30 000.

Display the LecturerID and the total salary in a new column with
the heading Salary, formatted to currency.

Example of output of the first five records:

(5)

2.1.5 Button [2.1.5 - Change online option]

Write code to change the OnlineOption field to false if the


CourseName field contains the word 'Programming'.

Code has been provided to display a message to indicate


that the content of the database has been changed.

Example of the first six records of the tblCourses table before


the online option was changed:

Page 19 of
106
LESSON PLAN
Example of the first six records of the tblCourses table after
the online option was changed to false for the programming
courses:

(4)

2.2 Tab sheet [2.2 - Delphi code]

NOTE:
 Use ONLY Delphi programming code to answer QUESTION 2.2.1
and QUESTION 2.2.2.
 NO marks will be awarded for SQL statements in QUESTION 2.2.

Example of graphical user interface (GUI) for QUESTION 2.2:

Page 20 of
106
LESSON PLAN

2.2.1 Button [2.2.1 - Average duration of courses]

The workload of all lecturers must be determined in order to


issue them with a fair number of courses to facilitate.

Use the redQ2_2_1 component to display the output.

Code has been provided to clear the redQ2_2_1

component. Write code to do the following:

 Display the LecturerID, LecturerName and LecturerSurname


as a heading in the following format:
<LecturerID>: <LecturerName> <LecturerSurname>
 Display a numbered list of course names facilitated by each lecturer.
 Calculate and display the average duration of the courses
facilitated by each lecturer, formatted to TWO decimal
places.

Example of output for the first two lecturers:

(14)

2.2.2 Button [2.2.2 - Register new lecturer]

When a new lecturer is appointed, their details must be


added to the database.
Write code to add a new record to the tblLecturers table
using the following details:
 LecturerID – ZT032
 LecturerName – Zander
 LecturerSurname – Thomas
 Gender – Male
 Multilingual – True
Example of records in the tblLecturers table, which indicates that the
record has been added to the table successfully:

(4)

Page 21 of
106
LESSON PLAN
TOTAL : 40

Page 22 of
106
LESSON PLAN

DATABASE INFORMATION FOR QUESTION 2 2023:

The design of the database tables for the database UniversityDB is as

follows: Table: tblLecturers

This table contains the details of the lecturers.

Field name Data type Description


LecturerID Text (5) A unique ID used to identify a lecturer
LecturerName Text (25) The first name of the lecturer
LecturerSurnam Text (25) The last name of the lecturer
e
Gender Text (6) The gender of the lecturer
Multilingual Boolean A field that indicates whether a
lecturer can present a course in more
than one language

Example of the records van the tblLecturers table:

Table: tblCourses

This table contains information on the courses offered at the university.

Field name Data type Description


CourseID Text (10) A unique ID used to identify a course
CourseName Text (35) The name of the course
Duration Number The duration of the course (in weeks)
MaxStudents Number The maximum number of students allowed
in the course
OnlineOption Boolean A field that indicates whether an online
option is available to students
LecturerID Text (5) The ID of the lecturer that presents the
course

Page 23 of
106
LESSON PLAN

Example of the first ten records of the tblCourses table:

NOTE:
 Connection code has been provided.
 The database is password-protected; therefore, you will not be able to
access the database directly.
The following one-to-many relationship with referential integrity exists between the
two tables in the database:

Page 24 of
106
LESSON PLAN

2. NOVEMBER 2022 Q2

The Collect-a-Can recycling initiative has developed a database called


CollectionDB.mdb, which contains information about the collection of cans from
clients for the years 2020 to 2022.

An application is required that will use the CollectionDB.mdb database to manage


the data and payments to clients who participate in the cash-for-cans initiative.

The database contains two tables called tblClients and tblCanCollection.

NOTE: The data pages attached at the end of this question provide information on the design
of the database and its contents.

TWO variables are declared as public variables, as described in the table below.

Variable Data type Description


tblClients TADOTable Refers to the table tblClients
tblCanCollection TADOTable Refers to the table tblCanCollection

Page 25 of
106
LESSON PLAN

2.1 Tab sheet [Question 2.1 - SQL]

Example of graphical user interface (GUI) for QUESTION 2.1:

NOTE:
 Use ONLY SQL code to answer QUESTION 2.1.1 to QUESTION 2.1.5.
 Code to execute the SQL statements and display the results of the
queries is provided. The SQL statements that will be assigned to
the variables sSQL1, sSQL2, sSQL3, sSQL4 and sSQL5 are
incomplete.

Complete the SQL statements to perform the tasks described


in QUESTION 2.1.1 to QUESTION 2.1.5 below.

2.1.1 Button [2.1.1 - Bloemfontein clients]

Display all details of clients who live in Bloemfontein from the


tblClients table, sorted according to the ClientSurname field.

Example of output:

(4)

Page 26 of
106
LESSON PLAN

2.1.2 Button [2.1.2 - First month]

Display the CollectionID, CollectionDate and NumberOfCans


of collections made in January.

Example of output of the first five records:

(3)

2.1.3 Button [2.1.3 - Search]

Code has been provided to enter a letter using an input box.


The letter is saved in a variable called sLetter. Display ALL
details of clients whose ClientID starts with the letter entered.

Example of output if the letter J was entered:

(4)

2.1.4 Button [2.1.4 – Clients' earnings]


Clients will receive R8,00 for each kilogram of cans
collected. The company uses the formula: 1 kilogram =
76 cans.

Calculate and display the total amount that each client will
receive for the cans they have collected, formatted to currency.
Display the ClientName field and the total amount to receive,
using the field name Total Amount.

Example of output of the first five records:

(8)

Page 27 of
106
LESSON PLAN

2.1.5 Button [2.1.5 - Update]

The details of a specific collection of cans were captured incorrectly.

Modify the details of record C003 in the tblCanCollection


table as follows:
 NumberOfCans: 250
 A payment was not made

Code has been provided to display a message that indicates that a


record has been changed in the database. (4)

2.2 Tab sheet [Question 2.2 - Delphi

code] NOTE:
 Use ONLY Delphi programming code to answer QUESTION
2.2.1 and QUESTION 2.2.2.
 NO marks will be awarded for SQL statements in QUESTION 2.2.

Example of graphical user interface (GUI) for QUESTION 2.2:

Page 28 of
106
LESSON PLAN

2.2.1 Button [2.2.1 - Insert]

Write code to add a new record to the tblClients table. The


details of the client are as follows:

Client ID: CHA01


Client name: Charles
Client surname: du Boit
Address: 24 Van Wouw
Street City: Cape Town

Example of the first four records of the tblClients table which


shows that the record of the new client has been added
successfully to the table:

(4)

2.2.2 Button [2.2.2 - Percentage]

The company wants to calculate the number of cans collected


by a specific client in a specific year as a percentage of the
total number of cans collected by the company in that specific
year.

The user must do the following:


 Select a client from the DBGrid by clicking on the record.
 Select a year from the radio group rgpQ2_2_2.

Code has been provided to extract the year selected from the
radio group rgpQ2_2_2.

Use the redQ2_2_2 output area to display the information

listed below. Write code to do the following:


 Display the name and surname of the client selected.
 Determine and display the total number of cans collected
by the client for the year selected.
 Determine and display the total number of cans collected
by the Collect-a-Can company for the year selected.
 Calculate which percentage of the total number of cans
collected in the selected year, was collected by the client.
Page 29 of
106
LESSON PLAN
Display the percentage formatted to two decimal places.

Page 30 of
106
LESSON PLAN
Example of output if the client record with ClientID BUS06
and the year 2022 has been selected:

Example of output if the client record with ClientID CHR08


and the year 2021 has been selected:

(13)
TOTAL : 40

DATABASE INFORMATION QUESTION 2 2022:

The database CollectionDB consists of table tblClients and tblCanCollection.

The following one-to-many relationship with referential integrity exists


between the two tables in the database:

The design of the database tables is as

follows: Table: tblClients

This table contains details of the clients.

Field name Data type Description


ClientID Text (5) Unique ID for the client
ClientName Text (15) The name of the client
ClientSurname Text (15) The surname of the client
Address Text (20) The address of the client used for the
pickup of cans
City Text (15) The city where the client resides

Page 31 of
106
LESSON PLAN

Example of the records in the tblClients table:

Table: tblCanCollection

This table contains information of all the collections.


Field name Data type Description
CollectionID Text (5) Unique code for each collection
CollectionDate Date/Time Date of the collection
NumberOfCans Number Integer value that indicates the number
of cans collected
Paid Boolean A Boolean value that indicates that the
client received payment for the cans
collected
ClientID Text (5) The ID of the client who collected the cans

Example of the first ten records in the tblCanCollection table:

Page 32 of
106
LESSON PLAN
3. NOVEMBER 2021 Q2

NOTE: The data pages attached at the end of this question provide
information on the design of the database and its contents.

 Follow the instructions that follow to complete the code for each
section as described in QUESTION 2.1 and QUESTION 2.2.

 TWO variables are declared as public variables as described in the table below.

Variable Data type Description


tblClubs TADOTable Refers to the table tblClubs
tblMembers TADOTable Refers to the table tblMembers

2.1 Tab sheet [Question 2.1 - SQL]

Example of graphical user interface (GUI) for QUESTION 2.1:

Page 33 of
106
LESSON PLAN

NOTE: Code to execute the SQL statements and display the results of the queries is
provided. The SQL statements assigned to the variables sSQL1, sSQL2,
sSQL3, sSQL4 and sSQL5 are incomplete.

Use ONLY SQL code to complete the SQL statements for QUESTION 2.1.1 to
QUESTION 2.1.5 that follow.

2.1.1 Button [2.1.1 - Clubs from Gauteng and SA affiliated]

Display the names and the towns of all clubs in Gauteng


(GP) that are SA affiliated.

Example of output:

(3)

2.1.2 Button [2.1.2 - Birth year]

Display the name, surname and date of birth of all


members who were born in 2002.

Example of output:

NOTE: The date format may differ from the example in the output. (3)

2.1.3 Button [2.1.3 - Display members]

Code has been provided to select a ClubName from the


cmbQ2_1_3 combo box.

Display the surname and name of members from the club


selected in the combo box.

Example of output if Kamma Hiking is selected:

(4)

Page 34 of
106
LESSON PLAN

2.1.4 Button [2.1.4 - Average membership fee]


Display the province and the average membership fee per
province where the average membership fee is more than
R400.

The average membership fee per province must be a


calculated field with the heading AvgFee and it must be
displayed as currency.

Example of output:

(6)

2.1.5 Button [2.1.5 - Change member name]

Write code to change all member names spelled as 'Aiensley'


to 'Ainsley'.

(3)

2.2 Tab sheet [Question 2.2 - Delphi code]

Example of graphical user interface (GUI) for QUESTION 2.2:

Page 35 of
106
LESSON PLAN
NOTE:
 Use ONLY Delphi programming code to answer QUESTION
2.2.1 to QUESTION 2.2.3.
 NO marks will be awarded for SQL statements in QUESTION 2.2.

Page 36 of
106
LESSON PLAN

2.2.1 Button [2.2.1 - Outstanding fees]


Write code to display the club name and annual
membership fee as part of a heading and the surname,
amount paid and outstanding fees for each club member in
the redQ2_2_1 rich edit.
Example of output for the first two clubs:

Boks Hiking, annual fee = R350.00


=====================================
Surname Paid Outstandin
g
Oliver R219.00 R131.00
Pearce R70.00 R280.00
Cape Adventure Hiking, annual fee = R500.00
=====================================

Surname Paid Outstandin


g
Dunn R33.00 R467.00
English R481.00 R19.00
Guzman R334.00 R166.00
Heath R298.00 R202.00
Hubbard R326.00 R174.00
Ward R235.00 R265.00 (12)
2.2.2 Button [2.2.2 - Update hikes completed]
Select a member from the tblMembers table in the dbgrid (dbgrdMany)
who completed another hike.
Write code to increment the HikesCompleted field, by one
for the member selected in the dbgrid. (4)

2.2.3 Button [2.2.3 - Add member]


Only the following clubs allow new member to join:
Mountain Free
Boks Hiking
Printfoot Hiking
The IDs and names of these clubs are listed in the
rgpQ2_2_3 component in the following format: <ClubID>.
<ClubName> with the caption 'Clubname'.
Code has been provided to assign the surname, name, date
of birth and membership code of a new member to
variables.
NOTE: To add a new member, the user must first select a
club name from the rgpQ2_2_3 radio group.
Write code to do the following:
 Extract the ClubID from the club selected in the rgpQ2_2_3
radio group.
 Assign the provided variables to the corresponding
member fields and the ClubID to the ClubID member
field.
Page 37 of
106
LESSON PLAN
 Add the required statement(s) to ensure that the new
member's details are saved in the database table.
(5)
TOTAL : 40

Page 38 of
106
LESSON PLAN

DATABASE INFORMATION QUESTION 2 2021:

The design of the database tables is as follows:

Table: tblClubs

The table contains the information of hiking clubs in different provinces.

Field name Data type Description


ClubID (PK) Number A unique number assigned to the club
ClubName Text (20) The name of the hiking club
ClubTown Text (25) The town where the club is situated
Province Text (20) The province where the club is situated
SA_Affiliated Boolean Boolean field indicating whether the
hiking club is affiliated with the SA hiking
club or not
MemFee Currency Annual membership fee

Example of the first ten records in the tblClubs table:

Table: tblMembers

This table contains the information of members in different hiking clubs.


Field name Data type Description
MemberCode Text (7) A unique code assigned to each member
(PK)
MemberSurname Text (20) The surname of the member
MemberName Text (20) The name of the member
BirthDate Date/Time The birthday of the member
HikesCompleted Number The total number of hikes completed
by the member
AmountPaid Currency The amount paid by the member
towards the membership fee
ClubID (FK) Number A number that connects the member to
the club where the member is registered
Page 39 of
106
LESSON PLAN

Example of the first ten records in the tblMembers table:

The following one-to-many relationship with referential integrity exists


between the two tables in the database:

Page 40 of
106
LESSON PLAN

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy