Download as pdf or txt
Download as pdf or txt
You are on page 1of 111

Higher Nationals

Internal verification of assessment decisions – BTEC (RQF)


INTERNAL VERIFICATION – ASSESSMENT DECISIONS

Program title HND in Computing (Software Engineering)

Assessor Mr. Nuhman Internal Verifier Mr. J. Piragarthejan

Unit(s) Unit 01 - Programming

Assignment title Develop a system for Ayubo rent a car company

Student’s name Miss. Tharshana Thevaraj


List which assessment criteria Pass Merit Distinction
the Assessor has awarded.

INTERNAL VERIFIER CHECKLIST

Do the assessment criteria awarded match


those shown in the assignment brief? Y/N

Is the Pass/Merit/Distinction grade awarded


justified by the assessor’s comments on the Y/N
student work?
Has the work been assessed
Y/N
accurately?
Is the feedback to the student:
Give details:
• Constructive?
• Linked to relevant assessment criteria? Y/N
• Identifying opportunities for Y/N
improved performance? Y/N
• Agreeing actions? Y/N
Does the assessment decision need
Y/N
amending?

Assessor signature Date

Internal Verifier signature Date


Programme Leader signature (if required)
Date

Miss. Tharshana Thevaraj Unit 01 Programming Page 1


BAT/A-005817
Confirm action completed
Remedial action taken

Give details:

Assessor signature Date

Internal Verifier
Date
signature
Programme Leader
Date
signature (if required)

Miss. Tharshana Thevaraj Unit 01 Programming Page 2


BAT/A-005817
Higher Nationals - Summative Assignment Feedback Form
Student Name/ID Miss. Tharshana Thevaraj (BAT/A -005817)
Unit Title Unit 01 - Programming
Assignment Number 1 Assessor Mr. Nuhman
Date Received 1st
Submission Date
submission
Date Received 2nd
Re-submission Date
submission
Assessor Feedback:

LO1. Define basic algorithms to carry out an operation and outline the process of programming an application.

Pass, Merit & Distinction Descripts P1 M1 D1

LO2. Explain the characteristics of procedural, object-orientated and event-driven programming, conduct an analysis of a suita
Integrated Development Environment (IDE).

Pass, Merit & Distinction Descripts P2 M2 D2

LO3. Implement basic algorithms in code using an IDE.

Pass, Merit & Distinction Descripts P3 M3 D3

LO4. Determine the debugging process and explain the importance of a coding standard.
Pass, Merit & Distinction Descripts P4 P5 M4 D4

Grade: Assessor Signature: Date:


Resubmission Feedback:

Grade: Assessor Signature: Date:

Internal Verifier’s Comments:

Signature & Date:

* Please note that grade decisions are provisional. They are only confirmed once internal and external moderation has taken place and
grades decisions have been agreed at the assessment board.

Assignment Feedback

Miss. Tharshana Thevaraj Unit 01 Programming Page 3


BAT/A-005817
Formative Feedback: Assessor to Student

Action Plan

Summative feedback

Feedback: Student to Assessor


Mr. Nuhman is my lecturer for the Programming unit. His lecturing method is very well. He
handled many new methods to lecture us and he supported us to finish our task on time. Not
only that but also, he encouraged us to do our best.

Assessor Date
signature
tharshanat01@gmail.com 10/ 08/ 2020
Student Date
signature

Miss. Tharshana Thevaraj Unit 01 Programming Page 4


BAT/A-005817
Pearson Higher Nationals in
Computing
Unit 01: Programming
Assignment 01

Miss. Tharshana Thevaraj Unit 01 Programming Page 5


BAT/A-005817
General Guidelines
1. A Cover page or title page – You should always attach a title page to your assignment. Use
previous page as your cover sheet and be sure to fill the details correctly.
2. This entire brief should be attached in first before you start answering.
3. All the assignments should prepare using word processing software.
4. All the assignments should print in A4 sized paper, and make sure to only use one side printing.
5. Allow 1” margin on each side of the paper. But on the left side you will need to leave room for
binging.

Word Processing Rules


1. Use a font type that will make easy for your examiner to read. The font size should be 12 point,
and should be in the style of Time New Roman.
2. Use 1.5 line word-processing. Left justify all paragraphs.
3. Ensure that all headings are consistent in terms of size and font style.
4. Use footer function on the word processor to insert Your Name, Subject, Assignment No,
and Page Number on each page. This is useful if individual sheets become detached for any
reason.
5. Use word processing application spell check and grammar check function to help edit your
assignment.

Important Points:
1. Check carefully the hand in date and the instructions given with the assignment. Late
submissions will not be accepted.
2. Ensure that you give yourself enough time to complete the assignment by the due date.
3. Don’t leave things such as printing to the last minute – excuses of this nature will not be
accepted for failure to hand in the work on time.
4. You must take responsibility for managing your own time effectively.
5. If you are unable to hand in your assignment on time and have valid reasons such as illness,
you may apply (in writing) for an extension.
6. Failure to achieve at least a PASS grade will result in a REFERRAL grade being given.
7. Non-submission of work without valid reasons will lead to an automatic REFERRAL. You will
then be asked to complete an alternative assignment.
8. Take great care that if you use other people’s work or ideas in your assignment, you properly
reference them, using the HARVARD referencing system, in you text and any bibliography,
otherwise you may be guilty of plagiarism.
9. If you are caught plagiarising you could have your grade reduced to A REFERRAL or at worst
you could be excluded from the course.

Miss. Tharshana Thevaraj Unit 01 Programming Page 6


BAT/A-005817
Student Declaration

I hereby, declare that I know what plagiarism entails, namely to use another’s work and to present
it as my own without attributing the sources in the correct way. I further understand what it means
to copy another’s work.

1. I know that plagiarism is a punishable offence because it constitutes theft.


2. I understand the plagiarism and copying policy of the Edexcel UK.
3. I know what the consequences will be if I plagiaries or copy another’s work in any of the
assignments for this program.
4. I declare therefore that all work presented by me for every aspects of my program, will be my
own, and where I have made use of another’s work, I will attribute the source in the correct
way.
5. I acknowledge that the attachment of this document signed or not, constitutes a binding
agreement between myself and Edexcel UK.
6. I understand that my assignment will not be considered as submitted if this document is not
attached to the attached.

Student’s Signature: Date:


tharshanat01@gmail.com 10/08/2020

Miss. Tharshana Thevaraj Unit 01 Programming Page 7


BAT/A-005817
Higher National Diploma in Computing
Assignment Brief
Student Name /ID Number Miss. Tharshana Thevaraj (BAT/A -005817)

Unit Number and Title Unit 01: Programming

Academic Year 2020/22

Unit Tutor ESOFT Metro Campus Batticaloa

Assignment Title Design & Implement a GUI based system using a suitable
Integrated Development Environment

Issue Date 19/03/2020

Submission Date 10/08/2020

IV Name & Date

Submission Format

This submission will have 3 components

1. Written Report

This submission is in the form of an individual written report. This should be written in a concise, formal
business style using single spacing and font size 12. You are required to make use of headings, paragraphs
and subsections as appropriate, and all work must be supported with research and referenced using the
Harvard referencing system. Please also provide a bibliography using the Harvard referencing system. (The
recommended word count is 1,500–2,000 words for the report excluding annexures)

2. Implemented System (Software)


The student should submit a GUI based system developed using an IDE. The system should connect with a
backend database and should have at least 5 different forms and suitable functionality including insert, edit
and delete of main entities and transaction processing.

3. Presentation
With the submitted system student should do a presentation to demonstrate the system that was
developed. Time allocated is 10 to 15 min. Student may use 5 to 10 PowerPoint slides while doing the
presentation, but live demonstration of the system is required. Evaluator will also check the ability to modify
and debug the system using the IDE.

Unit Learning Outcomes:

LO1. Define basic algorithms to carry out an operation and outline the process of
programming an application.

Miss. Tharshana Thevaraj Unit 01 Programming Page 8


BAT/A-005817
LO2. Explain the characteristics of procedural, object-orientated and event-driven
programming, conduct an analysis of a suitable Integrated Development
Environment (IDE).

LO3. Implement basic algorithms in code using an IDE.

LO4. Determine the debugging process and explain the importance of a coding
standard

Miss. Tharshana Thevaraj Unit 01 Programming Page 9


BAT/A-005817
Assignment Brief and Guidance:

Activity 1

Searching on an array/list is to find a given element on the array and return whether it is found
or not and return its position if found. Linear search and binary search are two popular
searching algorithms on arrays.

1.1 Define what an algorithm is and outline the characteristics of a good algorithm. Develop
algorithms for linear search and binary search using Pseudo code.

1.2 Describe the steps involved in the process of writing and executing a program. Take an
array of 10 or more elements and dry run the above two algorithms. Show the outputs at
the end of each iteration and the final output.

1.3 Define what Big-O notation is and explain its role in evaluating efficiencies of algorithms.
Write the Python program code for the above two algorithms and critically evaluate their
efficiencies using Big-O notation.

Activity 2

2.1 Define what is meant by a Programming Paradigm. Explain the main characteristics of
Procedural, Object oriented and Event-driven paradigms and the relationships among
them.

2.2 Write small snippets of code as example for the above three programming paradigms using
a suitable programming language(s).

2.3 Critically evaluate the code samples that you have above in relation to their structure and
the unique characteristics.

Activity 3 and Activity 4 are based on the following Scenario.

Miss. Tharshana Thevaraj Unit 01 Programming Page 10


BAT/A-005817
Ayubo Drive is the transport arm of Ayubo Leisure (Pvt) Ltd, an emerging travel & tour
company in Sri Lanka. It owns a fleet of vehicles ranging from cars, SUVs to vans.

The vehicles that it owns are hired or rented with or without a driver. The tariffs are based on
the vehicle type. Some of the vehicle types that it operates are, small car, sedan car, SVUs, Jeep
(WD), 7-seater van and Commuter van. New vehicle types are to be added in the future.

Vehicle rent and hire options are described below.

1. Rent (With or without driver) – For each type of vehicle rates are given per day, per week
and per month. Rate for a driver also given per day. Depending on the rent period the total
rent amount needs to be calculated. For example: if a vehicle is rented for 10 days with a
driver, total amount to be calculated as follows:

Total rent = weeklyRent x 1 + dailyRent x 3 + dailyDriverCost x 10

2. Hire (with driver only) – These are based on packages such as airport drop, airport pickup,
100km per day package, 200km per day package etc. Standard rates are defined for a
package type of a vehicle type if that is applicable for that type of vehicle. For each package
maximum km limit and maximum number of hours are also defined. Extra km rate is also
defined which is applicable if they run beyond the allocated km limit for the tour. For day
tours if they exceed max hour limit, a waiting charge is applicable for extra hours. Driver
overnight rate and vehicle night park rate also defined which is applicable for each night
when the vehicle is hired for 2 or more days.

Activity 3

3.1 Design suable algorithms for vehicle tariff calculation for rents and hires.
Ideally 3 functions should be developed for this purpose as follows:

Function 1: Rent calculation.


Return the total rent_value when vehicle_no, rented_date, return_date, with_driver
parameters are sent in. with_driver parameter is set to true or false depending whether the
vehicle is rented with or without driver.

Function 2: Day tour - hire calculation.


Calculate total hire_value when vehicle_no, package_type, start_time, end_time,
start_km_reading, end_km_reading parameters are sent in. Should return base_hire_charge,
waiting_charge and extra_km_charge as output parameters.

Function 3: Long tour - hire calculation.


Calculate total hire_value when vehicle_no, package_type, start_date, end_date,
start_km_reading, end_km_reading parameters are sent in. Should return base_hire_charge,
overnight_stay_charge and extra_km_charge as output parameters.

Miss. Tharshana Thevaraj Unit 01 Programming Page 11


BAT/A-005817
3.2 Implement the above algorithms using visual studio IDE (using C#.net) and design the
suitable database structure for keeping the tariffs for vehicle types and different packages
which must be used for implementing the above functions.

3.3 Analyze the features of an Integrated Development Environment (IDE) and explain how
those features help in application development. Evaluate the use of the Visual Studio IDE
for your application development contrasted with not using an IDE.

Activity 4

4.1 Design and build a small system to calculate vehicle hire amounts and record them in a
database for customer billing and management reporting for Ayubo drive. This includes the
completing the database design started in 3.2 and implementing one or more GUIs for
vehicle, vehicle type, and package add/edit/delete functions. It essentially requires an
interface for hire calculation and recording function described above. Generating customer
reports and customer invoices are not required for this course work.

4.2 What is debugging an application? Explain the features available in Visual studio IDE for
debugging your code more easily. Evaluate how you used the debugging process to develop
more secure, robust application with examples.

4.3 Explain the coding standards you have used in your application development. Critically
evaluate why a coding standard is necessary for the team as well as for the individual.

Miss. Tharshana Thevaraj Unit 01 Programming Page 12


BAT/A-005817
Acknowledgement

First of all, I would like to express my gratitude to my lecturer Mr. Nuhman who
gave me this opportunity to develop a system and who gave support and
encouraged me to do my best. From this assignment I improved my software
skills very well. So, I am very thankful to my lecturer. Secondly, I would like to
thank my program coordinator Mr. Piragarthejan and our branch manager Mr.V.
Niruban those who encouraged me. And I would like to thank my parents and
my friends who supported and helped me to finish my work on time. Finally, I
would like to thank god for gave me a healthy environment to finish my task on
time.

Miss. Tharshana Thevaraj


HND in Computing Batch 44
BAT/A-005817

Miss. Tharshana Thevaraj Unit 01 Programming Page 13


BAT/A-005817
Table of Contents
Activity 1.................................................................................................................................. 21

1.1 Define the characteristics of good algorithm and develop algorithm for linear and
binary search. ....................................................................................................................... 21

1.1.1 Algorithm ................................................................................................................ 21

1.1.2 Linear Search .......................................................................................................... 25

1.1.3 Binary Search .......................................................................................................... 28

1.2 Describe the steps involved in the process of writing and executing a program. .......... 34

1.2.1 Process of Programming ......................................................................................... 34

1.2.2 Dry run table ........................................................................................................... 37

1.2.3 Dry run table for Linear search ............................................................................... 38

1.2.4 Dry run table for Binary search ............................................................................... 42

1.3 Define what Big-O notation is and explain its role in evaluating efficiencies of
algorithms. ........................................................................................................................... 47

1.3.1 Big-O notation......................................................................................................... 47

1.3.2 Effectiveness and role of Big-O notation ................................................................ 47

1.3.3 Big O Notation for Linear Search ...................................................................... 48

1.3.4 Big O Notation for Binary Search ..................................................................... 49

Activity 02................................................................................................................................ 50

2.1 Programming paradigm.................................................................................................. 50

2.1.1 Procedural Programming ........................................................................................ 50

2.1.2 Object oriented Programming ................................................................................. 53

2.1.3 Event Driven Programming .................................................................................... 54

2.1.4 Some other programming paradigms ...................................................................... 54

2.2 Examples and Explanations for Programming paradigms ............................................. 55

2.2.1 Procedural programming......................................................................................... 55

2.2.2 Object oriented programming ................................................................................. 55


Miss. Tharshana Thevaraj Unit 01 Programming Page 14
BAT/A-005817
2.2.3 Event driven programming ..................................................................................... 56

2.3 Relationship the Programming Paradigms ..................................................................... 57

2.4 Comparison of Programming paradigms ....................................................................... 58

Activity 03................................................................................................................................ 59

3.1 Design suable algorithms for vehicle tariff calculation for rents and hires ................... 59

3.1.1 Rent Payment calculation........................................................................................ 59

3.1.2 Hire Payment calculation ........................................................................................ 61

3.2 Code for Rent & Hire payments calculations with database structure .......................... 64

3.2.1 Database structure of Ayubo company ................................................................... 64

3.2.2 Rent Payment Calculation ....................................................................................... 65

3.2.3 Hire Payment Calculation ....................................................................................... 67

3.3 Analyze the IDE ............................................................................................................. 70

3.3.1 What is IDE ............................................................................................................. 70

3.3.2 Features of IDE ....................................................................................................... 71

3.3.3 Benefits of IDE ....................................................................................................... 75

3.3.4 Types of IDE ...................................................................................................... 76

3.3.5 Differences between programming languages with IDE and non-IDE


programming languages ................................................................................................... 77

Activity 04................................................................................................................................ 78

4.1 System for Ayubo company ........................................................................................... 78

4.1.1 Customer ................................................................................................................. 78

4.1.2 Login Form ............................................................................................................. 80

4.1.3 Menu Form .............................................................................................................. 81

4.1.4 Driver ...................................................................................................................... 82

4.1.5 Vehicle .................................................................................................................... 83

4.1.6 Rent Activity ........................................................................................................... 84

Miss. Tharshana Thevaraj Unit 01 Programming Page 15


BAT/A-005817
4.1.7 Hire Activity ........................................................................................................... 85

4.1.8 Tour and Rate .......................................................................................................... 87

4.1.9 Application Execution............................................................................................. 88

4.2 Debug ............................................................................................................................. 95

4.2.1 Benefits of Debug ................................................................................................... 96

4.3 Code Standard ................................................................................................................ 97

4.3.1Class organization .................................................................................................... 97

4.3.2 Guidelines ............................................................................................................... 99

4.3.3 Naming convention ............................................................................................... 100

4.3.4 Benefits of coding standard................................................................................... 100

Conclusion ............................................................................................................................. 102

Self-criticism .......................................................................................................................... 103

Gantt Chart ............................................................................................................................. 104

References .............................................................................................................................. 105

Miss. Tharshana Thevaraj Unit 01 Programming Page 16


BAT/A-005817
Table of Figures
Figure 1 Algorithms ................................................................................................................. 21
Figure 2 Flow chart .................................................................................................................. 22
Figure 3 Outline of Algorithm ................................................................................................. 23
Figure 4 Linear search .............................................................................................................. 25
Figure 5 Python code for linear search .................................................................................... 26
Figure 6 Process of the linear search ....................................................................................... 26
Figure 7 Output in python for linear search ............................................................................. 27
Figure 8 Python execution of linear search .............................................................................. 27
Figure 9 Binary search ............................................................................................................. 28
Figure 10 Providing a search value .......................................................................................... 31
Figure 11 Python code running process ................................................................................... 31
Figure 12 Getting output .......................................................................................................... 32
Figure 13 Flow chart for max num finding .............................................................................. 35
Figure 14 Python code to find max num .................................................................................. 36
Figure 15 Testing the program ................................................................................................. 36
Figure 16 List for linear search ................................................................................................ 38
Figure 17 Figure 17 Linear search step 1 ................................................................................. 40
Figure 18 Linear search step 2 ................................................................................................. 41
Figure 19 Linear search step 3 ................................................................................................. 41
Figure 20 Linear search step 4 ................................................................................................. 41
Figure 21Binary search step 1 .................................................................................................. 44
Figure 22 Binary step 2 ............................................................................................................ 45
Figure 23 Binary search step 3 ................................................................................................. 46
Figure 24 Binary search step 4 ................................................................................................. 46
Figure 25 Big O notation complexity chart ............................................................................. 47
Figure 26 List for the binary search ......................................................................................... 48
Figure 27 Big O notation for linear search .............................................................................. 48
Figure 28 Unsorted list for binary search ................................................................................. 49
Figure 29 Big O notation for binary search ............................................................................. 49
Figure 30 Procedural programming ......................................................................................... 50
Figure 31 Object oriented programming .................................................................................. 53

Miss. Tharshana Thevaraj Unit 01 Programming Page 17


BAT/A-005817
Figure 32 Procedural programming example........................................................................... 55
Figure 33 Object oriented programming .................................................................................. 55
Figure 34 Event driven programming ...................................................................................... 56
Figure 35 Changing the event function .................................................................................... 56
Figure 36 Relationship between the programming paradigms ................................................ 57
Figure 37 Rent payment calculation ........................................................................................ 59
Figure 38 Rent payment pseudocode explanation ................................................................... 60
Figure 39 Pseudocode for Hire Payment Day Tour Calculation ............................................. 61
Figure 40 Pseudocode for Day Tour Hire Payment Calculation ............................................. 62
Figure 41 Pseudocode for Day Tour Hire Payment ................................................................. 62
Figure 42 Pseudo code for Long Tour Hire Payment Calculation ........................................... 63
Figure 43 Database of Ayubo company ................................................................................... 64
Figure 44 Rent payment ........................................................................................................... 65
Figure 45 Code for Gathering data from other Tables ............................................................. 66
Figure 46 Number of days, weeks, months calculation ........................................................... 66
Figure 47 Hire payment ........................................................................................................... 67
Figure 48 join query for hire payment ..................................................................................... 68
Figure 49 Time and km calculation ......................................................................................... 68
Figure 50 Day tour calculation................................................................................................. 69
Figure 51 Long tour calculation ............................................................................................... 69
Figure 52 IDE........................................................................................................................... 70
Figure 53 syntax highlighting .................................................................................................. 71
Figure 54 Auto Complete ......................................................................................................... 72
Figure 55 IDE Building executables ........................................................................................ 73
Figure 56 Debugging ............................................................................................................... 74
Figure 57 Customer Registration interface .............................................................................. 78
Figure 58 Customer table ......................................................................................................... 79
Figure 59 Login form ............................................................................................................... 80
Figure 60 Successful login ....................................................................................................... 80
Figure 61 Main menu ............................................................................................................... 81
Figure 62 Driver form .............................................................................................................. 82
Figure 63 Driver table .............................................................................................................. 82

Miss. Tharshana Thevaraj Unit 01 Programming Page 18


BAT/A-005817
Figure 64 Vehicle details ......................................................................................................... 83
Figure 65 Table for vehicle related forms ................................................................................ 84
Figure 66 Rent information ...................................................................................................... 84
Figure 67 Table of rent related forms ...................................................................................... 85
Figure 68 Hire Information ...................................................................................................... 85
Figure 69 Tables for Hire ........................................................................................................ 86
Figure 70 Rate and Tour forms ................................................................................................ 87
Figure 71 Tables for rate and tour forms ................................................................................. 87
Figure 72 Main function .......................................................................................................... 88
Figure 73 Data insert ................................................................................................................ 89
Figure 74 Insert function codes ................................................................................................ 90
Figure 75 Data update .............................................................................................................. 91
Figure 76 Codes for update function........................................................................................ 92
Figure 77 Delete function ........................................................................................................ 93
Figure 78 Background code for the delete function ................................................................. 94
Figure 79 Debugging ............................................................................................................... 95
Figure 80 Class organization.................................................................................................... 98
Figure 81 Guidelines ................................................................................................................ 99
Figure 82 Naming convention................................................................................................ 100
Figure 83 Gantt chart ............................................................................................................. 104

Miss. Tharshana Thevaraj Unit 01 Programming Page 19


BAT/A-005817
Table of tables

Table 1 Dry run table for data found linear search ................................................................. 38
Table 2 Dry run table for data not found in linear search ........................................................ 39
Table 3 Dry run table for 'data found' in binary search ............................................................ 42
Table 4 Dry run table for 'data not found' in binary search..................................................... 43
Table 5 Comparison of programming paradigms .................................................................... 58
Table 6 Differences between the programming language with IDE and without IDE ............ 77

Miss. Tharshana Thevaraj Unit 01 Programming Page 20


BAT/A-005817
Activity 1

1.1 Define the characteristics of good algorithm and develop algorithm for
linear and binary search.

1.1.1 Algorithm

An algorithm can be defined as a formula or a procedure for solving a problem. It is based on


conducting a sequential specified action. A computer program can be defined as an elaborate
algorithm. This algorithm is usually used in computer science and mathematics. Basically, an
algorithm means a small procedure that solves a recurrent problem.

Figure 1 Algorithms

Algorithms are majorly used in computer programs. In programming, an algorithm means,


exact steps that needed for a computer to solve a specified problem or to achieve the desired
goal. These actions are called as functions. A programming algorithm directs the computer to
do their actions properly and the computer follows those commands and works exactly that
way every time. Algorithms are not codes. Following is an example for an algorithm.
Step 1: Start

Step 2: Declare variables n1, n2, and sum.

Step 3: Read values n1 and n2.

Step 4: Add n1 and n2 and assign the result to sum.

n1+n2 sum

Step 5: Display sum

Step 6: Stop

Miss. Tharshana Thevaraj Unit 01 Programming Page 21


BAT/A-005817
The programing algorithm can be written as step by step procedure in text like the above
example or it can be designed as a picture. This picture model is called as flowchart. The
following image is the flowchart for the above algorithm.

Figure 2 Flow chart

1.1.1.1 Outline of an Algorithm

There are several steps in writing and executing an algorithm. The algorithm can’t be executed
instantly. Because analyzing the scenario is an essential thing in writing and executing an
algorithm. The following steps shows the process in executing an algorithm.

Step 1: Understanding the scenario


First of all, understanding the scenario is a must. Because without knowing the scope a proper
algorithm can't be written. The person who is writing the algorithm should understand the
concept and scope for creating a specific function.

Miss. Tharshana Thevaraj Unit 01 Programming Page 22


BAT/A-005817
Step 2: Checking the Algorithm
The second step in executing the algorithm is checking. After the algorithm was written, that
should be checked. Especially, checking includes the steps of checking each and every
component in that algorithm. Because if there is any component which is not related to the
scenario, it could affect the function. Only if the algorithm passes this step, it could enter the
second step.

Step 3: Converting the Algorithm


This is the step which is next to the checking process. In this step, Accurate and a suitable
algorithm which is related to the given scenario will be converted as the programming
language by the programmer. The choice of the programming language depends on the
programmer.

Finally, the function will be created.

Figure 3 Outline of Algorithm

Miss. Tharshana Thevaraj Unit 01 Programming Page 23


BAT/A-005817
1.1.1.2 Characteristics of a good Algorithm

1. Space utilization: It is better if an algorithm uses a lesser amount of space


2. Effectiveness: The algorithm should be an effective one and it should be executed in
the defined time. Not only that but also every step in an algorithm should contain
principles.
3. Input: An algorithm should have a number of inputs and those inputs should a finite.
4. Output: An algorithm should release at least one accurate outcome as output.
5. Running time: A good algorithm must have the shortest running time while running.
6. Uniqueness: Each step should be unique, in a good algorithm.
7. Finiteness: The algorithm should be terminated after the defined number of steps were
executed.

The algorithm is like a skeleton for the human body. Without a proper skeleton, the
body shape will not come like a human. Likewise, without a proper algorithm, the
function will not be built accurately. In a nutshell, the algorithm is a basement for all
the functions. None of the functions couldn't be built without a proper algorithm.

Miss. Tharshana Thevaraj Unit 01 Programming Page 24


BAT/A-005817
1.1.2 Linear Search

Linear search is one of the simple searching algorithms. In Linear search, the search will be
made over all the elements one by one sequentially. All the elements will be checked during
that action and if the match found then the particular element will be returned. otherwise, the
search will be continued until the end of the collection of the data. The following is an
example of how the linear search happens.

Figure 4 Linear search

Ex: In this list


12 3 13 1 4 8 10 15 14 20
0 1 2 3 4 5 6 7 8 9
If the system wants the number 1
First it will check first value of list (12). 12 is not equal to 1 so, it will return.
Next it will check the second value (3). 3 is not equal to 1 so, it will return.
Next it will check the third value (13). 13 3 is not equal to 1 so, it will return.
Next it will check the fourth value (1). 1 is equal to 1. So, with the “found result” it ends the
function.

Miss. Tharshana Thevaraj Unit 01 Programming Page 25


BAT/A-005817
1.1.2.1 Python code for the linear search

Figure 5 Python code for linear search

Figure 6 Process of the linear search

Miss. Tharshana Thevaraj Unit 01 Programming Page 26


BAT/A-005817
Figure 8 Python execution of linear search

Figure 7 Output in python for linear search

Miss. Tharshana Thevaraj Unit 01 Programming Page 27


BAT/A-005817
1.1.2.2 Pseudo code for linear search

LinearSearch (list, size, value)


begin
if size = 0 then
return false
else if first item of list = value then
return location of first item
else
return LinearSearch (list, remaining size, value)
end if
end

1.1.3 Binary Search

Binary search is one of the fastest searching algorithms which is used to find the position of
a specific element of a sorted array. This binary search algorithm principally works based on
divide and conquer. The primary need for this algorithm is, the collection of the data should
be in a sorted form.

Figure 9 Binary search

This binary search algorithm starts the search from the middle element of a sorted array. if
the middle value is equal to the expected value the function will return. If the expected value
is lower than the middle value then the expected value will be searched in the sub-array which
is on the left of the middle item.
If the expected value is greater than the middle value then, the expected value will be searched
in the other sub-array which is on the right of the middle value. This process will be continued

Miss. Tharshana Thevaraj Unit 01 Programming Page 28


BAT/A-005817
on the sub-arrays until the size of the sub-arrays decreases as zero. Here, the array should be
in ascending order.
Ex: In this list
11 15 23 28 29 31 35 42 53 64 76 89 100 120 136
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
If the system wants the number 31
First of all, the system determines the half of the array according to the below formula
mid = low + (high-low) / 2 Here the mid, low, high means the index positions.
from the above formula 0 + (14-0) / 2 = 7
So, the mid location is 7 and the mid value is 42. Then the system compares the value stored
at index 7 with the expected value.
Here the mid value is not equal to the expected value. The expected value is smaller than the
mid value so the system will ignore the sub array on the right of the mid value (include the
mid value).
11 15 23 28 29 31 35
0 1 2 3 4 5 6
The system will find out the mid value of the above sub array
Mid location = 3 and the mid value = 28
The system compares the expected value with the new mid value and they are not equal.
The expected value is greater than the new mid so system ignores the left side of the mid
value (include the mid value).

29 31 35
4 5 6
In the above array the mid location 5
Then the system compares the expected value with the new mid value.
The comparison is successful. Because, the expected value is equal to the new mid value.

The above is the way how the binary search happens

Miss. Tharshana Thevaraj Unit 01 Programming Page 29


BAT/A-005817
1.1.3.1 Python code for the Binary search

Figure 9 Python code for the binary search

Miss. Tharshana Thevaraj Unit 01 Programming Page 30


BAT/A-005817
Figure 11 Python code running process

Figure 10 Providing a search value

Miss. Tharshana Thevaraj Unit 01 Programming Page 31


BAT/A-005817
Figure 12 Getting output

Miss. Tharshana Thevaraj Unit 01 Programming Page 32


BAT/A-005817
1.1.3.2 Pseudo code for binary search

Procedure binary_search (sorted list, search data)


Begin
S - sorted array
n - size of array
a - value to be searched

Set lowerBound = 1
Set upperBound = n

while a not found


if upperBound < lowerBound
EXIT: a does not exists.

set midPoint = lowerBound + (upperBound - lowerBound) / 2

if S[midPoint] < a
set lowerBound = midPoint + 1

if S[midPoint] > a
set upperBound = midPoint - 1

if S[midPoint] = a
EXIT: a found at location midPoint
end while

end procedure

Miss. Tharshana Thevaraj Unit 01 Programming Page 33


BAT/A-005817
1.2 Describe the steps involved in the process of writing and executing a
program.

1.2.1 Process of Programming

Step 1: Understand the problem

This is the primary step in writing a program. This also an essential part in the programming.
Because, without a clear view of the problem, the programmer can't write an accurate code
for the defined problem. In this stage, the programmers can understand what are inputs they
need to get, what is the output that the system wants to release, what are basic requirements
for the system, what are error handling methods they going to use, and etc. In a nutshell, the
programmers can get a clear view of the problem and can understand what they are going to
do to solve the problem. The programmer should spend a significant amount of time in this
step. Otherwise, it could be difficult to solve problems with the help of computers and It will
affect the system. This step begins when the programmer assigned the specific task and it
ends when the programmer got a clear understanding about the problem and when the
programmer completely knows the basic requirements for the system.

Ex: Find the maximum number from two numbers (n1, n2)

Step 2: Design a solution

This step is like a precoding method. Before writing code for a program to solve a problem,
first of all, the programmer should design the program. Here the design is like a blueprint for
the program. This design can be a pseudo code or a flow chart. This designing step helps the
programmers to write the program efficiently

Miss. Tharshana Thevaraj Unit 01 Programming Page 34


BAT/A-005817
Pseudo code to find the maximum number from two numbers

BEGIN
Input n1, n2
IF n1> n2
DISPLAY max is n1
ELSE
DISPLAY max is n2
END IF
END
Flow chart to find the maximum number from two numbers

Figure 13 Flow chart for max num finding

Miss. Tharshana Thevaraj Unit 01 Programming Page 35


BAT/A-005817
Step 3: Code the program

After the design of the program, that design should be converted as the code. For this coding
part, the programmer should select an appropriate computer language to write the code. Here
the programmer should consider each and every step that he writes. Otherwise, the system
will get trouble.
Python code to find the maximum number from two numbers

Figure 14 Python code to find max num

Step 4: Test the program

This step contains the testing procedure of the program. The testing means running the
program. If the program runs correctly the code is correct. otherwise, the programmer should
reconstruct the code.

Figure 15 Testing the program

Miss. Tharshana Thevaraj Unit 01 Programming Page 36


BAT/A-005817
Step 5: Maintenance

This step is as much as important as the coding part. Here, the maintenance means updating
the program and checking the functionality of the program within a specific time period. The
written code and the executed program should be upgraded by the programmer according to
the needs of the users.

1.2.2 Dry run table

A dry run may be a testing handle where the impacts of a conceivable disappointment are
intentioned moderated. For illustration, an aviation company may conduct a "dry run" test of
a jet's unused pilot launch situate whereas the jet is stopped on the ground, instead of while it
is in flight. In computer programming, a dry run may be a mental run of a computer program,
where the computer software engineer analyzes the source code one step at a time and decides
what it'll do when run. In theoretical computer science, a dry run could be a mental run of an
algorithm, some of the time communicated in pseudocode, where the computer researcher
looks at the algorithm's strategies one step at a time. In both employments, the dry run is as
often as possible helped by a table with the program or algorithm's factors on the best. The
utilization of "dry run" in acknowledgment strategies is implied as taking after the plant -
which may be a subcontractor - must perform a total test of the framework it has got to convey
some time recently the genuine acknowledgment from the contract side (Anon., 2020)

Miss. Tharshana Thevaraj Unit 01 Programming Page 37


BAT/A-005817
1.2.3 Dry run table for Linear search

Figure 16 List for linear search

1.2.3.1 Dry run table for ‘Data found’ in Linear search

List = [ 12, 20, 37, 85, 13, 24, 11, 74, 14, 33]
Search Data = [14]

Table 1 Dry run table for data found linear search

Index value
Steps Index position Index value Search data = Result
Search data
Step 1 [0] 12 14 False -
Step 2 [1] 20 14 False -
Step 3 [2] 37 14 False -
Step 4 [3] 85 14 False -
Step 5 [4] 13 14 False -
Step 6 [5] 24 14 False -
Step 7 [6] 11 14 False -
Step 8 [7] 74 14 False -
Step 9 [8] 14 14 True Data found

Miss. Tharshana Thevaraj Unit 01 Programming Page 38


BAT/A-005817
1.2.3.2 Dry run table for ‘Data not found’

List = [ 12, 20, 37, 85, 13, 24, 11, 74, 14, 33]
Search Data = [50]

Table 2 Dry run table for data not found in linear search
Index value
Index
Steps Index position Search data = Result
value
Search data
Step 1 [0] 12 50 False -
Step 2 [1] 20 50 False -
Step 3 [2] 37 50 False -
Step 4 [3] 85 50 False -
Step 5 [4] 13 50 False -
Step 6 [5] 24 50 False -
Step 7 [6] 11 50 False -
Step 8 [7] 74 50 False -
Step 9 [8] 14 50 False -
Step 10 [9] 33 50 False Data Not found

Miss. Tharshana Thevaraj Unit 01 Programming Page 39


BAT/A-005817
1.2.3.3 Explanation for the Dry run table of Linear search, through
Python

According to the action which happens in the dry run table, the python code for linear search
will be executed.

List for Linear search

Represents Linear search

Figure 17 Figure 17 Linear search step 1

The above picture shows the python function for the linear search. This function will be
executed according to the action that happens in the dry run table. This is a simple function
that happens in a hospital. Here the users could check are they got an appointment with the
doctor or not. When the users input their token number, they will receive a message of the
result.
These 2 lines of the code represents the main action happens in the linear search. Here ‘A’
represents the list of the patients who got appointments. ‘len’ represents the count of the list.
The system will check the appointments one by one and give the out put

Miss. Tharshana Thevaraj Unit 01 Programming Page 40


BAT/A-005817
The process of the function will be shown in the following pictures.

The system asks for an input from the user

Figure 18 Linear search step 2

Here the system asks the users to insert their input If the user insert a token number, they
could know the appointment details.

The system asks for an input from the user

Figure 19 Linear search step 3

For example, a user inputs 14 as his token number. If he got registered and got an appointment,
he will receive a message as 'You've got an appointment with the doctor, please wait for the
call.' If he did not register, he will receive a message as 'Sorry!!! you didn't register for an
appointment. contact the receptionist.' Here the user got registered earlier.

Figure 20 Linear search step 4

Miss. Tharshana Thevaraj Unit 01 Programming Page 41


BAT/A-005817
1.2.4 Dry run table for Binary search

1.2.4.1 Dry run table for ‘Data found’ in Binary search

List = [41, 28, 10, 22, 99, 14, 135, 63, 88, 27, 30, 120, 35, 52, 75]
Search Data = [30]
Sorted List = [10, 14, 22, 27, 28, 30, 35, 41, 52, 63, 75, 88, 99, 120, 135]

Table 3Dry run table for 'data found' in binary search


Mid Mid Mid Result List
Low High
Mid Mid Search data = data > data <
Steps inde inde
index value data search search search
x x
data data data
[41, 28, 10, 22,
- 99, 14, 135, 63,
Initial 0 14 - - 30 - - -
88, 27, 30, 120,
35, 52, 75]
[10, 14, 22, 27,
28, 30, 35, 41,
Sort 0 14 - - 30 - - -
- 52, 63, 75, 88,
99, 120, 135]
[10, 14, 22, 27,
28, 30, 35, 41,
Step 1 0 14 7 41 30 False True False - 52, 63, 75, 88,
99, 120, 135]

[10, 14, 22, 27,


Step 2 0 6 3 27 30 False False True - 28, 30, 35]

Step 3 4 6 5 30 30 True False False Data Found [28, 30, 35]

Miss. Tharshana Thevaraj Unit 01 Programming Page 42


BAT/A-005817
1.2.4.2 Dry run table for ‘Data Not found’ in Binary search

List = [41, 28, 10, 22, 99, 14, 135, 63, 88, 27, 30, 120, 35, 52, 75]
Search Data = [40]
Sorted List = [10, 14, 22, 27, 28, 30, 35, 41, 52, 63, 75, 88, 99, 120, 135]

Table 4 Dry run table for 'data not found' in binary search
Mid Mid Mid Result List
Low High
Mid Mid Search data = data > data <
Steps inde inde
index value data search search search
x x
data data data
[41, 28, 10, 22,
- 99, 14, 135, 63,
Initial 0 14 - - 40 - - -
88, 27, 30, 120,
35, 52, 75]
[10, 14, 22, 27,
28, 30, 35, 41,
Sort 0 14 - - 40 - - -
- 52, 63, 75, 88,
99, 120, 135]
[10, 14, 22, 27,
28, 30, 35, 41,
Step 1 0 14 7 41 40 False True False - 52, 63, 75, 88,
99, 120, 135]

[10, 14, 22, 27,


Step 2 0 6 3 27 40 False False True - 28, 30, 35]

Data Not
Step 3 4 6 5 30 40 False False True [28, 30, 35]
Found

Miss. Tharshana Thevaraj Unit 01 Programming Page 43


BAT/A-005817
1.2.4.3 Explanation for the Dry run table of Binary search, through
Python

According to the action which happens in the dry run table, the python code for binary search
will be executed.

List for the binary serach

Figure 21Binary search step 1

The above picture shows the python function for the binary search. This function will be
executed according to the action that happens in the dry run table. This is a simple function
of finding a number from a list of numbers. When the users input the number, they want
check, they will receive a message of the result.

Miss. Tharshana Thevaraj Unit 01 Programming Page 44


BAT/A-005817
These lines of the code represent the main action happens in the binary search. Here ‘A’
represents the list of numbers. This part is the main part of the python code for binary search.

The process of the function will be shown in the following pictures.

Asking for an input

Figure 22 Binary step 2

Here the system asks the users to insert their input If the user insert a number, they could
know the available details.

Miss. Tharshana Thevaraj Unit 01 Programming Page 45


BAT/A-005817
For example, a user inputs 14 as the number. If the number is available at the list the user will
receive a message as ‘Result Found!' If the number is not available, the user will receive will
receive a message as.' Result Not Found!’. Here the user got output as ‘Result Found!'.

Figure 23 Binary search step 3

Figure 24 Binary search step 4

Miss. Tharshana Thevaraj Unit 01 Programming Page 46


BAT/A-005817
1.3 Define what Big-O notation is and explain its role in evaluating
efficiencies of algorithms.

1.3.1 Big-O notation

The Big O notation defines an upper bound of an algorithm, it bounds a function only from
above. For example, consider the case of Insertion Sort. It takes linear time in the best case
and quadratic time in the worst case. We can safely say that the time complexity of the
Insertion sort is O(n^2). Note that O(n^2) also covers linear time. (Debnath, 2020)

1.3.2 Effectiveness and role of Big-O notation

It does this with regard to “O” and “n”, (case: “O (log n)”), where O alludes to the arrangement
of the work or its development rate, and n is the length of the cluster to be sorted.

Figure 25 Big O notation complexity chart

When looking at numerous of the foremost commonly utilized sorting calculations, the rating
of O (n log n) in common is the finest that can be accomplished. Calculations that run at this
rating incorporate Speedy Sort, Pile Sort, and Consolidate Sort. Speedy Sort is the standard
and is utilized as the default in nearly all computer program languages. (Rail, 2018)

Miss. Tharshana Thevaraj Unit 01 Programming Page 47


BAT/A-005817
1.3.3 Big O Notation for Linear Search

According to the above explanations about linear search and binary search, linear search's
process is slower than the binary search. Because the linear search will check the elements
one by one. But the binary search will divide the list according to the mid-value and will
compare the search value with the elements. That's why the binary search is relatively faster
than the linear search. But there is one advantage in using the linear search method. That is,
for a binary search process, the list must be in a sorted form. But for the linear search, the
sorting method is not essential.

Figure 26 List for the binary search

The above picture shows the list used in the linear search. According to the example the
elements in the list represents the token numbers of the patients of ‘MILLENIUM Hospital’.
If one of the patients input their token num this linear search method checks every element
one by one. This process will continue until the search item. This process will continue until
the last element of the list. This is the reason why the linear search is quite slower than binary
search. The following image shows the graph for the linear search and it represents the
handling a problem with linear search.

Figure 27 Big O notation for linear search

Miss. Tharshana Thevaraj Unit 01 Programming Page 48


BAT/A-005817
1.3.4 Big O Notation for Binary Search

All the above example proves that binary search is better than linear search while compare
both of them based on time complexity. Because while the linear search checks the elements
one by one, the binary search will separate the list according to the mid-value, ignores the
unwanted elements and compares the search value with the elements. That’s why binary is
always faster than the linear search. The following picture shows the list used in the binary
search.

Figure 28 Unsorted list for binary search

Sorted List:

[10, 14, 22, 27, 28, 30, 35, 41, 52, 63, 75, 88, 99, 120, 135]
Low Mid High
Value Value Value

According to the following equation, the binary search identifies the mid value. Here the mid,
low, high keywords represent the index position of the elements.

mid = low + (high-low) / 2


The following graph shows the Big O notation for the binary search.

Figure 29 Big O notation for binary search

Miss. Tharshana Thevaraj Unit 01 Programming Page 49


BAT/A-005817
Activity 02

2.1 Programming paradigm

The term programming paradigm alludes to a way of programming. It does not allude to a
particular computer language, but or maybe it alludes to the way the programmer program.
There are a variety of programming languages that are well-known but all of them have to be
taken after some strategy when they are actualized. (MV, 2019)

2.1.1 Procedural Programming

Procedural programming (which is additionally basic) permits part those enlightening into
procedures. Procedures aren't functions. The distinction between them is that functions return
a value, and procedures don't. More particularly, functions are outlined to have negligible side
impacts, and continuously deliver the same yield when given the same input. Procedures, on
the other hand, don't have any return esteem. Their essential reason is to achieve a given
assignment and cause a craved side effect. An awesome case of procedures would be well
known for the circle. The for loop's fundamental reason is to cause side impacts and it does
not return a value. To outline, let's discover the whole of, to begin with, ten characteristic
numbers within the procedural worldview approach. (Bhatia, 2020)

Figure 30 Procedural programming

Miss. Tharshana Thevaraj Unit 01 Programming Page 50


BAT/A-005817
Features of procedural programming

Predefined functions: A predefined function is ordinarily an instruction recognized by a title.


As a rule, the predefined functions are built into higher-level programming dialects, but they
are inferred from the library or the registry, instead of the program

Local Variable: A local variable could be a variable that's pronounced within the
fundamental structure of a method and is restricted to the nearby scope it is given. The local
variable can as it was being utilized within the strategy it is characterized in, and if it were to
be utilized exterior the characterized strategy, the code will desist to work.

Global Variable: A worldwide variable may be a variable which is pronounced exterior each
other work characterized within the code. Due to this, worldwide factors can be utilized in all
capacities, not at all like a nearby variable.

Modularity: Modularity is when two disparate frameworks have two diverse tasks at hand
but are assembled together to conclude a bigger assignment.

Parameter Passing: Parameter Passing could be a component utilized to pass parameters to


functions, subroutines, or strategies. Parameter Passing can be done through ‘pass by value’,
‘pass by reference’, ‘pass by result’, ‘pass by value-result’ and ‘pass by the name’.
(Bhatia, 2020)

Miss. Tharshana Thevaraj Unit 01 Programming Page 51


BAT/A-005817
Advantages of Procedural programming

• Procedural Programming is fabulous for general-purpose programming.


• The coded straightforwardness in conjunction with ease of execution of compilers and
interpreters.
• An expansive assortment of books and online course fabric accessible on tried
calculations, making it simpler to memorize along the way.
• The source code is convenient, in this manner, it can be utilized to target a diverse
CPU as well.
• The code can be reused in several parts of the program, without the have to be
duplicate it.
• Through Procedural Programming strategy, the memory necessity too slashes.
• The program stream can be followed easily.

Disadvantages of Procedural programming

• The program code is harder to compose when Procedural Programming is employed.


• The Procedural code is frequently not reusable, which may posture the ought to
reproduce the code on the off chance that is required to utilize in another application.
• Difficult to relate with real-world objects.
• The significance is given to the operation instead of the data, which might posture
issues in a few data-sensitive cases.
• The information is uncovered to the complete program, making it not so much security
friendly.

Miss. Tharshana Thevaraj Unit 01 Programming Page 52


BAT/A-005817
2.1.2 Object oriented Programming

OOP is an approach to programming which recognizes life as we know it as a collection of


objects, which work in pair with each other to fathom a specific issue at hand. The essential
thing to know approximately OOP is the epitome, which is the thought that each question that
holds the program is self-sustainable, which implies that all the components that make up the
question are inside the protest itself. Presently since each module inside this worldview is
self-sustainable, objects can be taken from one program and utilized to resolve another issue
at hand with small or no changes. (Bhatia, 2020)

Figure 31 Object oriented programming

Advantages of Object-oriented programming

• Due to measured quality and embodiment, OOP offers ease of management.


• OOP imitates the real world, making it simpler to understand.
• Since objects are entire inside themselves, they are reusable in other programs.

Disadvantages of Object-oriented programming

• Object-Oriented programs tend to be slower and utilize up a tall sum of memory.


• Over-generalization.
• Programs built utilizing this worldview may take longer to be created.

Miss. Tharshana Thevaraj Unit 01 Programming Page 53


BAT/A-005817
2.1.3 Event Driven Programming

Event-driven programming may be a programming paradigm in which the stream of program


execution is decided by occasions - for illustration a client activity such as a mouse click,
keypress, or a message from the working framework or another program. An event-driven
application is designed to detect occasions as they happen, and after that bargain with them
utilizing a fitting event-handling method. The thought is an expansion of interrupt-driven
programming of the kind found in early command-line situations such as DOS, and in
implanted frameworks (where the application is actualized as firmware).
(technologyuk, 2020)

2.1.4 Some other programming paradigms

• Imperative: Programming with an unequivocal grouping of commands that upgrade


state.
• Declarative: Programming by indicating the result you need, not how to urge it.
• Structured: Programming with clean, go to-free, settled control structures.
• Functional (Applicative): Programming with work calls that dodge any worldwide
state.
• Function-Level (Combinator): Programming with no factors at all.
• Flow-Driven: Programming forms communicating with each other over predefined
channels.
• Logic (Rule-based): Programming by indicating a set of truths and rules. A motor
induces the answers to questions.
• Reflective: Programming by controlling the program components themselves.
• Array: Programming with effective cluster administrators that more often than not
make circles superfluous.
• Constraint: Programming by indicating a set of imperatives. A motor finds the values
that meet the constraints.

Miss. Tharshana Thevaraj Unit 01 Programming Page 54


BAT/A-005817
2.2 Examples and Explanations for Programming paradigms

2.2.1 Procedural programming

Figure 32 Procedural programming example


In this procedural programming, the activity will be done in order. From when the, if condition
started the application, process will start line by line and It will look after the input. This
application and its output are based on the input which it gets. There will be lines of codes
here. After finishing each step, the application ends and it will return the output.

2.2.2 Object oriented programming

Figure 33 Object oriented programming

The above image shows the use of OOP in a C# application. In this project, there is a class
name called 'common code' and here, some other important codes are written inside that. By
this OOP method, the common code class assigned into an object and that is called 'com'
object. Utilizing the strategy common code class can be used in other classes in the system.

Miss. Tharshana Thevaraj Unit 01 Programming Page 55


BAT/A-005817
2.2.3 Event driven programming

The following image represents how an event-driven programming have been used in a C#
application. In this image, the boxed portion is the command which rules the execution of
the program.

Figure 34 Event driven programming

It will decide when the program has to be run. In here, ‘LoadTable_CellClick’ work will run
automatically when pressing any cell on the particular table on the application. It should be
in the running time. The following actions should be done to make the function works like
this.

Figure 35 Changing the event function

By the changing the event function like this, the application will run as explained in the
previous paragraphs.

Miss. Tharshana Thevaraj Unit 01 Programming Page 56


BAT/A-005817
2.3 Relationship the Programming Paradigms

The following picture clearly shows the relationship between the programming paradigms.
The picture includes the code which represents the collaboration of the procedural
programming, object-oriented programming and the event-driven programming in this
system. In this system, the SQL connection was created as an object named ‘con’. This
method shows the usage of object-oriented programming in here. The next step is creating a
function called loadTableFun. After that this function will be called as form_load function.
This function will be executed when the form runs. This method shows the usage of event-
driven programming in here. After all these steps, when the function starts to run each line of
the code will be executed line by line in an order. This method shows the usage of procedural
programming here. So, this pictures clearly shows the relationship between the programming
paradigms.

Figure 36 Relationship between the programming paradigms

Miss. Tharshana Thevaraj Unit 01 Programming Page 57


BAT/A-005817
2.4 Comparison of Programming paradigms

Table 5 Comparison of programming paradigms

Procedural Programming Object Oriented Event Driven

To compose the commands, OOP gives a command This Event-driven


this paradigm gives the composing in the modules. provides a graphical user
character user interface interface to the developers
to make programs.

Fortran and COBOL are the In this OOP to perform Here. The actions are
common languages which particular tasks, the defined in events. These
are following this paradigm. objects and capacities are events can be happened by
arranged as interaction. mouse clicking and
moving or console strokes.

This paradigm focuses on OOP secures the objects This event-driven will
the execution of the steps and data from focus on whether selecting
whether it is sequential. unauthorized access by a user interface.
focusing on them.

In this paradigm, the C++, Smalltalk, and JAVA Visual Basic and C# are
commands are composed in are the most common the most common
a linear design. Not only that languages that follow this languages that follow this
but also, they are executed paradigm. paradigm.
in a linear way.

The programming paradigms are different from others. Each paradigm has its own
way. But while creating a function all the paradigms should work together. They must
interact with each other. Because a single paradigm is not enough to execute a function
for a system.

Miss. Tharshana Thevaraj Unit 01 Programming Page 58


BAT/A-005817
Activity 03

3.1 Design suable algorithms for vehicle tariff calculation for rents and
hires

3.1.1 Rent Payment calculation

In this calculation part the rent payment depends on the rent type. Because in rent type there
are two categories. One is with driver and another one is without driver. If one of the
customers rents a vehicle with a driver then rent payment includes the driver charge.
Otherwise, the rent payment will be calculated only for the vehicle. The following algorithm
shows how the system is doing this rent payment calculation.

Figure 37 Rent payment calculation

Miss. Tharshana Thevaraj Unit 01 Programming Page 59


BAT/A-005817
Agreeing to this picture, in the event that the framework must run, vehicle_no, rented_date,
return_date, with_driver information ought to be passed to here. After passing this
information, total_days can calculate through the contrast between return_date and
rented_date. This total_days esteem relegates to the day’s variable. After these exercises, the
number of leased months, weeks, days calculation requires to do. That’s why the on the off
chance that condition utilized over. After this calculation, lease for a month, lease for a week,
lease for days will calculate through the duplication between the rates and number of days,
weeks, months. At last, the driver charge will calculate based on client determination. This
implies, in case the client took the vehicle with driver for lease, the driver charge will expand
with fundamental charge and get the full lease installment. But the client chosen without a
driver at that point add up to lease installment is break even with to the essential charge since
the driver charge won’t meddle this calculation.

Figure 38 Rent payment pseudocode explanation

Miss. Tharshana Thevaraj Unit 01 Programming Page 60


BAT/A-005817
3.1.2 Hire Payment calculation

3.1.2.1 Day Tour Hire Payment Calculation

Figure 39 Pseudocode for Hire Payment Day Tour Calculation

According to this pseudocode, if this system wants to work, it should pass the vehicle_no,
package_type, start_km_reading, end_km_reading, end_time, start_time, information. From
this information base_hire_charge, waiting_charge, extra_km_charge will be calculated.
Moreover, hire_other_charges calculation appeared in this picture. That calculation depends
on the enlist days. This condition utilized to calculate the other charges which suggest
overNight, night_parking charges. The essential information for this calculation is to recover
from the database. The clarified pseudocode is given underneath.

Miss. Tharshana Thevaraj Unit 01 Programming Page 61


BAT/A-005817
Figure 40 Pseudocode for Day Tour Hire Payment Calculation

3.1.2.2 Long Tour Hire Payment Calculation

Figure 41 Pseudocode for Day Tour Hire Payment

Miss. Tharshana Thevaraj Unit 01 Programming Page 62


BAT/A-005817
The vehicle_no, package_type, start_date, end_date, start_km_reading, end_km_reading
information should be passed if the system has to work properly. This is based on pseudocode.
The net day number and net add up to km number will be calculated from the
start_km_reading, end_km_reading, start_date, end_date, information after passing this
information. The function check is the total_km greater than max_km. If it is true that this
genuine, extra_km charge will be calculated after this calculation. At that point once more,
the work will check in the event that the total_days greater than two, in case this condition is
genuine, the overnight_stay_chargewill be calculated. These triple charges through and
through into enlisting add up to charge will claim from the client. The clarified pseudocode
is given underneath.

Figure 42 Pseudo code for Long Tour Hire Payment Calculation

Miss. Tharshana Thevaraj Unit 01 Programming Page 63


BAT/A-005817
3.2 Code for Rent & Hire payments calculations with database structure

3.2.1 Database structure of Ayubo company

Figure 43 Database of Ayubo company

The picture above is the database of the Ayubo company. This is often a fundamental and
important asset of the company. Since this company completely depended on this database
for their commerce and day-to-day activities.
The vehicle, vehicle types, hire packages, rent payment, driver, tour types, other charges, and
rates are put in separate columns. By this, there are many benefits. Through this, the rent
calculations and hire calculations will be executed. Once the information was embedded in
this database when the client requires that information can recover from here.

Miss. Tharshana Thevaraj Unit 01 Programming Page 64


BAT/A-005817
3.2.2 Rent Payment Calculation

The following picture shows how the rent payment is calculated by the system.

Figure 44 Rent payment

The above picture shows the interface of the rent payment calculation. The customer can see
the form in the application. When the customer fills the calculation code will be executed in
the background of the form. Here, Customer name, rent type, number of days, and rent id will
come from tables of the customer, rent type, and rent. The fundamental sum, driver charge,
and total rent charge will fill here. This will be based on the calculation codes. The client
ought to select the rent id, after this procedure, when the customer presses the button the data
will be filled here automatically. The client switches the installment sort based on how the
client aiming to pay. These are the only activities that the customer might do.

Miss. Tharshana Thevaraj Unit 01 Programming Page 65


BAT/A-005817
Figure 45 Code for Gathering data from other Tables

The picture shows the data assign to the variables, by getting them from other tables.

Figure 46 Number of days, weeks, months calculation

The above picture describes how the whole number of days change over into day, week, and
month. After the changeover, that information ought to be duplicated by the rate(charge) of
the month, week, and day. Through this, the essential charge of the lease will be calculated.
In final of this picture, the pink boxes appear the day, week, and month tallies allowed factors
and yellow boxes appear the relegated factors of rate(charge) of day, week, and month.

Miss. Tharshana Thevaraj Unit 01 Programming Page 66


BAT/A-005817
3.2.3 Hire Payment Calculation

Figure 47 Hire payment

This picture shows the interface of the hire payment calculation in Ayubo drive. The start
reading, end reading, begin time and end time are the only thing that needs to add by the
customers. Because all other details will auto-filled based on hire id. That's why the form
designed like this.

Miss. Tharshana Thevaraj Unit 01 Programming Page 67


BAT/A-005817
The following pictures shows how the information auto fills in this form.

Figure 48 join query for hire payment

The details of time and km reading calculation is given below in the picture.

Figure 49 Time and km calculation

Miss. Tharshana Thevaraj Unit 01 Programming Page 68


BAT/A-005817
3.2.3.1 Hire Day Tour Calculation

According to this code in the picture, if a customer selects a day tour to hire a vehicle the
calculation will be work in the background of the system's interface. In the situation, while a
customer takes more time than the hire package time limitations, the system calculates the
extra hours and it would be added to the hire payment.

Figure 50 Day tour calculation

3.2.3.2 Hire Long Tour Calculation

Figure 51 Long tour calculation

Miss. Tharshana Thevaraj Unit 01 Programming Page 69


BAT/A-005817
The calculation of extra km charge, night parking charge and the over-night charge are
mentioned in the above picture. This includes the concept of adding charges to the hire
payment. If a customer exceeds the km limit, the charges for the extra km will be calculated.
This is based on the hire package. Likewise, the charges for night parking and overnight are
based on the hire days.

3.3 Analyze the IDE

3.3.1 What is IDE

Integrated Development Environment is the full form of IDE. This Integrated Development
Environment helps the programmers to integrate different kinds of aspects in writing a
computer-based program. By combining the common activities of software writing into a
single application, the IDE increases the productivity of a programmer. (codecademy, 2020)

Figure 52 IDE
On a more essential level, IDEs give interfacing for clients to type in code, organize content
bunches, and automate programming redundancies. But rather than a bare-bones code editor,
IDEs combine the usefulness of numerous programming forms into one. A few IDEs center
on a particular programming dialect, such as Python or Java, but numerous have cross-
language capabilities. In terms of content altering capabilities, IDEs regularly have or permit
the addition of systems and component libraries to construct upon base-level code.
Throughout the composing handle, one or different clients make pecking orders inside the
IDE and relegate bunches of code to their assigned locale. From these, groupings can be hung
together, compiled, and built. Most IDEs come with built-in debuggers, which enact upon the
construct. Visual debuggers are a considerable advantage of numerous IDEs. In the event that
any bugs or blunders are spotted, clients appear which parts of code have issues.
(Walker, 2020)
Miss. Tharshana Thevaraj Unit 01 Programming Page 70
BAT/A-005817
3.3.2 Features of IDE

Writing code accurately is an important part of programming. In IDE there are some features
for this, they help to do this easily. the following are the features of the IDE.
• Syntax highlighting
• Debugger
• Compiler
• Code completion
• Programming language support
• Integrations and plugins

3.3.2.1 Syntax Highlighting

IDE consists of different language structures of the programming languages. So, by using
color variations it will differentiate the keywords from other words, For a case, in C#, just
like the Get to modifiers, return type, etc. is appears completely different colors for makes a
difference to appear the distinction of sentence structure and other ordinary words to the
developer.

Figure 53 syntax highlighting

Miss. Tharshana Thevaraj Unit 01 Programming Page 71


BAT/A-005817
3.3.2.2 Autocomplete

More programming languages have IDE. So, which can recognize what will the programmer
reaching to sort when the start of composing and propose that to the developer. When a
software composes code to create a newly function in C#, That's a public void clean_fun ()'.
So, when the software engineer reaching to begin composing the code, IDEs autocomplete
work will enacted and the programmer could write the code with the help of that. These points
of interest appear underneath picture.

Figure 54 Auto Complete

Miss. Tharshana Thevaraj Unit 01 Programming Page 72


BAT/A-005817
3.3.2.3 Building executables

Each and every program has the require of the compilation handling method. Compilation
prepare implies, change overactivity of the machine dialect (code) to can recognized the
working system. The visual studio is consequently compiling the code as work in windows
in C# language. Since the visual studio has the IDE work. This capacity has a place for the
IDE.

Figure 55 IDE Building executables

Miss. Tharshana Thevaraj Unit 01 Programming Page 73


BAT/A-005817
3.3.2.4 Debugging

Debugging tools help clients in recognizing and helping mistakes inside source code. They
frequently reenact real-world scenarios to test usefulness and execution. Software engineers
and computer program engineers can more often than not test the different sections of code
and distinguish blunders sometime recently the application is discharged.

Figure 56 Debugging

Miss. Tharshana Thevaraj Unit 01 Programming Page 74


BAT/A-005817
3.3.3 Benefits of IDE

• Serves as a single environment for most, in the event that not all, of a developer’s
needs such as form control frameworks, investigating devices, and Platform-as-a-
Service.
• Code completion capabilities make strides programming workflow.

• Automatically checks for mistakes to guarantee beat quality code.

• Refactoring capabilities permit engineers to create comprehensive and mistake-free


renaming changes.

• Maintain a smooth improvement cycle.

• Increase designer effectiveness and satisfaction.

• Deliver a top-quality computer program on schedule.


(Walker, 2020)
There are a number of reasons to utilize an IDE, most of which spin around computer program
improvement. The stage centralizes three key apparatuses utilized by most developers: source
code editors, debuggers, and compilers. This permits clients to compose, culminate, and
prepare code inside a single environment. Centralizing these apparatuses moreover makes it
less demanding to explore the source code in question. Numerous incorporate extra
capabilities to test, organize and refactor code. Extra highlights such as autocomplete, at the
side construct, and sending capabilities, altogether extend a developer’s capabilities and
progress their advancement speed. Improved organization and source code administration can
diminish mistakes as w well as improved time.
Clients can fine-tune applications after builds are completed. They can often spare forms of a
venture in case they ought to return a program. Eventually, groups utilize their coordinates
adaptation control framework to check-in and out components of the program from their code
repository. (Walker, 2020)

Miss. Tharshana Thevaraj Unit 01 Programming Page 75


BAT/A-005817
3.3.4 Types of IDE

3.3.4.1 Multi-Language IDEs

Multi-language IDEs, such as Eclipse, NetBeans, Komodo, Aptana, and Geany, back different
programming languages.
• Eclipse: Underpins C, C++, Python, Perl, PHP, Java, Ruby, and more. This free and
open-source editor is the show for numerous advancement systems. Eclipse started as
a Java advancement environment and has extended through plugins. Eclipse is
overseen and coordinated by the Eclipse.org Consortium.

• NetBeans: Bolsters Java, JavaScript, PHP, Python, Ruby, C, C++, and more. This
choice is additionally free and open source. All the capacities of the IDE are given by
modules that each give a well-defined work. Back for other programming dialects can
be included by introducing extra modules.

• Komodo IDE: This IDE supports Perl, Python, Tcl, PHP, Ruby, Javascript, and more.
This enterprise-level device incorporates a higher price point.

• Aptana: Aptana supports HTML, CSS, JavaScript, AJAX, and others through plugins.
This can be a well-known choice for web app development.

• Geany: Supports C, Java, PHP, HTML, Python, Perl, Pascal, and numerous more.
Typically, an exceedingly customizable environment with a huge set of plugins.

(veracode, 2020)

3.3.4.2 IDEs for Mobile Development

There are IDEs particularly for portable improvement, counting PhoneGap and Appcelerator's
Titanium Mobile.
Many IDEs, particularly those that are multi-language, have mobile-development plugins. For
occasion, Eclipse has this usefulness. (veracode, 2020)

Miss. Tharshana Thevaraj Unit 01 Programming Page 76


BAT/A-005817
3.3.4.3 HTML IDEs

A few of the foremost prevalent IDEs are those for creating HTML applications. For case,
IDEs such as HomeSite, DreamWeaver, or FrontPage mechanize numerous errands included
in web location advancement. (veracode, 2020)

3.3.4.4 Cloud-Based IDEs

Cloud-based IDEs are beginning to end up standard. The capabilities of these web-based IDEs
are expanding quickly, and most major sellers will likely offer one to be competitive. Cloud
IDEs provide engineers access to their code from anyplace. For the case, Nitrous could be a
cloud-based improvement environment stage that bolsters Ruby, Python, Node.js, and more.
Cloud9 IDE supports more than 40 dialects, counting PHP, Ruby, Python, JavaScript with
Node.js, and Go. Heroku could be a cloud-based advancement stage as a benefit (PaaS),
supporting a few programming dialects. (veracode, 2020)

3.3.5 Differences between programming languages with IDE and non-


IDE programming languages

Table 6 Differences between the programming language with IDE and without IDE

Features of IDE A language with IDE A language without IDE

Syntax highlighting
Could identify the keywords easily. It’s difficult to identify the keywords
from other words.
Auto complete While programmer start to write The programmer should know the full
the code and when start to write the form and accurate keywords for the
key word it be will autocompleted. function.
Debugging The system automatically shows The programmer should check every
the error and the location of that. lines of codes.

Miss. Tharshana Thevaraj Unit 01 Programming Page 77


BAT/A-005817
Activity 04

4.1 System for Ayubo company

The application was designed to agree to the company’s requirements. Primarily this
application was planned and built based on the primary characters and the daily activities and
functions of this company. The following are a few of the interfaces of the application for
'Ayubo' rent a car system.

4.1.1 Customer

4.1.1.1 Customer Form

Figure 57 Customer Registration interface

The above picture shows the interface for customer registration. The customer can enroll his
subtle elements within the particular database for the customers through this form. When the
customer hires a vehicle from this company these points of interest utilized for making an
installment charge. Concurring to this picture, the client can spare his subtle elements through
tap the embed button after wrap up the information filling.

Miss. Tharshana Thevaraj Unit 01 Programming Page 78


BAT/A-005817
4.1.1.2 Customer Table in Database

Figure 58 Customer table

The picture above shows the table for saving the customer subtle elements within the Ayubo
company database. This table associated with the client frame. Through the client frame, can
embed the customers' subtle elements into the customer table. To begin with, the chart appears
the client table columns and their information sorts. Moment chart appears how does the as
of now embedded information put away into the table. The client frame was outlined based
on this client table. There's no 'Allow Null' choice relegate to any columns in the client table.
So, through the client frame, all columns related to subtle elements ought to pass here.

Miss. Tharshana Thevaraj Unit 01 Programming Page 79


BAT/A-005817
4.1.2 Login Form

Figure 59 Login form

As of now wrap up the enlisted people can get to this login form. As it were as of now enlisted
people have a specific username and password. After filling the password and the Username,
through the press the login button can reach the menu form of 'Ayubo' rent a car system.

Figure 60 Successful login

Miss. Tharshana Thevaraj Unit 01 Programming Page 80


BAT/A-005817
If the customer entered the accurate username and password, he will get a popup message.
That popup message is 'Inserted successfully'. After this procedure, the customer can visit the
menu form.

4.1.3 Menu Form

Figure 61 Main menu

After this procedure, the customer can visit all the forms of 'Ayubo' rent a car system through
this menu form. Because each form of this system is interconnected with this menu form.

Miss. Tharshana Thevaraj Unit 01 Programming Page 81


BAT/A-005817
4.1.4 Driver

4.1.4.1 Driver Form

Figure 62 Driver form


Through this form, the 'Ayubo' company can keep up the details of their employees. If the
company needs its employees' details, they can get the details from here. In a situation, if the
company requires the driver point details, they can get the details from the data which are
stored.

4.1.4.2 Driver Table of Database

Figure 63 Driver table

Miss. Tharshana Thevaraj Unit 01 Programming Page 82


BAT/A-005817
The above picture describes the data storing a table of driver details. The driver form is
associated with this table. The driver details can be inserted to the driver table through the
driver form. The first chart contains the driver table columns and the data types of them. The
second chart describes inserted how the data has been stored in the table.

The driver form was designed based on this driver table. There is no 'Allow Null' choice
relegate to any columns in the driver table. So, through the customer form, all columns related
details ought to pass here. Each table associated with their related tables for information
exchange. Since a few of the calculation parts require distinctive table details.

4.1.5 Vehicle

4.1.5.1 Vehicle Related Forms

Figure 64 Vehicle details

In the above picture, there are three types of forms together. They are vehicle type, Vehicle,
Vehicle service. The company can store what kind of vehicles they have through the vehicle
type form. The vehicle form is used to save information about each and every vehicle and
vehicle service form is used to control the maintenance of the vehicles. So these three forms
are playing a major role in maintaining the vehicle details.

Miss. Tharshana Thevaraj Unit 01 Programming Page 83


BAT/A-005817
4.1.5.2 Vehicle Related Tables of Database

Figure 65 Table for vehicle related forms

Like the vehicle-related form, there are vehicle-related tables in the database of the company.
These tables are used to store the details of the vehicles and they are interconnected with each
other. These pictures show how data does store in them.

4.1.6 Rent Activity


4.1.6.1 Rent Related Forms

Figure 66 Rent information

The picture above includes interfaces of three forms. They are rent, rent type, and rent
payment. The whole details about the renting activity are stored in the system through these
forms. The user of the system can retrieve the data from here.

Miss. Tharshana Thevaraj Unit 01 Programming Page 84


BAT/A-005817
4.1.6.2 Rent Related Tables in Database

Figure 67 Table of rent related forms

The above picture shows the tables in database of rent details. Through the form, the rent
details can be inserted, updated, or deleted. Not only that but also the user can retrieve details.
There is an option called ‘Allow Null’ in one of the columns of rent payment. From this the
customer can rent vehicle without driver. That’s why this option is enable for driver charge
column.

4.1.7 Hire Activity

4.1.7.1 Hire Related Forms

Figure 68 Hire Information

Miss. Tharshana Thevaraj Unit 01 Programming Page 85


BAT/A-005817
There are three forms merged together in the above picture. They are, hire, other charges, hire
package, and hire payment. The user of the system can store the hire duration. Not only that
but also the details of the packages that were chosen by the customers also can be stored. If
there are any extra charges, there is the facilitation to save the details of that. If the company
wished to add a special hire package there is a form called hire package to store the details.
When the customers return the vehicle back to the company there is a form called hire
payment to manage the details.

4.1.7.2 Hire Related Tables of Database

Figure 69 Tables for Hire

The above picture shows the hire related tables. These tables help to retrieve the data when
the user need them.

Miss. Tharshana Thevaraj Unit 01 Programming Page 86


BAT/A-005817
4.1.8 Tour and Rate

4.1.8.1 Tour and Rate Related Forms

Figure 70 Rate and Tour forms

The above picture shows interfaces of two forms. One is tour type and the second one is the
rate. These forms are used to maintain the traveling km and the charges for km. these details
are used in calculating the hire payment.

4.1.8.2 Tour and Rate Related Tables of Database

Figure 71 Tables for rate and tour forms

These tables are the tables of rate and tour. these tables are used to store the new tour types.
Not only that but also, the details of the allocation of the charges.

Miss. Tharshana Thevaraj Unit 01 Programming Page 87


BAT/A-005817
4.1.9 Application Execution

This application designed for a company called 'Ayubo'. The main purpose of the
implementation of the application is to maintain the day to day activities of the company. The
main three activities are, insert, update, and delete. So, the function should be run accurately.
There some automation way calculations in this application. They are, hire calculations and
rent calculations. The following statement describes how the functions happen.

4.1.9.1 Main Function

Figure 72 Main function

The above picture shows the main function. The insert, update and delete functions will be
worked based on this code. According to the user pressing button, the enum function will be
changed. The inserted details will be passed as a parameter to the main function when the
user presses the insert button. This method helps to show a proper message to the user.

Miss. Tharshana Thevaraj Unit 01 Programming Page 88


BAT/A-005817
Then another parameter will be passed to the main function. That is SQL. This SQL contains
the information about the specification of the function which is going to execute inside. The
main function will be reacted based on the SQL. After that, the SQL parameter will be
assigned to the SQL. Then connection of the Database will get in to assign to variable 'con'.
After that, the transmission of data can be done between the interfaces and the database
through the open connection. Whereas the connection open, the SQL sent to the database as
SQL Command. The query will be executed through this query. In case any columns
influenced by that query, the message box appears the success message. Otherwise, an error
message will appear. These are the activities of the main function.

4.1.9.2 Insert Function

This function is used to store the details in the company's database. This procedure happens
through the application.

Figure 73 Data insert

Miss. Tharshana Thevaraj Unit 01 Programming Page 89


BAT/A-005817
The above picture shows the function of the insert. After filling all the text boxes, if the user
presses the insert button the details will be saved in the table.

Figure 74 Insert function codes

Miss. Tharshana Thevaraj Unit 01 Programming Page 90


BAT/A-005817
This function is coded based on the 'commmon_fun'. This common_code id used for all three
functions (insert, update, delete) through the 'enum' function. after the user clicks the insert
function, this procedure will start. The query for this function is saved inside of the ‘save_fun’
function. The query passed into the main code parameter ‘sql’. The insert function will work
through this parameter.

4.1.9.3 Update Function

The update function is also working similar as the insert function. The code of them is the
difference between them.

Figure 75 Data update

Miss. Tharshana Thevaraj Unit 01 Programming Page 91


BAT/A-005817
Figure 76 Codes for update function

The update function will work according to the above code. This will happen through the
connection between the Sql query and the update function.

Miss. Tharshana Thevaraj Unit 01 Programming Page 92


BAT/A-005817
4.1.9.4 Delete Function

Figure 77 Delete function

The delete function is also works based on the main function. The code will be changed based
on the SQL query. If the query written for the insert, the insert function will be executed. If the
query is written for the update, the update function will be executed. Otherwise, the delete
function will be executed. According to the query which is passed to the main function, the
function will be executed.

Miss. Tharshana Thevaraj Unit 01 Programming Page 93


BAT/A-005817
Figure 78 Background code for the delete function

The function will be executed based on the above background code.

Miss. Tharshana Thevaraj Unit 01 Programming Page 94


BAT/A-005817
4.2 Debug

Regularly, the debugging handle begins as before long as code is composed and proceeds in
progressive stages as code is combined with other units of programming to create a computer
program item. In a huge program that has thousands and thousands of lines of code, the
investigating handle can be made simpler by utilizing techniques such as unit tests, code
audits, and pair programming. To recognize bugs, it can be valuable to see at the code's
logging and utilize a stand-alone debugger device or the debug mode of a coordinates
advancement environment (IDE). It can be accommodating at this point in the event that the
designer is recognizable with standard blunder messages. In the event that designers aren't
commenting enough when composing code, be that as it may, indeed the cleanest code can
be a challenge for somebody to debug. (Rouse, 2020)
Likewise, in Ayubo system also have a debugging method.

Figure 79 Debugging

When the programmer executes the code that he wrote, if there is any error the system will
automatically point out the error and will point out where the error is. Specifically, it shows
the location of the error.

Miss. Tharshana Thevaraj Unit 01 Programming Page 95


BAT/A-005817
4.2.1 Benefits of Debug

1. The programmer could easily identify the errors in the system.


2. The programmer could understand the reason for the error.
3. The solution for the error could be identified.
4. Debugging increase the efficiency of the system.
5. The system could be built accurately according to the given scenario.

Dubbing plays an important role in writing and executing a function. Because human could
make errors. If the system doesn't reveal the error message while the programmer writing the
code, the programmer will face difficulties while executing the program. At that moment it's
difficult to identify the errors from the bunch of codes. It is waste of time and energy. But
debugging method avoids these kinds of interruptions and difficulties.

Miss. Tharshana Thevaraj Unit 01 Programming Page 96


BAT/A-005817
4.3 Code Standard

They are an arrangement of strategies that can be characterized for a specific programming
language indicating a programming style, the strategies, & diverse methods. These methods
can be for different viewpoints of the program composed in that language. They can be
considered as basic qualities of program development. A coding standard makes beyond any
doubt that all the developers working on the venture are taking after certain indicated rules.
The code can be effortlessly caught on and legitimate consistency is kept up.
(multidots, 2020)

4.3.1Class organization

This class organization helps the developer to find out the errors in the code of a system.
developer makes a common code for all the forms and called within the entirety form, in the
event that he wants to change anything within the whole form he can effortlessly alter that
prerequisite within the common code. The class of the common code will change the
requirements in whole forms.

Miss. Tharshana Thevaraj Unit 01 Programming Page 97


BAT/A-005817
Figure 80 Class organization

Miss. Tharshana Thevaraj Unit 01 Programming Page 98


BAT/A-005817
The above pictures show how the class organization works.

4.3.2 Guidelines

Figure 81 Guidelines
The guidelines help the programmer to write the code effectively as well as everyone can
understand. The guide explains why the codes have been written. The developer can identify
how can upgrade the codes with the help of the guidelines.

Miss. Tharshana Thevaraj Unit 01 Programming Page 99


BAT/A-005817
4.3.3 Naming convention

Figure 82 Naming convention

Mainly naming convention is used to provide names for the variables. Some specific methods
can be handled by the programmer when he gives names for variables. Likewise, in the above
picture also there is a naming convention method.

4.3.4 Benefits of coding standard

• Enhanced Efficiency: It is regularly seen that the computer program developers


spend a bigger portion of their time in tackling those issues that seem to have been
avoided. Actualizing the coding standards would offer assistance to the group to
identify the issues early or indeed avoid them totally. This will increment proficiency
through the program process.
• Risk of project failure is reduced: Many times, it happens that IT ventures fall flat
due to issues whereas creating a computer program. Actualizing the coding guidelines
decreases numerous issues and the chance of venture disappointments.
• Minimal Complexity: In case a code is complex, there are higher chances of it being
powerless and blundered. Coding guidelines offer assistance within the advancement
of program programs that are less complex and, in this manner, diminish the blunders.
• Easy to Maintain: In case the coding guidelines are taken after, the code is reliable
and can be effectively kept up. Usually, since anybody can get it and can adjust it at
any point in time.

Miss. Tharshana Thevaraj Unit 01 Programming Page 100


BAT/A-005817
• Bug Rectification: It gets to be truly simple to find and adjust bugs within the
program in case the source code is composed in a consistent way.
• Cost-Efficient: A clear code gives the developers an opportunity to reuse the code at
whatever point required. This will profoundly diminish the cost alongside the
endeavors put within the improvement.
• A Comprehensive Look: In the event that the source code keeps up consistency, a
clear view of how code fits within the bigger application or fits into the company as
an entire.
(multidots, 2020)

Miss. Tharshana Thevaraj Unit 01 Programming Page 101


BAT/A-005817
Conclusion

This task was given according to the requirement of the company. The company provides
‘Rent a Car’ System for the customer. Here the customers can hire vehicle with driver or
without driver. According to the rent type, the charges will be changed. If there is any extra
kms, the extra charge will be added to the calculation. This is the short brief of the company’s
system. As a system developer I analyzed their basic requirement to build a system for the
company. Then I drew a basic diagram for the system.

After that I developed all the interfaces of their system. Then I started the back end
developing. For this, I used C#. Because there are many user-friendly features are in C#. Then
I developed all the calculation for the system. Here as a developer I used the collaboration of
programming paradigms. I used procedural programming, object-oriented programming and
the event-driven programming. I wrote the code according to the relationships between the
programming paradigms.

Then I finished the system and analyzed that. Whether analyzing, I found some error. The I
corrected all the errors with the debugging method. After that, I completed the system and
handed over to the company.

Miss. Tharshana Thevaraj Unit 01 Programming Page 102


BAT/A-005817
Self-criticism

From this assignment I improved my programming skills. I am sure that this will help in my
future. Because I learned more programming related concepts. I got a clear view in C#
language. Because while building a system for the Ayubo Rent a Car Service, errors were
appeared. To clear those errors, I analyzed the code more than three times. This method gave
a huge knowledge in programming concept. This assignment developed my professional
qualification. Because I built a system for a company and here, I played a role as developer.

I am sure when I go for an interview in future, these knowledges will help me to achieve my
goal. Not only that but also in my working field, this knowledge will help to get promotions
and reputation in future. So, I feel satisfied while doing this assignment.

Miss. Tharshana Thevaraj Unit 01 Programming Page 103


BAT/A-005817
Gantt Chart

Figure 83 Gantt chart

Miss. Tharshana Thevaraj Unit 01 Programming Page 104


BAT/A-005817
References
Anon., 2020. definitions.net/. [Online]
Available at: https://www.definitions.net/definition/dry+run
[Accessed 07 2020].

Bhatia, S., 2020. hackr.io. [Online]


Available at: https://hackr.io/blog/procedural-programming
[Accessed 07 2020].

codecademy, 2020. codecademy.com. [Online]


Available at: https://www.codecademy.com/articles/what-is-an-ide
[Accessed 07 2020].

Debnath, S., 2020. geeksforgeeks.org. [Online]


Available at: https://www.geeksforgeeks.org/analysis-algorithms-big-o-analysis/
[Accessed 07 2020].

linux.nist, 2019. xlinux.nist.gov. [Online]


Available at: https://xlinux.nist.gov/dads/HTML/bigOnotation.html
[Accessed 07 2020].

multidots, 2020. multidots.com. [Online]


Available at: https://www.multidots.com/importance-of-code-quality-and-coding-standard-
in-software-development/
[Accessed 07 2020].

multidots, 2020. multidots.com. [Online]


Available at: https://www.multidots.com/importance-of-code-quality-and-coding-standard-
in-software-development
[Accessed 07 2020].

MV, T., 2019. freecodecamp. [Online]


Available at: https://www.freecodecamp.org/news/what-exactly-is-a-programming-

Miss. Tharshana Thevaraj Unit 01 Programming Page 105


BAT/A-005817
paradigm/
[Accessed 07 2020].

MV, T., 2019. freecodecamp. [Online]


Available at: https://www.freecodecamp.org/news/what-exactly-is-a-programming-
paradigm/
[Accessed 07 2020].

Rail, P., 2018. freecodecamp.org. [Online]


Available at: https://www.freecodecamp.org/news/all-you-need-to-know-about-big-o-
notation-to-crack-your-next-coding-interview-9d575e7eec4/
[Accessed 07 2020].

Rouse, M., 2020. techtarget.com. [Online]


Available at: https://searchsoftwarequality.techtarget.com/definition/debugging
[Accessed 07 2020].

SoumyadeepDebnath, 2020. geeksforgeeks.org. [Online]


Available at: https://www.geeksforgeeks.org/analysis-algorithms-big-o-analysis/
[Accessed 07 2020].

technologyuk, 2020. technologyuk.net. [Online]


Available at: http://www.technologyuk.net/computing/software-development/software-
design/event-driven-programming.shtml
[Accessed 07 2020].

veracode, 2020. veracode.com. [Online]


Available at: https://www.veracode.com/security/integrated-development-environment
[Accessed 07 2020].
Walker, A., 2020. learn.g2.com. [Online]
Available at: https://learn.g2.com/ide
[Accessed 07 2020].

Miss. Tharshana Thevaraj Unit 01 Programming Page 106


BAT/A-005817
Miss. Tharshana Thevaraj Unit 01 Programming Page 107
BAT/A-005817
Grading Rubric

Grading Criteria Achieved Feedback

LO1 Define basic algorithms to carry out an operation


and outline the process of programming an
application.

P1 Provide a definition of what an algorithm is and outline


the process in building an application.

M1 Determine the steps taken from writing code to


execution.

D1 Examine the implementation of an algorithm in a suitable


language. Evaluate the relationship between the written
algorithm and the code variant

LO2 Explain the characteristics of procedural, object


orientated and event-driven programming, conduct an
analysis of a suitable Integrated Development
Environment (IDE)

Miss. Tharshana Thevaraj Unit 01 Programming Page 108


BAT/A-005817
P2 Give explanations of what procedural, object orientated,
and event driven paradigms are; their characteristics and the
relationship between them.

M2 Analyze the common features that a developer has


access to in an IDE.

D2 Critically evaluate the source code of an application


which implements the programming paradigms, in terms of
the code structure and characteristics.

LO3 Implement basic algorithms in code using an IDE.

P3 Write a program that implements an algorithm using an


IDE.

M3 Use the IDE to manage the development process of the


program.

D3 Evaluate the use of an IDE for development of


applications contrasted with not using an IDE.

Miss. Tharshana Thevaraj Unit 01 Programming Page 109


BAT/A-005817
LO4 Determine the debugging process and explain
the importance of a coding standard

P4 Explain the debugging process and explain the


debugging facilities available in the IDE.

P5 Outline the coding standard you have used in your code.

M4 Evaluate how the debugging process can be used to


help develop more secure, robust applications.

D4 Critically evaluate why a coding standard is necessary in


a team as well as for the individual.

Miss. Tharshana Thevaraj Unit 01 Programming Page 110


BAT/A-005817
Miss. Tharshana Thevaraj Unit 01 Programming Page 111
BAT/A-005817

You might also like