0% found this document useful (0 votes)
152 views166 pages

Higher Nationals: Internal Verification of Assessment Decisions - BTEC (RQF)

The document discusses an internal verification of assessment decisions for a student named Mohamed Ramzeen Safwan completing an assignment for the Higher National Diploma in Computing program. It includes details of the assignment, the assessment criteria being evaluated, the assessor's comments and verification by an internal verifier.

Uploaded by

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

Higher Nationals: Internal Verification of Assessment Decisions - BTEC (RQF)

The document discusses an internal verification of assessment decisions for a student named Mohamed Ramzeen Safwan completing an assignment for the Higher National Diploma in Computing program. It includes details of the assignment, the assessment criteria being evaluated, the assessor's comments and verification by an internal verifier.

Uploaded by

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

Higher Nationals

Internal verification of assessment decisions – BTEC (RQF)

INTERNAL VERIFICATION – ASSESSMENT DECISIONS

Programme title Higher National Diploma in Computing

Ms. Irani

Assessor Internal Verifier

Unit(s)

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 1


Assignment title

Mohamed Ramzeen Safwan

Student’s name

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?

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 2


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


accurately?

Y/N

Is the feedback to the student:


Give details:
Constructive?

Linked to relevant assessment criteria? Y/N


Y/N
Y/N
Y/N

Identifying opportunities for


improved performance?
Agreeing actions?

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 3


Does the assessment decision need
amending?

Y/N

Assessor signature Date

Internal Verifier signature Date

Programme Leader signature (if required)

Date

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 4


Confirm action completed

Remedial action taken

Give details:

Assessor signature Date

Internal Verifier
signature

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 5


Date

Programme Leader
signature (if required)

Date

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 6


Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 7
Higher Nationals - Summative Assignment Feedback Form

Student Name/ID Mohamed Ramzeen Safwan

Unit Title Programming

Assignment Number 01 Assessor Ms. Irani

22/04/2022 Date Received 1st


submission

Submission Date

Date Received 2nd


submission

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 8


Re-submission Date

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

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 9


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:

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 10


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

Formative Feedback: Assessor to Student

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 11


Action Plan

Summative feedback

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 12


Feedback: Student to Assessor

Assessor Date
signature

Student Date
signature

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 13


Pearson Higher Nationals in

Computing

Unit 01: Programming


Assignment 01

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 14


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 make sure all the details are accurately filled.
2. Attach this brief as the first section of your assignment.
3. All the assignments should be prepared using a word processing software.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 15


4. All the assignments should be printed on A4 sized papers. Use single side printing.
5. Allow 1” for top, bottom , right margins and 1.25” for the left margin of each page.

Word Processing Rules

1. The font size should be 12 point, and should be in the style of Time New Roman.
2. Use 1.5 line spacing. Left justify all paragraphs.
3. Ensure that all the headings are consistent in terms of the font size and font style.
4. Use footer function in 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 editing
your assignment.

Important Points:

1. It is strictly prohibited to use textboxes to add texts in the assignments, except for the
compulsory information. eg: Figures, tables of comparison etc. Adding text boxes in the body
except for the before mentioned compulsory information will result in rejection of your
work.
2. Carefully check the hand in date and the instructions given in the assignment. Late
submissions will not be accepted.
3. Ensure that you give yourself enough time to complete the assignment by the due date.
4. Excuses of any nature will not be accepted for failure to hand in the work on time.
5. You must take responsibility for managing your own time effectively.
6. 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.
7. Failure to achieve at least PASS criteria will result in a REFERRAL grade .
8. Non-submission of work without valid reasons will lead to an automatic RE FERRAL. You will
then be asked to complete an alternative assignment.
9. If you use other people’s work or ideas in your assignment, reference them properly using
HARVARD referencing system to avoid plagiarism. You have to provide both in-text citation
and a reference list.
10. If you are proven to be guilty of plagiarism or any academic misconduct, your grade could be
reduced to A REFERRAL or at worst you could be expelled from the course

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 16


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.

[email protected] 22/04/2022
Student’s Signature: Date:
(Provide E-mail ID) (Provide Submission Date)

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 17


Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 18
Higher National Diploma in Computing
Assignment Brief

Student Name /ID Number Mohamed Ramzeen Safwan

Unit Number and Title Unit 01: Programming

Academic Year 2021/22

Unit Tutor

Assignment Title Design &Implement a GUI based system using a suitable


Integrated Development Environment

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 19


Issue Date 02/01/2022

Submission Date 22/04/2022

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

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 20


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.

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

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 21


Assignment Brief and Guidance:

Activity 1

A. The Fibonacci numbers are the numbers in the following integer sequence.
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ……..
In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence
relation.
Fn = F n-1 + F n-2

B. Factorial of a non-negative integer, is multiplication of all integers smaller than or equal


to n. For example, factorial of 6 is 6*5*4*3*2*1 which is 720.
n! = n * (n - 1) * …….. 1

Define what an algorithm is and outline the characteristics of a good algorithm. Write the
algorithms to display the Fibonacci series and the factorial value for a given number using
Pseudo code. Determine the steps involved in the process of writing and executing a
program.
Take a sample number and dry run the above two algorithms. Show the outputs at the end
of each iteration and the final output. Examine what Big-O notation is and explain its role in

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 22


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 Explain what is meant by a Programming Paradigm and the main characteristics
of Procedural, Object oriented and Event-driven paradigms and the relationships
among them. Write small snippets of code as example for the above three
programming paradigms using a suitable programming language(s). you also need to
critically evaluate the code samples that you have given above in relation to their
structure and the unique characteristics.

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

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

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 23


(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 typeif that is applicable for that type of vehicle.For each package
maximum km limit and maximum number of hours arealso 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.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 24


Activity 3

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.

Write suable algorithms for vehicle tariff calculation for rents and hires. Ideally 3
functions should be developed for this purpose as above. Use the visual studio IDE
(using C#.net) to Implement the above algorithms 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.
Analyze the features of an Integrated Development Environment (IDE) and explain how
those features help in application development. Evaluate the use of the Visual
StudioIDE for your application development contrasted with not using an IDE.

Activity 4

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 25


2.1 Design and build a small system to calculate vehicle hire amounts and record them in a
database for customer billing and management reporting forAyubo 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.

2.2 Explain debugging process and 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.

2.3 Outline 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.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 26


Acknowledgement

I would like to express my special gratitude towards Miss Irani for her guidance and support
which she provided me with for the completion and submission of this Programming

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 27


assignment. This would not have been possible without the appropriate guidance and
motivation I received.

Thank You,
M.R.Safwan

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 28


Table of Contents

Activity 01...............................................................................................................................16
1.1 Algorithm..........................................................................................................................16

1.1.1 Characteristics of a great algorithm...........................................................................16


1.1.2 Algorithms to display the Fibonacci series and the factorial value for a given number
using Pseudocode...............................................................................................................16

1.1.2.1 Fibonacci Numbers.............................................................................................16


1.1.2.2 Factorial Numbers.............................................................................................. 18

1.2 Steps involved in the process of writing and executing a program..................................19


1.3 Taking a sample number to dry run the above two algorithms........................................19
1.4 Big-O notation.................................................................................................................. 22

1.4.1 Examining what Big-O notation is..............................................................................22


1.4.2 Python program code for the above two algorithms.................................................26
1.4.3 Critically evaluating the efficiencies of the python codes using Big-O notation........27

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 29


Activity 02...............................................................................................................................28

2.1.1 Programming Paradigm.............................................................................................28


2.1.2 The main characteristics of Procedural paradigms...............................................28
2.1.3 The main characteristics of Object-oriented paradigms............................................31
2.1.4 The main characteristics of Event-driven paradigms.................................................36
2.1.5 The relationships among Procedural, Object-oriented and Event-driven paradigms.
........................................................................................................................................... 36
2.1.6 Snippets of code........................................................................................................37

2.1.6.1 Snippets of code as example for the above three programming paradigms using
a suitable programming language(s)..............................................................................37
2.1.6.2 Snippets of code as example for Object oriented programming paradigms using
a suitable programming language(s)..............................................................................38
2.1.6.3 Snippets of code as example for Event-driven programming paradigms using a
suitable programming language.....................................................................................40

2.1.7 Critically evaluating the code samples given above in relation to their structure and
unique characteristics........................................................................................................ 41

2.1.7.1 Critically evaluating the snippets of code given as examples for Procedural
programming..................................................................................................................41
2.1.7.2 Critically evaluating the snippets of code given as example for Object oriented
programming..................................................................................................................41

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 30


2.1.7.3 Critically evaluating the snippets of code given as example for Event-driven
programming..................................................................................................................41

Activity 03...............................................................................................................................42
3.1 Suitable algorithms for vehicle tariff calculation for rents and hires...........................42

3.1.1 Function 1: Rent calculation......................................................................................42


3.1.2 Function 2: Day tour - Hire calculation......................................................................43
3.1.3 Function 3: Long tour - Hire calculation.....................................................................44

3.2 Evidence of using visual studio IDE (using C#.net) to implement the above algorithms and
the design of suitable database structure to store the tariffs for vehicle types and different
packages.................................................................................................................................45

3.2.1 Tables to store the packages tariffs for vehicle types.................................................45


3.2.2 Visual studio IDE (C#.net) Implementation of the above algorithms.........................49

3.3 Integrated Development Environment (IDE)....................................................................55

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 31


3.3.1 Features of IDEs................................................................................................... 55
3.3.2 How these features in an Integrated Development Environment (IDE) help in
application development....................................................................................................56
3.3.3 Visual Studio IDE.................................................................................................. 57
3.3.4 Using Visual Studios IDE vs not using an IDE........................................................58

Activity 04...............................................................................................................................61
4.1 Designing and building a small system to calculate vehicle hire amounts and record them
in a database for customer billing and management reporting for Ayubo drive...................61

4.1.1 Login Page..................................................................................................................61


4.1.2 Main Menu Page........................................................................................................62
4.1.3 Package Details Page.................................................................................................63
4.1.4 Database table for login details............................................................................64
4.1.5 Rent Packages page..............................................................................................64
4.1.6 Day Tour Hire Package Page......................................................................................67
4.1.7 Long Tour Hire Package Page.....................................................................................69
4.1.8 Day Tour Packages page.......................................................................................71
4.1.9 Long Tour Package Page............................................................................................74
4.1.10 Rent Vehicle Page....................................................................................................77

4.2 The debugging process and the features available in Visual studio IDE for debugging....79

4.2.1 The debugging process.........................................................................................79

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 32


4.2.2 Features available in Visual studios IDE to debug................................................80
4.2.3 Using the debugging process to develop more secure, robust application..........82

4.3 Coding standards.........................................................................................................85

4.3.1 Some common coding standards.........................................................................85


4.3.1.1 The coding standards that I have used in my application development.................87
4.3.2 Critically evaluating why a coding standard is necessary for the team as well as for
the individual......................................................................................................................89

Annexures.............................................................................................................................. 90
Refernces................................................................................................................................93

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 33


Table of Figures

Figure 1 Fibonacci Numbers – Flowchart................................................................................20


Figure 2 Factorial Numbers – flowchart.................................................................................21
Figure 3 Fibonacci Numbers – python code...........................................................................23
Figure 4 Fibonacci Numbers – python output........................................................................23
Figure 5 Factorial Numbers – python code.............................................................................24
Figure 6 Factorial Numbers – python output.........................................................................24
Figure 7 Big-O notation.......................................................................................................... 25
Figure 8 O(log(n)) Logarithmic code.......................................................................................26
Figure 9 O(log(n)) Logarithmic output...................................................................................26
Figure 10 O(n) Linear code..................................................................................................... 27
Figure 11 O(n) Linear output..................................................................................................27
Figure 12 O(n^2) Quadratic code........................................................................................... 28
Figure 13O(n^2) Quadratic output.........................................................................................28
Figure 14 Programming Paradigm..........................................................................................31
Figure 15 Procedural paradigms code....................................................................................32
Figure 16 Procedural paradigms output.................................................................................32
Figure 17 Structure of procedural oriented programs............................................................33
Figure 18 Object-oriented paradigms.....................................................................................34
Figure 19 OOP code ex........................................................................................................... 35
Figure 20 OOP output.............................................................................................................35
Figure 21 Encapsulation code ex............................................................................................37
Figure 22 Encapsulation output..............................................................................................37
Figure 23 Snippets of code ex 1..............................................................................................40
Figure 24 Snippets of code ex 1 output..................................................................................41
Figure 25 Snippets of code ex 2..............................................................................................41
Figure 26 Snippets of code ex 2 outputExample 2..................................................................41
Figure 27 Snippets of code ex 3..............................................................................................42
Figure 28 Snippets of code ex 3 output..................................................................................42

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 34


Figure 29 Rent packages table in database............................................................................48
Figure 30 Day tour – Hire packages table in database............................................................49
Figure 31 Long tour – Hire packages table in database..........................................................49
Figure 32 Rented Vehicle table...............................................................................................50
Figure 33 Day tour – Hired table............................................................................................ 50
Figure 34 Long tour – Hired table...........................................................................................51
Figure 35 Rent Package calculations 1....................................................................................52
Figure 36 Rent Package calculations 2...................................................................................52
Figure 37 Rent Package calculations 3...................................................................................53
Figure 38 Rent Package calculations 4...................................................................................53
Figure 39 Day tour – Hire calculations 1.................................................................................54
Figure 40 Day tour – Hire calculations 2.................................................................................54
Figure 41 Day tour – Hire calculations 3.................................................................................55
Figure 42 Day tour – Hire calculations 4.................................................................................55
Figure 43 Long tour – Hire calculations 1...............................................................................56
Figure 44 Long tour – Hire calculations 2...............................................................................56
Figure 45 Long tour – Hire calculations 3...............................................................................57
Figure 46 Long tour – Hire calculations 4...............................................................................57
Figure 47.................................................................................................................................62
Figure 48.................................................................................................................................62
Figure 49.................................................................................................................................63
Figure 50.................................................................................................................................63
Figure 51.................................................................................................................................63
Figure 52 Login Page...............................................................................................................64
Figure 53 Login Page code......................................................................................................65
Figure 54 Main Menu Page.....................................................................................................65
Figure 55 Main Menu Page code............................................................................................66
Figure 56 Package Details Page..............................................................................................67
Figure 57 Package Details Page code......................................................................................67
Figure 58 Database Table for Login Page................................................................................68
Figure 59 Rent package Page..................................................................................................68
Figure 60 get all data grid view from database code...............................................................69
Figure 61 Add button codes....................................................................................................69
Figure 62 Update button codes............................................................................................... 70

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 35


Figure 63 Search button codes................................................................................................70
Figure 64 Delete button codes.................................................................................................71
Figure 65 Day Tour Package Page...........................................................................................71
Figure 66 Get all data grid view from database code..............................................................72
Figure 67 Get total button calculation code............................................................................72
Figure 68 Generate Day Tour ID Auto Automatically code...................................................72
Figure 69 Click to hire button codes.......................................................................................73
Figure 70 Long Tour Hire Package Page..................................................................................73
Figure 71 Get all data grid view from database code..............................................................74
Figure 72 Get total button calculation code............................................................................74
Figure 73 Generate Long Tour ID Auto Automatically code..................................................74
Figure 74 Click to hire button codes.......................................................................................75
Figure 75 Day Tour Package Page...........................................................................................75
Figure 76 Get all data grid view from database code..............................................................76
Figure 77 Add button codes....................................................................................................76
Figure 78 Update button codes............................................................................................... 77
Figure 79 Delete button codes.................................................................................................77
Figure 80 Search button codes................................................................................................78
Figure 81 Long Tour Package Page.........................................................................................78
Figure 82 Add button codes....................................................................................................79
Figure 83 Update button codes............................................................................................... 79
Figure 84 Delete Button code.................................................................................................80
Figure 85 Search button codes................................................................................................80
Figure 86 Rent Vehicle Page...................................................................................................81
Figure 87 Get all data grid view from database code..............................................................81
Figure 88 Genarate Rent ID Auto Automatically code...........................................................82
Figure 89 Rent a vehicle button codes....................................................................................82
Figure 90.................................................................................................................................86
Figure 91.................................................................................................................................87
Figure 92.................................................................................................................................87
Figure 93.................................................................................................................................88
Figure 94.................................................................................................................................88
Figure 95 Name convection used eg:1....................................................................................91
Figure 96 Name convection used eg: 2...................................................................................91

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 36


Figure 97 Use of proper indentation eg.1................................................................................92
Figure 98 Use of proper indentation eg.2................................................................................92
Figure 99 Use of proper indentation eg.3................................................................................93
Figure 100 Rent Vehicle Page.................................................................................................94
Figure 101 Code for auto generate Rent ID 1.........................................................................94
Figure 102 Code for auto generate Rent ID 2.........................................................................95
Figure 103 Code to get data from the database and display in the data grid 1......................95
Figure 104 Code to get data from the database and display in the data grid 2......................95
Figure 105 Code for the back button......................................................................................95
Figure 106 Main Menu Page...................................................................................................96
Figure 107 Code for Logout Button........................................................................................96

Table of Tables

Table 1 Fibonacci Numbers – Algorithm output.....................................................................22


Table 2 Factorial Numbers – Algorithm output......................................................................24
Table 3 Big-O notation............................................................................................................25
Table 4 Classes and Objects....................................................................................................36
Table 5 Using Visual Studios IDE vs not using an IDE..............................................................61

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 37


Activity 01

1.1 Algorithm

 An algorithm is a fixed of instructions for solving a problem or undertaking a venture.

For example, an algorithm is a recipe, which encompasses specific instructions for making
ready a dish or a meal.

1.1.1 Characteristics of a great algorithm

 Input – An algorithm needs to have zero or greater properly described inputs.


 Output - An set of rules need to have 1 or more nicely described outputs and

Need to suit the preferred output.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 38


 Finiteness – Algorithms need to terminate after a finite quantity of steps.
 Feasibility – should be possible with the to be had assets.
 independent – An algorithm needs to have little by little guidelines which Have to be
impartial of any programming code.

1.1.2 Algorithms to display the Fibonacci series and the factorial value for a
given number using Pseudocode.

1.1.2.1 Fibonacci Numbers

 The Fibonacci numbers normally denoted Fn from a series. On this collection in

Each number is the sum of the 2 preceding ones. The collection is usually Starts
evolved from 0 and 1.
F n = Fn-1 + F n-2

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 39


Fibonacci Numbers – Flowchart

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 40


Figure 1 Fibonacci Numbers – Flowchart

Fibonacci Numbers – Algorithm

 Begin
 Step 01 - n1=0
 Step 02 - n2=1
 Step 03 - if n==1 then

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 41


 Step 04 - print a
 Step 05 - elif “X” in range (2,n)
 Step 06 - Set n3 = n1 + n2
 Step 07 - Set n1 = n2, n2 = n3
 Step 08 - Print n3
 Step 09 - Else
 Step 10 - Print n1 and n2
 End

1.1.2.2 Factorial Numbers

 The factorial of a non-negative integer denoted with the aid of n! is made from
all fantastic Integers are less than or the same as n.

n! = n*(n-1)*(n-2)*(n-3)*(n-4)

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 42


Factorial Numbers – flowchart

Figure 2 Factorial Numbers – flowchart

Factorial Numbers – Algorithm

 Begin
 Step 01 - Input Number Factorial = 1
 Step 02 - If number > 0 then
 Step 03 - Factorial = Factorial * Number
 Step 04 - Number = Number – 1
 Step 05 - Elif Number > 2

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 43


 Step 06 - Else Print Factorial
 Step 07 - endif
 End

1.2 Steps involved in the process of writing and executing a program

 Defining and Analyzing the Problem


 Designing the Algorithm
 Coding or Writing the Program
 Test Execution
 Debugging
 Final Documentation

1.3 Taking a sample number to dry run the above two algorithms

Fibonacci Numbers – Algorithm output

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 44


n1 n2 n3

0 1 1

1 1 2

1 2 3

2 3 5

3 5 8

5 8 13

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 45


8 13 21

13 21 34

21 34 55

34 55 89

55 89 144

Table 1 Fibonacci Numbers – Algorithm output

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 46


Fibonacci Numbers – python code and output

Figure 3 Fibonacci Numbers – python code

Figure 4 Fibonacci Numbers – python output

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 47


Factorial Numbers – Algorithm output

Number 6 5 4 3 2 1

Factorial 1 6 30 120 360 720

Table 2 Factorial Numbers – Algorithm output

Factorial Numbers – python code and output

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 48


Figure 5 Factorial Numbers – python code

Figure 6 Factorial Numbers – python output

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 49


1.4 Big-O notation

1.4.1 Examining what Big-O notation is

 Big-O notation is a mathematical notation that describes the restricting


behavior of a feature whilst the argument has a tendency closer to a particular
value or infinity.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 50


Figure 7 Big-O notation

Name Big O

Logarithmic O(log(n))

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 51


Linear O(n)

Log Linear O(n log(n))

Quadratic O(n^2)

Exponential O(2^n)

factorial O(n!)

Table 3 Big-O notation

O(log(n)) Logarithmic:

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 52


Figure 8 O(log(n)) Logarithmic code

Figure 9 O(log(n)) Logarithmic output

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 53


O(n) Linear:

Figure 10 O(n) Linear code

Figure 11 O(n) Linear output

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 54


O(n^2) Quadratic:

Figure 12 O(n^2) Quadratic code

Figure 13O(n^2) Quadratic output

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 55


i = int(input("Number: ")) #User input
#declaring variables
1.4.2
x = 0Python program code for the above two algorithms
y=1
c=0
Python program code Fibonacci series
z=0
#checking validity
if i < 0:
print("Invaild input")
#fibonacci 0 = 0
elif i == 0:
print("answer =", i)
#fibonacci 1 = 1
elif def
i ==fibona
1: (n):
if n == 0:
print("Fibonacci series = ", x, y)
return
#fibonacci 2 = 1 0
elif i ==elif
2: n == 1:
return 1
print("Fibonacci series = ", x, y, y)
elif n == 2:
#fibonacci series from 3 onwards
else: return 1
print("Fibonacci series = ")
while c <= i:
print(x)
z=x+y
x=y
Mohamed Ramzeen
y=z Safwan – HND in Computing |Programming Assignment 01 56
else:
return fibona (n - 1) + fibona (n -2)

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 57


Python program code factorial value

def facto (n):


if n == 0:
return 1
elif n == 1:
return 1
else:
return facto (n - 1) * n

x = int(input("input no: "))

1.4.3 Critically evaluating the efficiencies of the python codes using Big-O
notation

Critically evaluating the efficiency Python program code Fibonacci series

 To get the output for the input 1, no of step is 2 (checks through 1st and 2nd if
statements).
 To get the output for the input 2, no of step is 3(checks through 1st, 2nd and 3rd if
statements).

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 58


 To get the output for the input 3, no of step is 7 (checks through 1st, 2nd and 3rd if
statements then it goes to while statement 4 times to get output).
 To get the output for the input 4, no of step is 8 (checks through 1st, 2nd and 3rd if
statements then it goes to while statement 5 times to get output).
 To get the output for the input n, no of step is n + 3 (checks through 1st, 2nd and 3rd
if statements then it goes to while statement n times to get output).
 So, the efficiency of the code is (the running time or no of steps) n + 3.

Activity 02

2.1.1 Programming Paradigm


Paradigms are problem-solving techniques. Programming paradigms are strategies for
solving issues with the help of a programming language. When a programming language is
implemented, it employs some approach or strategy. A paradigm is a technique or
methodology that is used. Imperative and Declarative paradigms are the two sorts of
paradigms.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 59


Figure 14 Programming Paradigm

2.1.2 The main characteristics of Procedural paradigms


The procedural programming paradigm is a programming method that supports the division
of functions into a series of events. A huge program is split down into smaller, more
manageable pieces, which are referred to as procedures or functions. Functions are given
precedence over data. In a procedural programming language, a program is essentially a set
of instructions that informs the computer what to do, such as reading user input, executing
the necessary calculation, and presenting the results.

Examples:-

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 60


Figure 15 Procedural paradigms code

Figure 16 Procedural paradigms output

There are two sorts of data in procedural programming: local and global. Local data is data
that is contained within a function, while global data is data that is not included within any
function. The only function where local data is stated has access to it. As a result, each
function has access to both local and global data.

One function's local data cannot be accessible by other functions. Data should be made
global if it is to be accessible by two or more functions. Another programmer cannot easily
update global data without first understanding what it is. Because data and functions are
separated, the procedural programming technique does not completely represent a real-
world system.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 61


The following are some programming languages that can be used to achieve procedural
programming:
COBOL, FORTRAN, C, and Pascal. (Anon., n.d.)

Figure 17 Structure of procedural oriented programs

Characteristics of Procedural Programming

 A huge program can be broken down into smaller, more manageable components
known as procedures or functions. This reduces code duplication, which improves
a code's readability and maintainability.
 Data can be shared between functions using global variables. Because functions
are very segregated, we must declare data in the upper scope to share it.
 Global data is passed from one function to the next. In function chains, global data

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 62


is changed during transformation, allowing functions to change global data.
 Procedural programming employs a top-down approach. As a result, the workflow
is completed from top to bottom. (Anon., n.d.)

Advantages of procedural programming

 Coding is easy and simple.


 The same codes can be reused in different parts of the program.
 Programming paradigm take less memory on the computer
 Tracking the flow of codes is easy.
 The programming paradigm is best for to learning and implementing general
programming. (Anon., n.d.)

Disadvantages of procedural programming

It is focused on functions and not data.


It is hard to find what belongs to global data in a large program.
When maintaining and enhancing, the use of global data is an obstacle.
To modify global data, functions used by it also have to be modified.
As functions are action oriented, the procedural programming paradigm does not model
real-world problems well. (Anon., n.d.)

2.1.3 The main characteristics of Object-oriented paradigms.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 63


Figure 18 Object-oriented paradigms

Object-Oriented Programming (OOP) is a programming paradigm that links data


structures to a set of operators that manipulate the data. An object is a representation of one
of these entities. To put it another way, OOP is an implementation method in which
programs are made out of objects. Each of these objects is an instance of a certain class. All
members of a hierarchy of classes are bound together by the concept of inheritance.
(Anon., n.d.)

Examples of OOP languages are C++, C#, Java, JavaScript, Visual Basic.NET and Python.
All OOP languages have mechanisms that help to implement the object-oriented model. They
are encapsulation, inheritance, polymorphism and reusability.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 64


Here is an example for OOP using Python (Anon., n.d.)

Figure 19 OOP code ex

Figure 20 OOP output

Classes and Objects

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 65


We can utilize templates called classes to generate things. Each object has data and methods
for accessing and manipulating data. A class defines the data and functionalities that each
object holds.

There are two parts to a class: the header and the body. The header includes attributes,
modifiers, and the class keyword, whereas the body contains the class's members, which
include data members and member functions.
A class declaration is made up of two parts: a class header and a class body. Attributes,
modifiers, and the class keyword are all included in the class header. The members of the
class, including the data members and member functions, are encapsulated in the class body.
A class declaration has the following syntax:
Modifiers for accessibility attributes: base list { body }

Like adjectives, attributes provide additional context to a class; for example, the Serializable
attribute. The visibility of a class is defined as its accessibility. A class's default accessibility
is internal. The default access level for class members is private. The accessibility keywords
are included in the table below (Anon., n.d.)

Keyword Description
public Visible in the current and referencing
assembly.
private Visible inside current class.
protected Visible inside current and derived class.
Internal Visible inside containing assembly.
Internal protected Visible inside containing assembly and
Descendent of the current class.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 66


Table 4 Classes and Objects

(Anon., n.d.)

Encapsulation

Encapsulation is a mechanism for combining and coding the data it manipulates. It protects
them from outside intrusion and mistreatment. In OOP, code and data can be mixed to create
a self-contained box. When data and code are integrated in this way, an object is formed, and
encapsulation is achieved.
To their object, a code, data, or both can be private or public. Another portion of the same
object can only access a private code or data; a program running outside of it cannot access it.
When a code or data is public, however, other sections of the program outside of its object
can access it.

An example code using Python; (Anon., n.d.)

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 67


Figure 21 Encapsulation code ex

Figure 22 Encapsulation output

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 68


Inheritance

Inheritance is the process by which one object gains the properties of another. There is a base
class and a derived class in inheritance. The derived class inherits from the base class and has
the ability to override and add new members to extend the base class. A base type denotes a
generalization, whereas a derived type denotes an instance specification. (Anon., n.d.)

Polymorphism

Various items are processed in the same way under polymorphism. This is one of the
advantages of inheritance. Based on the derived type of the base reference, we can determine
the proper call at runtime. This is referred to as late binding. (Anon., n.d.)

Reusability

Reusability refers to the ability to deliver a class that has been written, produced, and
debugged to other programmers to use in their own projects. This is referred to as a
component or a DLL in.NET. In OOP, inheritance extends this concept (Reusability),
allowing a programmer to use an existing class and add new functionality to it without
changing it. (Anon., n.d.)

Advantages & Disadvantages of OOP

Advantages

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 69


 Using techniques such as inheritance and templates to eliminate repetitive code.
 Data encapsulation: this allows programmers to hide sections of the code or restrict
data access in areas of a program, so making it more secure.
 Eliminate code duplication.

Disadvantages

 Because object-oriented programs take longer to compile and require more resources
and processing time for dynamic and runtime support, compiler and runtime overhead
is considerable.
 Tracing and debugging messages travelling across multiple objects in a complicated
program is tough.
 This necessitates mastery of software engineering and programming approaches by
programmers.

2.1.4 The main characteristics of Event-driven paradigms

The execution of a program in event-driven programming is determined by user events such


as mouse clicks, keypresses and message passing from other programs, and so on.
Programmers in graphical user interfaces (GUIs) and applications that take actions based on
user inputs use event-driven programming. When an event is detected in an event-driven
program, the main loop waits for it and calls a callback function.
Java, C++, C#, and other programming languages leverage event-driven paradigms.

Characteristics Of Event-driven Programming

 Service-Oriented Programming - In event-driven programming, programs are written


for services that do not require the use of the computer.
 Time-based — Codes can be written to perform a specific task in a specific amount of
time.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 70


 Trigger Functions - coding functions that determine which code to execute based on
the occurrence of an event.
 Events - these are the ones that determine which code should be executed based on
user interaction, such as mouse clicks.

(Anon., n.d.)

2.1.5 The relationships among Procedural, Object-oriented and Event-driven


paradigms.

Procedural programming is an imperative programming style in which a huge program is


broken down into smaller, more manageable pieces. To put it another way, procedural
programming is when a series of instructions are supplied to a computer step by step, along
with instructions on how to carry out the instructions from one code to the next. (Anon., n.d.)
Object-oriented programming treats the entire world as a collection of objects. An object
contains information about the modelled item's state and behavior. A state refers to the
qualities or phrases that can be used to describe an object, whereas behavior refers to the
things or activities that an object can accomplish. Encapsulation, inheritance, polymorphism,

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 71


and reusability are all important characteristics of an object-oriented program. (Note: these
key features are discussed in 2.1.3 The main characteristics of Object-oriented paradigms).
In contrast to procedural programming, object-oriented applications use classes instead of
procedures. Object-oriented programming examines and overcomes the challenges of
procedural programming. Procedural programming is useful for simple code since it makes it
easier and faster to implement, but it becomes difficult to use procedural programming as the
codes become more complicated, whereas object-oriented programming is good for complex
programming. (Anon., n.d.)
In event driven programming, systems are designed to respond to user inputs such as mouse
clicks. This paradigm is mostly used to construct graphical user interfaces (GUIs). An event
is triggered when the user clicks a button or types something (depending on the program).
(Anon., n.d.)
To summarize, the three paradigms discussed above are not technically related, although they
are frequently combined to build a complicated program (nested).

2.1.6 Snippets of code


2.1.6.1 Snippets of code as example for the above three programming paradigms using
a suitable programming language(s).

Here is a simple code for procedural programming paradigms using python,

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 72


Figure 23 Snippets of code ex 1

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 73


Figure 24 Snippets of code ex 1 output

2.1.6.2 Snippets of code as example for Object oriented programming paradigms using
a suitable programming language(s).

Here is a code for Object


oriented programming
paradigms using C# to find
the average of three numbers,

Example 1
Output :-

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 74


Figure 25 Snippets of code ex 2
Figure 26 Snippets of code ex 2 output

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 75


Example 2

Figure 27 Snippets of code ex 3

Output :-

Figure 28 Snippets of code ex 3 output

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 76


2.1.6.3 Snippets of code as example for Event-driven programming paradigms using a
suitable programming language.

Here is a simple code for Event-driven programming paradigms using C#,

private void button1_Click(object sender, EventArgs e)


{
//to catch the username and password string
username = TxtUsernameLogin.Text; string
password = TxtPasswordLogin.Text;

//condition to grant access


if (username == "Admin" && password == "Admin123")
{
//if the username and password, access is granted
MessageBox.Show("Welcome!!!", "Login Success!",
MessageBoxButtons.OK, MessageBoxIcon.Information);

this.Hide();

//redirecting to the next page


EmployeeDetails mm = new EmployeeDetails(); mm.Show();

}
else
{
// if username and passwords are wrong, an error message is shown
MessageBox.Show("Invalid usernaem or password! Please try again",
"Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 77


Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 78
2.1.7 Critically evaluating the code samples given above in relation to their
structure and unique characteristics.

2.1.7.1 Critically evaluating the snippets of code given as examples for Procedural
programming

In procedural programming, a problem is broken down into smaller manageable parts. The
example code is to find the sum of 3 inputs numbers given by a user. Here, the first step is
to get three inputs from users (x, y, z), then find the sum of all three numbers and finally
find the average by dividing the sum by 3. Then the outputs are the average, sum and the
number’s user has given as inputs.
As you can see, the problem is to find the average of three numbers, to get the required
output; the code is split into four parts as shown above to make it manageable.

2.1.7.2 Critically evaluating the snippets of code given as example for Object oriented
programming

As shown in the code, I have made an instance named ‘averageNumbers’ to find the average
of 3 numbers. Inside this instance I have written a code to find the sum of the 3 numbers
and find the average by dividing it by 3. Then inside Main where the codes run, the user
inputs are asked for 3 variables. Then I call the instance ‘averageNumbers’ with the 3 inputs
to find the average. In object-oriented, we can make objects as above and call them
whenever necessary (we don’t have to write the whole code over and over again).

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 79


2.1.7.3 Critically evaluating the snippets of code given as example for Event-driven
programming

In event-driven, as mentioned above, a program is executed after a user event like a mouse
click. The code I’ve given as an example is a code that gives a message “Welcome!” if the
user gives the correct username and password to log in and “Invalid username or password”
if the username or password is wrong. For this code to work, the user must insert the
username and password, then click login (mouse click and keyboard inputs).

Activity 03

2.2Suitable algorithms for vehicle tariff calculation for rents and hires

3.1.1 Function 1: Rent calculation.

An Algorithm for vehicle tariff calculation for rents calculations.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 80


Function RentCal
INPUT:- VehicleID, RentedDate, ReturnedDate, WithDriver
// SET variables
int NoOfTotalDays, months, RemainingDays, weeks, days, TotalAmount
START
// Calculate No Of Total Days
NoOfTotalDays = ReturnedDate – RentedDate
// Month Calculation
months = NoOfTotalDays / 30
// Calculate RemainingDays
RemainingDays = NoOfTotalDays – (months * 30)
// Weeks Calculation
weeks = RemainingDays / 7
// Days Calculation
days = RemainingDays – (weeks * 7)
// Get values of monthlyRate, weeklyRate, dailyRate, driverRate from database
If ( WithDriver == true )
TotalAmount = (month*monthlyRate) + (weeks*weeklyRate) + (days*dailyRate) +
(driverRate* NoOfTotalDays)
Else ( WithDriver == false )
TotalAmount = (month*monthlyRate) + (weeks*weeklyRate) + (days*dailyRate)
End If
// Printing Total Amount
Print (“Total Amount :” , TotalAmount)
END FUNCTION

3.1.2 Function 2: Day tour - Hire calculation.

An algorithm for vehicle tariff calculation for Day tour, Hire calculations.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 81


Function Day_tour_HireCal
INPUT:- VehicleID, Package_type, Start_time, End_time, StartKM, EndKM
// SET variables
int TotalNoOfHours, WiatingHours, WaitingFee, TotalKM, ExtraKM, ExtraKM_charge,
TotalAmount
START
// Get values of MaxHours, ExtraHourRate, MaxKM, ExtraKM_rate, PackageRate from
database
// Calculate Waiting Fee
If (VehicleID == true, Package_type == true)
TotalNoOfHours = End_time – Start_time
If (TotalNoOfHours > MaxHours)
WiatingHours = TotalNoOfHours – MaxHours
WaitingFee = WiatingHours * ExtraHourRate
Else
WaitingFee = 0
END If
// Calculate Total KM
TotalKM = EndKM – StartKM
// Calculate Extra KM charge
If (TotalKM > MaxKM)
ExtraKM = TotalKM – MaxKM
ExtraKM_charge = ExtraKM * ExtraKM_rate
Else
ExtraKM_charge = 0
END If
// Calculate Total amount
TotalAmount = PackageRate + ExtraKM_charge + WaitingFee
// Printing PackageRate, ExtraKM_charge, WaitingFee, TotalAmount
Print (“Base Hire Charge :” , PackageRate)
Print (“Extra KM charge :” , ExtraKM_charge)
Print (“Waiting Charge :” , WaitingFee)
Print (“Total Charge :” , TotalAmount)
Else
Print (“Vehicle & Package not found”)
END If
END FUNCTION

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 82


3.1.3 Function 3: Long tour - Hire calculation.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 83


Function Long_tour_HireCal
INPUT:- VehicleID, Package_type, Start_date, End_date, StartKM, EndKM
// SET variables
int TotalDays, NoOfKM, MaxKM, ExtraKM, ExtraKM_Charge, PackageCharge,
NoOfNights, OverNight_Charge, TotalAmount
START
// Get values of ExtraKM_Rate, PackageRate, Parking_Rate, DriverRate from database
//Calculate Total Days
TotalDays = End_date - Start_date
// Calculate No Of KM
NoOfKM = EndKM – StartKM
// Calculate MaxKM
MaxKM = TotalDays * NoOfKM

// Calculate Extra KM Charge


If (MaxKM > NoOfKM)
ExtraKM = NoOfKM – MaxKM
ExtraKM_Charge = ExtraKM * ExtraKM_Rate
Else
ExtraKM_Charge = 0
END If

// Calculate Package Charge


PackageCharge = PackageRate * TotalDays
// Calculate No Of Nights
NoOfNights = TotalDays – 1
// Calculate Over Night Charge
OverNight_Charge = (Parking_Rate + DriverRate) * NoOfNights
// Calculate Total Amount
TotalAmount = PackageCharge + ExtraKM_Charge + OverNight_Charge

// Printing PackageRate, OverNight_Charge, ExtraKM_Charge, TotalAmount


Print (“Base Hire Charge :” , PackageRate)
Print (“Over Night Stay Charge :” , OverNight_Charge)
Print (“Extra KM Charge :” , ExtraKM_Charge)
Print (“Total Amount :” , TotalAmount)

END FUNCTION

An algorithm for vehicle tariff calculation for Long tour, Hire calculations.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 84


3.2 Evidence of using visual studio IDE (using C#.net) to implement the
above algorithms and the design of suitable database structure to store the
tariffs for vehicle types and different packages

3.2.1 Tables to store the packages tariffs for vehicle types

1. Rent packages table in database.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 85


Figure 29 Rent packages table in database

2. Day tour – Hire packages table in database.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 86


Figure 30 Day tour – Hire packages table in database

3. Long tour – Hire packages table in database.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 87


Figure 31 Long tour – Hire packages table in database

4. Rented Vehicle table

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 88


Figure 32 Rented Vehicle table

5. Day tour – Hired table

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 89


Figure 33 Day tour – Hired table

6. Long tour – Hired table

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 90


Figure 34 Long tour – Hired table

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 91


3.2.2 Visual studio IDE (C#.net) Implementation of the above algorithms

1. Rent Package calculations using Visual Studio

(If driver parameter set yes)


Figure 35 Rent Package calculations 1

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 92


(If driver parameter set yes cont.…)
Figure 36 Rent Package calculations 2

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 93


(If driver parameter set no)
Figure 37 Rent Package calculations 3

(If driver parameter set no cont.…)


Figure 38 Rent Package calculations 4

2. Day tour – Hire calculations using Visual Studio

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 94


(Click check rates to get the hire charges)
Figure 39 Day tour – Hire calculations 1

(Click check rates to get the hire charges cont...)


Figure 40 Day tour – Hire calculations 2

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 95


(Click check rates to get the hire charges cont.…)
Figure 41 Day tour – Hire calculations 3

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 96


(Click check rates to get the hire charges cont.…)
Figure 42 Day tour – Hire calculations 4

3. Long tour – Hire calculations using Visual Studio

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 97


(Click on check rates to get total charges)
Figure 43 Long tour – Hire calculations 1

(Click on check rates to get total charges cont.…)


Figure 44 Long tour – Hire calculations 2

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 98


(Click on check rates to get total charges cont.…)

Figure 45 Long tour – Hire calculations 3

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 99


(Click on check rates to get total charges cont.…)
Figure 46 Long tour – Hire calculations 4

3.3 Integrated Development Environment (IDE)

An integrated development environment (IDE) allows programmers to write code, arrange


text groupings, and automate programming redundancies. IDEs, unlike traditional code
editors, combine the capabilities of numerous programming processes into a single
application. IDEs, as code editors, allow the addition of frameworks and element libraries to
extend the functionality of base-level code. The fundamental advantage of IDEs is that they
have built-in debuggers that enable a programmer to quickly find flaws or mistakes when
they are triggered. It also enables numerous programmers to design hierarchies and assign

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 100


grouped codes. The groups can then be connected, compiled, and built. (Anon., n.d.)

3.3.1Features of IDEs

 Text editor - Every IDE comes with a text editor that allows you to write and
manipulate code. Front-end components can be dragged and dropped in some IDEs.
 Debugger - This tool enables programmers to quickly find and solve faults and bugs
in their code. It also enables them to test various aspects of the program in order to
identify and correct issues.
 Compilers convert programming languages into machine-readable code.
 To verify accuracy, machine codes are examined. Compilers are able to parse and
optimize code in order to improve performance.
 Code completion — this function assists programmers in completing code by finding
and adding common code components. This saves time and reduces bugs when
writing code.
 Support for programming languages - IDEs give programmers the option of choosing
a programming language. They provide IDE tools for a variety of programming
languages, including Ruby, Python, and Java.
 Plugins and integrations - An IDE is a development gateway that integrates all of your
other development tools to help you improve your workflows and efficiency.
(Anon., n.d.)

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 101


3.3.2 How these features in an Integrated Development Environment (IDE) help
in application development

 It serves as a single environment for most of the needs of a developer such as version
control systems, debugging tools, and Platform-as-a-Service.
 Code completion capabilities can improve workflow of programming.
 It automatically checks for errors and bugs to ensure top quality code
 Refactoring capabilities help programmers to make comprehensive and mistake- free
name changes.
 Maintain a smooth development cycle.
 Increase developer efficiency and satisfaction
 Deliver top-quality software on schedule

According to the site https://www.g2.com/articles/ide, some of the best overall IDE in 2018
are,
• IntelliJ IDEA
• Visual Studio
• Eclipse
• RStudio
• WebStorm
• PhpStorm
• PyCharm
• NetBeans
• Xcode
• Visual LANSA

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 102


3.3.3 Visual Studio IDE

The Visual Studio IDE is a creative launching pad that allows programmers to edit, debug,
build code and publish them as an application. Compared to a code editor or any other IDEs
that provide standard editor and debugger, Visual Studios IDE provides compliers, code
completion tools, graphical designers, and many other features, which helps programmers
with the development process. (Anon., n.d.)

Some other features available in The Visual Studio IDE.

 Quick Actions and Squiggles - Squiggles are wavy underlining. They alert you to any
errors or issues with the code. They enable programmers to locate and rectify issues
without having to wait for the program to run. When you hover your mouse over the
Squiggle, information about the mistake appears. A light bulb may emerge in the left
margin, providing Quick Actions to correct the problem.
 Code Cleanup - Format your code and implement any code improvements suggested
by your code style preferences, editor config conventions, and Roslyn analyzers using
Code Cleanup. (Please note that this feature is presently only accessible for C# code.)
 Refactoring – This includes things like intelligent variable renaming, extracting one or
more lines of code into a new method, rearranging method parameters, and more.
 IntelliSense - This is a word for features in the editor that display information about
your code and, in some situations, write small portions of code for you.
 Visual Studio search - With this capability, you can find IDE features and code all in
one spot.
 Live Share - This feature allows you to share your project instantaneously and
securely.
 Call Hierarchy - this window displays the methods that call the method you have
selected. It is useful information if you need to update or remove a method, or if you
are looking for a bug.
 CodeLens - this tool allows you to search for code references, modifications,

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 103


connected bugs, work items, code reviews, and unit tests without leaving the editor.
 Go to Definition - this option brings you straight to the definition of a function or
type.
 Peek Definition - this window displays a method or type's definition without having to
open a separate file.

3.3.4 Using Visual Studios IDE vs not using an IDE.

Visual Studios IDE Not using an IDE


This allows programmers to access databases This allows writing, editing codes only,
or automatically write code to create a which doesn’t save time.
graphical user interface (GUI) and also
suggested ways to complete strings of
code which save a lot of time.

When developing extensive development Difficult to develop complex projects.


projects, Visual studios IDE features like
debugging, Code completion, etc helps in
completing it with ease compared to
normal text editors.
Visual studios IDE built to eliminate things Text editors (non-IDEs) so not have these
that cause pauses in your workflow, you don’tfeatures.
need to use the mouse because of the
shortcuts available.
When using languages like Java, IDEs are When using languages like PHP and Ruby,
much more effective. text editors are programmers choice.
Requires more space and memory. Requires less memory and space.

It is best to develop error free and secure Best to practice codes and requires more time
programs/ projects with less time due to the compared to IDEs.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 104


available features.
(Anon., n.d.)

Table 5 Using Visual Studios IDE vs not using an IDE

Here are a few examples on how using Visual studio IDE was better compared to not using
an IDE.

The features mentioned in ‘3.3.3 Visual Studio IDE’ helped to save time and make an
application better compared to not using an IDE.

Example 1:
The code completion feature helped a lot to save time typing variable already declared and
calling names of tools to code.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 105


Figure 47

Example 2:

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 106


Figure 48
The tools available makes it much easier to build GUIs.

Example 3:

Figure 49
A simple code allows programmers to connect to a database to build the application.

Example 4:
The text editor is user friendly as it shows where else a variable is assigned once clicked on
the variable.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 107


Figure 50

Example 5:

Figure 51
A red line shows most errors and once you hover on top of it, it shows the reason for error
as well which makes it much easier to find errors and debug before running the program.

Note: More uses of an IDE (debugging features) over not using an IDE are given under
‘4.2.3 using the debugging process to develop more secure, robust application’.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 108


Activity 04

4.1 Designing and building a small system to calculate vehicle hire


amounts and record them in a database for customer billing and
management reporting for Ayubo drive

4.1.1 Login Page

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 109


Figure 52 Login Page

Figure 53 Login Page code

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 110


4.1.2 Main Menu Page

Figure 54 Main Menu Page

Figure 55 Main Menu Page code

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 111


4.1.3 Package Details Page

Figure 56 Package Details Page

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 112


Figure 57 Package Details Page code

4.1.4 Database table for login details

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 113


Figure 58 Database Table for Login Page

4.1.5 Rent Packages page

Figure 59 Rent package Page

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 114


Figure 60 get all data grid view from database code

Figure 61 Add button codes

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 115


Figure 62 Update button codes

Figure 63 Search button codes

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 116


Figure 64 Delete button codes

4.1.6 Day Tour Hire Package Page

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 117


Figure 65 Day Tour Package Page

Figure 66 Get all data grid view from database code

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 118


Figure 67 Get total button calculation code

Figure 68 Generate Day Tour ID Auto Automatically code

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 119


Figure 69 Click to hire button codes

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 120


4.1.7 Long Tour Hire Package Page

Figure 70 Long Tour Hire Package Page

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 121


Figure 71 Get all data grid view from database code

Figure 72 Get total button calculation code

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 122


Figure 73 Generate Long Tour ID Auto Automatically code

Figure 74 Click to hire button codes

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 123


4.1.8 Day Tour Packages page

Figure 75 Day Tour Package Page

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 124


Figure 76 Get all data grid view from database code

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 125


Figure 77 Add button codes

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 126


Figure 78 Update button codes

Figure 79 Delete button codes

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 127


Figure 80 Search button codes

4.1.9 Long Tour Package Page

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 128


Figure 81 Long Tour Package Page

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 129


Figure 82 Add button codes

Figure 83 Update button codes

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 130


Figure 84 Delete Button code

Figure 85 Search button codes

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 131


4.1.10 Rent Vehicle Page

Figure 86 Rent Vehicle Page

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 132


Figure 87 Get all data grid view from database code

Figure 88 Genarate Rent ID Auto Automatically code

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 133


Figure 89 Rent a vehicle button codes

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 134


4.2 The debugging process and the features available in Visual studio IDE
for debugging

4.2.1 The debugging process

Debugging is the process of identifying and removing current and potential errors/bugs in
software code that might cause it to act abnormally or crash.
Debugging aids in the prevention of software flaws by discovering and resolving issues.
(Anon., n.d.)
"Fault localization" and "fault repair/bug fixing" are two processes in the debugging
process. A programmer may reproduce an issue in software code to determine the reason of
the error and then edit or eliminate the code to prevent it from occurring again. Both the
first and second steps take time and are challenging. The first stage is more crucial since in
order to correct an error, the problem must first be identified.
(Anon.,n.d.)

According to the site “The Economic Times”, the steps in a debugging process are,

 “Reproduce the problem.


 “Describe the bug. Try to get as much input from the user to get the exact reason.”

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 135


 “Capture the program snapshot when the bug appears. Try to get all the variable
values and states of the program at that time”
 “Analyze the snapshot based on the state and action. Based on that try to find the
cause of the bug.”
 “Fix the existing bug, but also check that any new bug does not occur”
(Anon.,n.d.)

Note: as I used Visual studios IDE, most of the problems were pointed out by the IDE and
the reason was given, so the steps I had to follow to debug my application were “fault
localization” and “fault repair” as shown below.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 136


4.2.2 Features available in Visual studios IDE to debug.

There are many forms of debugging namely “Stepping through the code with a debugger”,
“investigating logs”, “unit testing”, “profiling”, and “analyzing dumps”. Visual studio
focuses on “interactive debugging”, which means “attaching to a running process with a
debugger, and investigating the program’s execution and state”.

Here are some features available in visual studios for debugging.

• Attaching the debugger: Once you press F5 or “select Debug | Start Debugging”,
debugging will automatically run in Visual studios.
• Debugger Break Mode: For debugging, the debugged process must be in “Break
Mode”. This means the program can be paused for a said line of code, and all the running
threads are paused after a line of code. To get breaker mode, use “Debug
Break All menu item” or place break points. To place breaker points, press F9, or “Debug
Toggle Breakpoint”. Once a break point is set, the program will stop at that point and start
break mode.
While in Break Mode – Navigate through code: when in break mode, it is possible to you
debug interactively and see the execution of codes. Some of the features of navigation are,
“Continue (F5) will quit break mode and continue the program’s execution until the
next breakpoint is hit, entering break-mode again”.
“Step Over (F10) will execute the current line and break on the next line of code”
“Step Into (F11) is used when the next execution line is a method or a property. When
clicked, the debugger will step into the method’s code first
line. By default, properties are skipped. To enable stepping into property code, go to Tools |
Options | Debugging and uncheck Step over properties and operators”

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 137


“Run execution to here allows you to continue execution, and break in a specified location
without a breakpoint. It’s like creating a breakpoint and removing it after first break. You
can do it in 3 ways,
Hover and click on the green arrow that appears on the start of each line Stand on the
desired line of code and click Ctrl + F10
Right click on the desired line of code and click on Set next statement Run to a cursor
location allows you to forcefully set the next line of code to execute.”
“The current (yellow) line will not be executed. It can be a line that was executed before or
after, but it’s best for the new line of code to stay in the current scope. There are 2 ways to
do this:
Drag the yellow arrow to any line of code
Stand on the desired line of code and click Ctrl+Shift+F10”
• Investigate variables: When In break mode you can see the values of variables and
class members. Hovering over the variable lets you this via a pop-up, this is called “Data
tip”.
• DataTip and QuickWatch notable Features: this has useful features such as,
“Pinning DataTips – You can leave a DataTip pinned to the editor by clicking on the pin
icon. Useful when you hit the same breakpoint many times (maybe in a loop)”
Holding Ctrl will make the DataTip transparent
by right clicking on an expression in the DataTip, you can open a context menu with several
options namely,
Copy – Copies to clipboard both Expression and Value (alex ={DebuggingPillars.Person})
Copy Expression – Copies expression (alex)
Copy Value – Copies expression ({DebuggingPillars.Person})
Edit Value – A useful feature where you can change the value during debugging. Most
useful for primitives (strings, integers, etc.)
Add Watch – Adds expression to Watch window (more on that later)
Add Parallel Watch – Adds expression to Parallel Watch window (more on that later)

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 138


Make Object ID – Creates a scope-independent expression that starts with ‘$’ ($1, $2, and
so on). You can evaluate this expression at any time, regardless of the current scope, in
Quick Watch, Watch Window or the Immediate Window. A very useful feature and can be
used to detect memory leaks.
• Breakpoint advanced features: There are lesser-know features of breakpoint. To see
the context menu for it, you can right click a break. A few examples are given bellow,
Conditions allows you to break on this breakpoint only when a condition is met.
Actions allow you to log a message to the output window whenever the breakpoint is hit.
You can continue execution, without stopping on the breakpoint.
Edit labels… allows to categorize breakpoints into labels. This makes it easier later to
organize them in the breakpoints tool window.

Reference for the above: (Michael&#039 & Spot, n.d.)

4.2.3 Using the debugging process to develop more secure, robust application

Thanks to the features in Visual studios, it was easy to debug the application and make the
application a bug free secure application.
As mentioned above, in the debugging process, the most crucial part is “fault localization”.
Using the “select Debug | Start Debugging”, I was able to start debugging while running the
application and find the errors in my application and fix them.
Here are a few instances as such,

Case 1:

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 139


Figure 90
Here I have not placed the code ‘con.close();’ to close the connection at the end of the code
for check rates button in Long tour page. The debugger feature showed me this error while
running the application and after I placed the code (fixing the error), I simply restarted the
Application using the restart button to run the application again and the code worked
perfectly.
Case 2:

On the picture shown below, the variable ‘packagerates’ has not been initialized, which the
debugger showed instantly. I was able to save time and avoid bugs by identifying the error.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 140


Figure 91

Case 3:

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 141


Figure 92
In this case, the variable type for overnights in the database was int and in the code was
double. I had to change the type in the database as float to fix the error after identifying it

Case 4:

Figure 93
Here hoursOnly variable was an double and maxhours was a int. Thanks to the error
message, I was able to identify it and fix it by converting hours only to int by using the code
‘int totalhours = Convert.ToInt32(hoursOnly);’.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 142


Case 5:

Figure 94
Here the variable rendate was not declared instead it was rendte. I was able to avoid the
error when the red line showed and was able to fix it.

These are some of the many instances that I used the debugging process to debug the
application to develop more secure, robust application.

4.3 Coding standards

Good Software Developers and development organizations maintain some well-defined and
standard style of coding called coding standards. Organization / programmer, depending on
their needs, what suits their organization best and according to the type of software
developed, make coding standards. It is crucial to maintain coding standards because if
coding standards are not maintained, then the code maybe rejected during code review int
the organization.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 143


Purpose of Having Coding Standards

• Coding standard gives an uniform appearance to the codes written by different


programmers.
• It reduces complexity and improves readability, and maintainability of the code.
• It helps in code reuse and helps to detect error easily.
• It increases efficiency of the programmers.

4.3.1 Some common coding standards

• Limited use of global – This is about which types of data that can be declared global
and the data that can’t be.
• Standard headers for different modules – To understand and maintain the code in a
better way, the header of different modules should follow some standard format and
information. The header format must contain below things that is being used in various
companies,

Name of the module

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 144


• Date of module creation
• Author of the module
• Modification history
• Synopsis of the module about what the module does
• Different functions supported in the module along with their input
• output parameters
• Global variables accessed or modified by the module

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 145


 Naming conventions for local variables, global variables, constants and functions

– Names of variable should be meaningful and understandable as they help anyone


to understand the reason of using it. There are naming convections for local variable
global variables, constants and functions used by many programmers and
organizations. Some of them are,

1“Local variables should be named using camel case lettering starting with small letter
(e.g. localData) whereas Global variables names should start with a capital letter (e.g.
GlobalData). Constant names should be formed using capital letters only (e.g.
CONSDATA)”.
2 “Avoiding the use of digits in variable names”
3 “Names of function should be written in camel case starting with small letters”.
4 “Name of functions should describe the reason of using of clearly and briefly.”

 Indentation – To increase the code readability, proper indentation must be followed.


Some spacing/ indentation convections are,

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 146


A space must be left after giving a comma between two function arguments.
Each nested block should be properly indented and spaced
Proper Indentation should be there at the beginning and at the end of each block in the
program.
All braces should start from a new line and the code following the end of braces also start
from a new line.

• Coding style – A code should understandable. If the code is too complex, debugging
is difficult. Using coding styles that is too difficult to understand must be avoided.
• Do not using an identifier for multiple purposes - Descriptive and meaningful
names should be given for each variable that give the reason behind the name. If the same
variable name is used multiple times, it can lead to confusion and it would be difficult to
debug.
• Document codes – The codes should be properly documented in a way that is
easy to understand. Comments regarding the statements increase the understandability of the
code.
(Anon., n.d.)

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 147


4.3.1.1 The coding standards that I have used in my application development

As any programmer, I have used some coding standards to code my application. Some of
them are given below with examples.

Standard 1:

Naming conventions – The naming convections I have used in coding are,

 For tools, I have named them in a way that it shows the page it belongs to as well as
the type of tool it is and every word has a capital letter in the first letter (eg.
txtbxHireCharge – this is the text box for Daily rates in rent packages page).
 For local variable I’ve used names that are understandable and follow a pattern

(eg. BHcharge – Basic hire charge, exkmcharge – Extra KM charge).

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 148


Figure 95 Name convection used eg:1

Figure 96 Name convection used eg: 2

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 149


Standard 2:
Indentation – I have followed proper indentations and use of bracts for if else statements
and others to increase code readability and understandability.

Figure 97 Use of proper indentation eg.1

Figure 98 Use of proper indentation eg.2

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 150


Figure 99 Use of proper indentation eg.3

4.3.2 Critically evaluating why a coding standard is necessary for the team as
well as for the individual

Advantages using of coding standards.

• They increase the efficiency of the software and reduces the development time.
• They help in identification of errors in an early stage.
• They increase readability and understandability of a code while reducing the
complexity of the code.
• It reduces the hidden cost for developing the software. (Anon., n.d.)

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 151


When developing programs, it is necessary to think about time, cost, debugging and future
updates of it. Having certain standards when coding helps in those criteria. As mentioned
above, coding standards increase the efficiency and reduces the development time of a
software while helping us identify errors on an early stage.
These standards also make the code more readable and understandable, especially for other
developers who might do future updates or debug the errors that were not found initially. By
making it easier to read, understand and debug, the cost is reduced which effects the
company, group or individual in a positive way.
Therefore, as mentioned above, having certain coding standards help save time, cost and
make it easier to debug.

Annexures

1. Rent Vehicle Page

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 152


Figure 100 Rent Vehicle Page

2. Code for auto generate Rent ID.

Figure 101 Code for auto generate Rent ID 1

Figure 102 Code for auto generate Rent ID 2

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 153


3. Code to get data from the database and display in the data grid

Figure 103 Code to get data from the database and display in the data grid 1

Figure 104 Code to get data from the database and display in the data grid 2

4. Code for the back button

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 154


Figure 105 Code for the back button

Note: I have placed the back button in all pages except login and main menu pages. Note:
I have used the code “this.Hide();” to hide the current page when moving to another page.
5. Main menu page

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 155


Figure 106 Main Menu Page

6. Code for Logout Button

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 156


Figure 107 Code for Logout Button

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 157


Refernces

www.w3school.com
Anon., n.d. [Online]
Available at: https://medium.com/@bhattshlok12/characteristics-of-an-algorithm-
49cf4d7bcd9
[Accessed 20 08 2021]. Anon., n.d. [Online]
Available at: https://www.csharp-console-examples.com/pseudocode- examples/pseudocode-
to-calculate-factorial/
[Accessed 20 08 2021]. Anon., n.d. [Online] Available at:
https://www.tutorialspoint.com/learn_c_by_examples/fibonacci_non_recursive_program
_in_c.htm
[Accessed 20 08 2021]. Anon., n.d. [Online]
Available at: https://sciencerack.com/6-steps-of-program-development-process-with-
detailed-description/
[Accessed 20 08 2021]. Anon., n.d. [Online]
Available at: https://www.g2.com/articles/ide [Accessed 20 08 2021].
Anon., n.d. [Online]
Available at: https://jaxenter.com/ides-vs-text-editor-148936.html [Accessed 21 08 2021].
Anon., n.d. [Online] Available at:
https://economictimes.indiatimes.com/definition/debugging#:~:text=Definition%3A
%20Debugging%20is%20the%20process,to%20behave%20unexpectedly%20or
%20crash.&text=Description%3A%20To%20debug%20a%20program,problem%2C
%20and%20then%20fix%20it. [Accessed 21 80 2021].
Anon., n.d. [Online]
Available at: https://www.sciencedirect.com/topics/computer-science/debugging-process
[Accessed 24 08 2021].
Anon., n.d. [Online]
Available at: https://www.bbc.co.uk/bitesize/guides/z7kkw6f/revision/7 [Accessed 23 08
2021].
Anon., n.d. BBC Bitesize. [Online]
Available at: https://www.bbc.co.uk/bitesize/guides/z7kkw6f/revision/7 [Accessed 27 08
2021].
Anon., n.d. BBC Bitesize. [Online]
Available at: https://www.bbc.co.uk/bitesize/guides/zjdkw6f/revision/4 [Accessed 27 08
2021].
Anon., n.d. BBC Bitesize. [Online]
Available at: https://www.bbc.co.uk/bitesize/guides/zjdkw6f/revision/3 [Accessed 27 08
2021].
Anon., n.d. C-sharpcorner.com. [Online]
Available at: https://www.c-sharpcorner.com/UploadFile/84c85b/object-oriented-

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 158


programming-using-C-Sharp-net/
[Accessed 19 08 2021].
Anon., n.d. Docs.microsoft.com. [Online]
Available at: https://docs.microsoft.com/en-us/visualstudio/get-started/visual-studio-ide?
view=vs-2019
[Accessed 21 08 2021].
Anon., n.d. Experts mind. [Online]
Available at: http://www.expertsmind.com/questions/what-are-the-characteristics-of-a- good-
algorithm-3016102.aspx
[Accessed 20 08 2021].
Anon., n.d. GeeksforGeeks. [Online]
Available at: https://www.geeksforgeeks.org/coding-standards-and-guidelines/ [Accessed 21
08 2021].
Anon., n.d. Slideplayer.com. [Online]
Available at: https://slideplayer.com/slide/16031203/ [Accessed 20 08 2021].
Anon., n.d. StudyBay. [Online]
Available at: https://studybay.com/blog/event-driven-development-features/ [Accessed 20 08
2021].
Anon., n.d. The Economic Times. [Online]
Available at: https://economictimes.indiatimes.com/definition/debugging [Accessed 28 08
2021].
Anon., n.d. Tuan Nguyen's Blog. [Online]
Available at: https://www.tuannguyen.tech/2019/05/programming-paradigms-what-is-
procedural-programming/
[Accessed 11 08 2021].
Anon., n.d. Tuan Nguyen's Blog. [Online]
Available at: https://www.tuannguyen.tech/2019/06/programming-paradigms-is-object-
oriented-programming-better/
[Accessed 14 8 2021].
Michael&#039 & Spot, s., n.d. Michael's Coding Spot. [Online] Available at:
https://michaelscodingspot.com/debugging-part1/ [Accessed 27 08 2021].

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 159


Grading Rubric

Grading Criteria Achieved Feedback

LO1 Define basic algorithms to carry out an operation


and outline the process of programming an
application.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 160


P1Provide a definition of what an algorithm is and outline
the process in building an application.

M1Determine the steps taken from writing code to


execution.

D1 Evaluate 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,


objectorientated and event-driven programming,
conduct an analysis of a suitable Integrated

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 161


Development Environment (IDE)

P2Give explanations of what procedural, objectorientated,


and eventdriven paradigms are; their characteristics and the
relationship between them.

M2 Compare and contrast the procedural, object


orientated and event driven paradigms used in given
source code of an application

D2Critically evaluate the source code of an application which


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

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 162


LO3Implement basic algorithms in code using an IDE.

P3Write a program that implements an algorithm using an


IDE.

M3Use the IDE to manage the development process of the


program.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 163


D3Evaluate the use of an IDE for development of
applications contrasted with not using an IDE.

LO4 Determine the debugging process and explain


the importance of a coding standard

P4Explain the debugging process and explain the debugging


facilities available in the IDE.

P5Outline the coding standard you have used in your code.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 164


M4Evaluate 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.

Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 165


Mohamed Ramzeen Safwan – HND in Computing |Programming Assignment 01 166

You might also like