You are on page 1of 9

Crawford College

La Lucia
INFORMATION TECHNOLOGY
Grade 11
Paper 02: Practical

FINAL EXAMINATIONS - 2020

Duration: 2 Hours Marks: 100 Date: 03 November 2020

Examiner : S. Govender
Moderator : A.J. Pillay

This paper consists of 4 questions and 9 pages including this page.

PLEASE NOTE THE FOLLOWING:

1) Ensure that you are writing the correct exam paper, and that there are no missing pages.

2) Create a Folder on the Network drive of the account you have been logged into.
Ensure that the name of your folder is your FULL Name.

3) Use this folder to save ALL your work in and nowhere else on the PC Hard drive.

4) Save your work as per the question’s requirements.

5) Save your work every 5 minutes to prevent loss of work in case of a power failure/disruption.

6) Answer all questions.

7) At the end of the session, you are required to make printouts of ALL your efforts.

8) Alert the invigilator immediately if you have hardware or software related problems with the PC that
was allocated to you. Do not waste time by trying to resolve the issue by yourself.

9) Your programs must be coded in such a way that they will work with any data and not just the sample
data supplied or any data extracts that appear in the question paper. You are advised to look at the
supplied data files carefully.

10) Make sure that routines such as searches, sorts and selections are developed from first principles, and
that you do not use the built-in features of a programming language for any of these routines.

SUGGESTED TIME REQUIRED TO ANSWER THIS QUESTION PAPER


Question Aspect Marks Time in Minutes
1 STRUCTURED QUERY LANGUAGE 30 40
2 OBJECT ORIENTATED PROGRAMMING 16 15
3 OBJECT ORIENTATED PROGRAMMING 48 55
4 OBJECT ORIENTATED PROGRAMMING 6 10

Page 1 of 9 IT11 - P02: Final Exam 2020


SCENARIO:

Sweets4Africa is a South African based company in the heart of KZN. It is an emerging


wholesaler of sweets and chocolates. The company is steadily growing and over the recent
years, there has been a demand for the company to supply a few of the neighbouring African
countries with their products. The company has realised that it has to improve its data
collection and processing requirements in order to provide a quality service so as to build a
reliable reputation.

SECTION A: STRUCTURED QUERY LANGUAGE

The company has a database called Sweets4Africa.mdb that is used to maintain its stock.

The database contains two tables, Stock and Suppliers. The Stock table contains details of
all stock items being sold. The Suppliers table contains the details of the various suppliers of
for stock items. One Stock item can only be supplied by one Supplier, but a supplier can
supply more than one stock item.

The design and sample content of these tables are described below:

Stock:

Field Name Data Type Size/Format Description


StockID AutoNumber Long Integer Unique ID for each stock item
StockName Short Text 70 Name and description of stock item
CostPrice Currency 2 Decimal Places Cost Price of the stock item
MarkUp Number Double Mark Up on Cost Price for
Quantity Number Integer Quantity of stock item on hand
ReOrderLevel Number Integer Quantity Indicator for ordering
SupplierID Number Long Integer ID for supplier of stock

StockID StockName CostPrice MarkUp Quantity ReOrderLevel SupplierID


1 Candy Basket Sours (1 X 72's) 21.50 0.14 400 60 5
2 Candy Basket Apricots (1 x 72's) 21.50 0.14 951 73 5
3 Candy Basket Funny Faces (1 x 72's) 21.50 0.14 638 56 5
4 Dual Magic (24 x 75g) 152.06 0.155 390 65 2
5 Enerjelly Babies (24 x 75g) 152.06 0.155 652 92 3
6 Enerjelly Jubes (24 x 75g) 152.06 0.155 806 94 3
7 Enerjelly Sour Babies (24 x 75g) 152.06 0.155 827 75 3
8 Enerjelly Teddies (24 x 75g) 152.06 0.155 607 98 3
9 Fizz Pops Lollipops Apple (1 x 40's) 40.63 0.17 535 59 1
10 Fizz Pops Lollipops Apple (12 x 40'S) 487.57 0.123 763 94 1

Page 2 of 9 IT11 - P02: Final Exam 2020


Suppliers:

Field Name Data Type Size/Format Description


SupplierID AutoNumber Long Integer Unique ID for each supplier
SupplierName Short Text 30 Name of each supplier
Address Short Text 60 Physical address of supplier
ContactPerson Short Text 20 Firstname & Surname of contact person
ContactNumber Short Text 10 Number to contact with

SupplierID SupplierName Address ContactPerson ContactNumber


1 Beacon 1 Beacon Drive, Durban Ben Smith 0310001212
2 MisterSweet 5 Sweet Lane, Cape Town Candace Pillay 0210003232
3 Sally Williams 3 Nougat Place, Pretoria Jeff Golding 0120004545

You are required to extract some useful information from the database as well as make
required changes to assist Sweets4Africa to analyse data from the database.

QUESTION 1

1.1 Write a query that will list the StockName and CostPrice for all stock, sorted in
ascending order of cost price. (3)

1.2 Stock ID 70 is no longer being manufactured.


Write a query that will remove this stock item from the table. (2)

1.3 Write a query that will list the StockName and Quantity of all stock that contains
“mint” anywhere in the name of the stock.

The correct output is given below:

StockName Quantity
Mint Imperials (1 x 200g) 517
Mint Imperials (24 x 75g) 990
Smoothies Mint (1 x 72’s) 700
Smoothies Supa Mint (1 x 50’s) 162 (3)

1.4 Items of stock with large quantities on hand, usually mean that they are not selling
well. The value for each item of stock is determined by multiplying the item’s cost
price with its quantity on hand. Write a query that will determine the total value of
ALL items of stock where items of stock have a quantity of 500 or more. (4)

1.5 Some stock items have not been allocated a supplier. Write a query to change the
supplier to Beacon (Supplier ID 1), for all these stock items. (5)

Page 3 of 9 IT11 - P02: Final Exam 2020


1.6 Write a query that will list MarkUp and Num of Stock (a calculated field with the
number of stock items that have the same mark-up value), for all stock items where
Num of Stock is greater than 7.

The correct output is given below:

MarkUp Num of Stock


0.11 9
0.12 14
0.15 8
0.155 14
0.17 9 (6)

1.7 Write a query that will list SupplierName and Avg (a calculated field of the average
cost price of all items supplied by the supplier, to TWO decimal places), in
descending order of Avg. (7)

[30]

Page 4 of 9 IT11 - P02: Final Exam 2020


SECTION B: OBJECT ORIENTATED PROGRAMMING

Sweets4Africa is looking at creating a Point of Sale (POS) system to meet the demands
of growing sales and to ensure better record keeping. They are currently looking to hire
a software development company to create the POS for them, using the agile module
approach.

As part of the tendering process, companies were asked to provide a pseudo


application to demonstrate their skills and expertise.

This application will keep track of items sold during each sale and provide statistical
information for analysis.

You have been asked to create this pseudo application.

For each Item sold, the following data will be required:


• Sale ID
• Stock Name
• Cost Price
• Mark Up Percentage
• Quantity

You have been given a text file named “Sales.txt” which contains data about the sales
and items sold in the order of the sales made. A sample of the first 6 lines of the file is
given below:

1#Mallows Pink & White (1 x 150g)#11.84#0.12#5


1#Jelly Tots Alphabet (1 x 100g)#12.14#0.13#7
2#Smoothies Menthol (1 x 72's)#11.84#0.12#6
2#Mallows Fish (1 x 150g)#12.14#0.13#7
2#Mallows Twisters (1 x 150g)#12.14#0.13#3

Sale ID#Stock Name#Cost Price#Mark Up Percentage#Quantity

Create a Java application called Sweets4Africa. Please ensure that you insert the
question numbers as comments in your code, before answering the questions.

Page 5 of 9 IT11 - P02: Final Exam 2020


QUESTION 2

Use the class diagram below to create a new class called ItemSold. The
diagram below indicates the properties/fields and methods that are required.

ItemSold
Properties:
‒ salesID : integer
‒ stockName : string
‒ costPrice : double
‒ markUpPerc : double
‒ qty : integer
Methods:
+ Constructor(inSID : integer , inSN : string, inCP : double, inMUP : double ,
inQty : integer)
+ getSalesID : integer
+ getStockName() : string
+ getQty() : integer
‒ getItemPrice() : double
+ getItemTotal() : double
+ toString() : string

2.1 Write code to create a new class called ItemSold. (1)

2.2 Write code to create the properties for the ItemSold class as indicated in the class
diagram. (3)

2.3 Write code to create the constructor method as indicated in the class diagram. (3)

2.4 Write code to create the accessor methods getSalesID, getStockName and
getQty. (1)

2.5 Write code to create the method getItemPrice that determines and returns the
price of the item.

Price = Cost Price × (1 + Mark Up Percentage) (3)

2.6 Write code to create the method getItemTotal that determines and returns the
sales total for the item: Item Price × Quantity (2)

2.7 Write code to create the method toString that will return the details of an item on
one line, in a columnar format as follows, with the Item Total formatted to TWO
decimal places:

stockName<tab><tab>qty<tab><tab>ItemTotal (3)

[16]

Page 6 of 9 IT11 - P02: Final Exam 2020


QUESTION 3

Use the class diagram below to create a new class called ItemsSoldManager.
The diagram below indicates the properties/fields and methods that are
required.

ItemSoldManager
Properties:
‒ arrItemsSold []: ItemSold [100]
‒ counter : integer
Methods:
+ Constructor(filename : string)
‒ sortItems()
+ displayItems() : string
+ mostQty() : string
+ saleTotals() : string

3.1 Write code to create a new class called ItemsSoldManager. (1)

3.2 Write code to create the class variables as indicated in the class diagram:

3.2.1 arrItemsSold, an array that can be used to store up to 100 ItemSold


objects (2)

3.2.2 counter, an integer variable to keep track of how many sold items are
stored in the array (1)

3.3 Write code to create the constructor that:

• accepts a String as a parameter that represents the name of the text file to be
read from

• displays an error message if the text file does not exist

• runs through the text file and reads data from each line in order to create
ItemSold objects for the array (13)

3.4 Write code to create the method sortItems that will sort the sold items in the array
in ascending order of the stock name. (10)

3.5 Write code to create a method displayItems that will display the sorted items sold,
with suitable headings. (6)

3.6 Write code to create a method mostQty that will determine and return the name of
the stock that had the highest quantity, for any sale. (7)

Page 7 of 9 IT11 - P02: Final Exam 2020


3.7 Write code to create the method saleTotals that will determine and return the total
for each sale formatted to TWO decimal places, with suitable headings. The sale
ID is indicative of which sale the item sold, belongs to. Assume that this method is
only called when the data in the array is in the order of the text file. Marks will be
awarded for efficiency of code.

saleID<tab><tab>total

Sample Return:

SalesID Total
1 162.33
2 216.75
.
.
. (8)

[48]

QUESTION 4

4.1 Write code to create a simple user interface called ItemsSoldUI that will allow
simple output. (1)

4.2 Write code to declare and instantiate an ItemsSoldManager object at an


appropriate place in the code. Use ‘sales.txt’ for the filename argument. (2)

4.3 Write code to call the salesTotal method to display the totals of each sale.

Sample Output:

SalesID Total
1 162.33
2 216.75
3 88.81
.
.
. (1)

4.4 Write code to call the displayItems method to display the items sold.

Sample Output:

Stock Name Quantity Total


Jelly Tots Alphabet (1 x 100g) 7 96.03
Jelly Tots Alphabet (1 x 100g) 7 96.03
Jelly Tots Alphabet (1 x 100g) 2 27.44
.
.
. (1)

Page 8 of 9 IT11 - P02: Final Exam 2020


4.5 Write code to call the mostQty method to display the name of the stock that had the
highest quantity, for any sale.

Sample Output:

Jelly Tots Craziberries (1 x 100g) had the most quantity on a


sale. (1)

[6]

TOTAL: 100

Page 9 of 9 IT11 - P02: Final Exam 2020

You might also like