IT March 2013 Paper 1
IT March 2013 Paper 1
SENIOR CERTIFICATE
GRADE 12
INFORMATION TECHNOLOGY P1
FEBRUARY/MARCH 2013
MARKS: 120
TIME: 3 hours
1. The duration of this examination is three hours. Because of the nature of this
examination it is important to note that you will not be permitted to leave the
examination room before the end of the examination session.
3. You require the files listed below in order to answer the questions. They are
EITHER on a stiffy disk OR CD issued to you OR the invigilator/teacher will
tell you where to find them on the hard drive of the workstation you are using
OR in a network folder.
Question1_Delphi: Question1_Java:
Question1P.dpr tblTourists.txt
Question1P.res tblTours.txt
Question1U.dfm TestQuestion1.java
Question1U.pas Tourism.java
tblTourists.txt TourismDB.mdb
tblTours.txt
TourismDB.mdb
Question2_Delphi: Question2_Java:
DataQ2.txt DataQ2.txt
Question2P.dpr Quest2.java
Question2P.res TestQuestion2.java
Question2U.dfm
Question2U.pas
uQuest2.pas
Question3_Delphi: Question3_Java:
DataQ3_Delphi.txt DataQ3_Java.txt
If you received the files above on a disk (CD or stiffy), write your examination
number on the label.
4. Type your examination number as a comment in the first line of each program
file that contains your programming code.
5. Your program should always be coded to answer the question in the way it
has been formulated. You are not allowed to only copy the given output
supplied in the question paper.
6. Read ALL the questions carefully. Do not do more than the questions require.
7. To help you to understand each question better, you have to read the entire
question before answering any subquestions.
9. There might be a technical interruption that prevents you from writing the
examination, such as a power failure. When you resume writing the
examination, you will be given the time remaining when the interruption
began, and an additional 10 minutes.
10. During the examination, you may use the manuals originally supplied with the
hardware and software. You may also use the HELP functions of the
software. Candidates using Java may use the Java API files. You may NOT
use any other resource material.
11. At the end of this examination session, you must hand in the disk or CD with
all your work saved on it OR you must make sure that all your work has been
saved on the hard drive/network as explained to you by the invigilator/teacher.
Ensure that all files can be read.
12. Make printouts of the programming codes of all the programming questions
you have done.
13. All printing of programming questions that you have done will take place
within an hour of the completion of this examination.
SCENARIO
Blue Crane Tours is a company offering sightseeing tours of South Africa to overseas
visitors. The company wants to improve their business; therefore they require new
software to assist them with their administration. You are required to complete the
following THREE questions using the programming language you have studied.
The design of the tables in the TourismDB database and sample data from each table
are given in ANNEXURE A.
Do the following:
• Make a backup copy of the TourismDB database BEFORE you start answering
the questions. You will need a copy of the original database to be able to test your
program thoroughly.
• Rename the folder for QUESTION 1 by replacing the name of the programming
language you have studied with your examination number.
• Enter your examination number as a comment in the first line of the program file.
• Compile and execute the program. The interface displays eight menu options as
indicated in the section labelled QUESTION 1 in ANNEXURE B
(Delphi)/ANNEXURE C (Java).
NOTE:
o An error message will be displayed if any of the options A–G are selected
because of the incomplete SQL statements.
• Complete the code for each menu option by formulating an appropriate SQL
statement to display the respective query results as described in
QUESTIONS 1.1 to 1.7 below.
NOTE: The code to some input statements and the code to execute the SQL
statements and display the results of the queries have already been
written as part of the given code.
Display all the information of the tours in the tblTours table. Sort the data by
the destination in alphabetical order and then by the starting date of the tour
in descending order.
NOTE: The format of the dates in the StartDate and EndDate fields and the
format of the Price field may differ from the example above. (4)
A lost suitcase that probably belongs to a female tourist was found. The
suitcase has the letters CC engraved on it which may refer to the initials of the
tourist's first name and surname. Display the TourID, the FirstName and
Surname of all the female tourists, whose first names and surnames start
with a C.
Allow the user to enter the name of a country, for example Spain. Display the
TourID and the Surname of all the tourists from that country who have paid
their deposit.
Example of the output of the first four tourists from Spain (on the next page):
TourID Surname
19 Spina
4 Di
34 Mancuso
43 Ghislieri
: (4)
Display a list of all the tour guides who guided tours that exceeded a period of
5 days during the period 12 June 2012 to 31 October 2012. Display the
surname of the tour guide, the starting date, the end date and the duration of
the tour (number of days). The number of days has to be calculated. Use
NumberOfDays as the heading of the calculated field.
NOTE: The format of the dates in the StartDate and EndDate fields and the
format of the NumberOfDays field may differ from the example
above. (6)
All the records of tours that began and ended during the year 2011 need to be
removed from the database.
Once the records have been removed successfully, a suitable message will
be displayed. (4)
Calculate and display the total amount the company has received in payment
from tourists according to their countries of origin. Name the calculated field
IncomePerCountry. The amounts must be formatted in currency value.
Country IncomePerCountry
France R 179 572.44
Germany R 148 711.20
Spain R 198 068.70
United Kingdom R 159 085.56
United States of America R 169 319.72
NOTE: The format of the IncomePerCountry field may differ from the
example above. (5)
Display the destination, start date, seats available and the number of seats
booked on all the tours that were NOT fully booked. A tour is NOT fully
booked when the number of tourists who booked the tour is not equal to the
number of seats available. Calculate and show the number of seats that were
booked per tour. Name the calculated field SeatsBooked.
NOTE: The format of the date in the StartDate field may differ from the
example above. (7)
NOTE: If you want to test the menu options at this stage, use your backup copy of the
TourismDB database.
• Enter your examination number as a comment in the first line of the file containing
the SQL statements.
• Save your program.
• A printout for the code will be required. [34]
Blue Crane Tours offers different tour packages to various destinations around South
Africa. The prices of the tours depend on the time of year the tours take place. As part
of a marketing campaign, the company offers 10% discount on tours, depending on the
number of tour members. Each client is also entered into a lucky draw and may be
eligible for 25% discount based on the outcome of the lucky draw.
The files required for this question can be found in the folder named Question2_XXXX
where XXXX refers to the programming language you have studied. You have been
provided with a text file named DataQ2.txt and an incomplete program that consists of:
• A class unit (Delphi)/object class (Java) which describes the attributes of a tour
and contains some methods
• A main form unit (Delphi)/test class (Java)
The text file contains data on an unknown number of tours offered by Blue Crane
Tours. The details of each tour are stored using two lines of text in the file in the
following format:
Example of the data of the first three tours in the text file DataQ2.txt:
Do the following:
• Rename the folder for QUESTION 2 by replacing the name of the programming
language you have studied with your examination number.
o Delphi programmers:
Open the incomplete program file Question2P.dpr.
Add your examination number as a comment in the first line of both the
class unit (uQuest2) and the main form unit (Question2U) files.
o Java programmers:
Open the given incomplete object class Quest2 and the test class
TestQuestion2.
Add your examination number as a comment in the first line of both the
object class (Quest2) and the test class (TestQuestion2).
• Compile and execute the program. The interface displays two menu options as
indicated in the section labelled QUESTION 2 in ANNEXURE B (Delphi)/
ANNEXURE C (Java).
2.1 Do the following to complete the code in the class unit (Delphi)/object
class (Java):
The uQuest2 unit (Delphi)/Quest2 class (Java) contains the declaration of six
attributes for a tour object and the get (accessor) methods for these attributes.
Names of Attributes
Description
Delphi Java
Surname and initial of the tour guide fGName gName
Destination of the tour fDName dName
Month when the tour takes place fMName mName
Duration of the tour (number of days) fNumD numD
Number of tour members fNumT numT
Tariff per day fTariff tariff
Months Tariff
April, September, December R 1 250.00
January, February, August, R 1 000.00
October, November
March, May, June, July R 900.00 (6)
2.1.3 Write code for a method called shortenString to shorten the name
of a month by removing the vowels (a, e, i, o, u) from the name.
The first character of the month name must not be removed even if
it is a vowel. The shortened string should be returned.
Examples of some of the shortened strings:
August will be returned as Agst
September will be returned as Sptmbr (5)
2.1.4 Write code for a method called findLuckyChar that will return an
alphabetic character that is randomly selected from a destination's
name. A space is not regarded as a lucky character. Both
uppercase and lowercase characters are acceptable as lucky
characters. (5)
2.1.5 Write code for a toString method that will construct and return a
string with labels and information about a tour object in the following
format:
2.2 Do the following to complete the code in the main form unit (Delphi)/test
class (Java):
If the text file exists, write code to read lines of text from the text
file, extract the data, create a tour object and assign the object to
the array.
• Allow the user to enter the name of the month in which he/she
wants to go on tour. Display a numbered list of the destinations
of all the tours taking place during the month that was entered
by the user.
• Make sure that your examination number is entered as a comment in the first line of
the class unit (Delphi)/object class (Java) as well as the main form unit (Delphi)/test
class (Java).
• Save all the files.
• A printout of the code will be required.
• Print both the class unit (Delphi)/object class (Java) and the main form unit
(Delphi)/test class (Java). [54]
Blue Crane Tours needs statistics on the amount of foreign currency brought into the
country by a number of tourists from various countries visiting South Africa. They also
need to run a popularity test on some of the tours they offer.
The text file contains the declaration of an array named arrData. The array contains
40 strings with data on tourists who visited South Africa recently.
The data for each tourist in the array is in the following format:
NOTE: The white space in the above text box is there only to facilitate reading.
The data captured in the first two strings can be interpreted as follows:
• Rachel Delarosa from Canada took a tour to Shakaland. She spent a total amount
of 11 861 Canadian dollars.
• Corradino Grande from Spain took a tour to Robben Island. He spent a total
amount of 5 788 euros.
The following five tour destinations are reflected in the data captured in the arrData
array:
• Cape Winelands, represented as CA
• Garden Route, represented as GA
• Kruger National Park, represented as KR
• Robben Island, represented as RO
• Shakaland, represented as SH
Do the following:
• Rename the folder for QUESTION 3 by replacing the name of the programming
language you have studied with your examination number.
• Enter your examination number as a comment in the first line of the program file
you have created that will contain your code.
Java programmers:
If your solution consists of more than one class file, make sure to enter your
examination number as a comment in ALL the class files.
• Save the program files using the question number as part of the filename in the
renamed folder for QUESTION 3.
Copy the code for displaying a menu as indicated in the section labelled
QUESTION 3 in ANNEXURE C from the DataQ3_Java text file.
• Copy the text for the declaration of the array which is supplied in the text file to
your program file.
• Complete the code for each menu option as follows (on the next page):
NOTE: You have to test your program by running the menu options in sequence, that
is option A, then option B and finally option C.
Data captured in the arrData array shows that tourists from France, Germany
and Spain enter the country with their holiday money in euros as currency.
Write code to convert the total amount of euros the tourists from France,
Germany and Spain brought into the country into South African rand. Use the
exchange rate: 1 euro = R10,75. Display the total amount of holiday money in
both currencies with suitable labels.
NOTE: The format of the currency values may differ from the example
above. (8)
The touring company realised that many of the tourists visiting Robben Island
are not English-speaking. They decided to divide the tourists taking tours to
Robben Island into two groups: an English-speaking group and a non-
English-speaking group.
The data in the arrData array needs to be adjusted so that it shows the two
groups of tourists.
Write code to modify the data of tourists who visit Robben Island in the
arrData array by changing the code for Robben Island (RO) in the array to
ROEnglish or ROOther respectively.
Display a list of all the English-speaking tourists who took the tour to Robben
Island.
• One star represents a group of three tourists who took the tour.
• No star is awarded if fewer than three tourists took the tour.
Example:
• If five tourists take a tour, the rating of the tour will be one star.
• If six tourists take a tour, the rating of the tour will be two stars.
Display a list of all the tours, their star ratings and the actual number of
tourists who took each tour (displayed between brackets).
HINT: Remember that the Robben Island tour was divided into two different
tours, based on language (see QUESTION 3.2).
• Make sure your examination number is entered as a comment in the first line of the
program.
• Save all the files.
• A printout for the code will be required. [32]
TOTAL: 120
This annexure shows the database structure and sample data for the tables contained in the TourismDB database used in QUESTION 1.
tblTourists: This table contains data on tourists visiting South Africa who are taking tours arranged by Blue Crane Tours.
Table structure:
Sample data:
Copyright reserved
Information Technology/P1 DBE/Feb.–Mar. 2013
NSC
tblTours: This table contains data on tours provided by Blue Crane Tours for the past two years.
Table structure:
Sample data:
Copyright reserved
Information Technology/P1 DBE/Feb.–Mar. 2013
NSC
QUESTION 1
When you execute the program, the interface below will be displayed.
QUESTION 2
When you execute the program, the interface below will be displayed.
QUESTION 3
You are required to create the following interface as part of the solution for
QUESTION 3. When you execute the program, the interface below must be displayed.
Copyright reserved
Information Technology/P1 DBE/Feb.–Mar. 2013
NSC
QUESTION 1
When you execute the program, the interface below will be displayed.
QUESTION 2
When you execute the program, the interface below will be displayed.
QUESTION 3
Copy and use the code from the DataQ3_Java text file to create the following interface
as part of the solution for QUESTION 3. When you execute the program, the interface
below must be displayed.
Copyright reserved
Information Technology/P1 DBE/Feb.–Mar. 2013
NSC
• Create your own database with the name TourismDB that includes a
table named tblTours and another table named tblTourists in the same
folder as your program for QUESTION 1.
• Import the two text files (tblTours.txt and tblTourists.txt) to use as data
for the different tables.
• The first line in the text files contains the field names to be used.
• Make sure that the database TourismDB is in the same folder as your
program for QUESTION 1. If this is not the case, copy the database file
into the same folder as your program.
D.3 If your program establishes connectivity with the database but no data is
displayed:
Copyright reserved
Information Technology/P1 DBE/Feb.–Mar. 2013
NSC
• Create your own database with the name TourismDB that includes a
table named tblTours and a table named tblTourists in the same folder
as your program for QUESTION 1.
• Import the two text files (tblTours.txt and tblTourists.txt) to use as data
for the different tables.
• The first line in the text files contains the field names to be used.
• Make sure that the database TourismDB is in the same folder as your
program for QUESTION 1. If this is not the case, copy the database file
into the same folder as your program.
E.3 If you cannot establish connectivity with the database with the given files, use
the following source code to ensure database connectivity:
try
{
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
String filename = "TourismDB.mdb";
String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
database += filename.trim () + ";DriverID=22;READONLY=true}";
Connection conn = DriverManager.getConnection (database, "", "");
}
catch (Exception e)
{
System.out.println ("Unable to connect to the database");
}
Copyright reserved