Sample Programming Assignment PDF

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

Higher Nationals

Internal verification of assessment decisions – BTEC (RQF)


INTERNAL VERIFICATION – ASSESSMENT DECISIONS

Programme title Btec Higher National Diploma in computing

Assessor Internal Verifier

Unit(s) Unit 01 Programming

Assignment title

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? Y/N

Is the Pass/Merit/Distinction grade awarded


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

Assessor signature Date

Internal Verifier signature Date


Programme Leader signature (if required)
Date

Unit 01: Programming 1


Assignment 01
Confirm action completed
Remedial action taken

Give details:

Assessor signature Date

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

Unit 01: Programming 2


Assignment 01
Higher Nationals - Summative Assignment Feedback Form
Student Name/ID
Unit Title Programming
Assignment Number 01 Assessor
08/08/2018 Date Received 1st
Submission Date
submission
Date Received 2nd
Re-submission Date
submission
Assessor Feedback:

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

Pass, Merit & Distinction Descripts P1 M1 D1

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

Pass, Merit & Distinction Descripts P2 M2 D2

LO3. Implement basic algorithms in code using an IDE.

Pass, Merit & Distinction Descripts P3 M3 D3

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

Grade: Assessor Signature: Date:


Resubmission Feedback:

Grade: Assessor Signature: Date:

Internal Verifier’s Comments:

Signature & Date:

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

Unit 01: Programming 3


Assignment 01
Assignment Feedback
Formative Feedback: Assessor to Student

Action Plan

Summative feedback

Feedback: Student to Assessor

Assessor Date
signature

Student Date
signature

Unit 01: Programming 4


Assignment 01
Pearson Higher Nationals in
Computing
Unit 01: Programming
Assignment 01

Unit 01: Programming 5


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

Word Processing Rules


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

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

Unit 01: Programming 6


Assignment 01
Student Declaration

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

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


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

Student’s Signature: Date:


(Provide E-mail ID) (Provide Submission Date)

Unit 01: Programming 7


Assignment 01
Higher National Diploma in Computing
Assignment Brief
Student Name /ID Number

Unit Number and Title Unit 01: Programming

Academic Year 2017/18

Unit Tutor

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

Issue Date 08/07/2018

Submission Date 08/08/2018

IV Name & Date

Submission Format

This submission will have 3 components

1. Written Report

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

2. Implemented System (Software)


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

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

Unit 01: Programming 8


Assignment 01
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

Unit 01: Programming 9


Assignment 01
Assignment Brief and Guidance:

Activity 1

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

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

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

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

Activity 2

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

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

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

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

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
Unit 01: Programming 10
Assignment 01
(WD), 7-seater van and Commuter van. New vehicle types are to be added in the future.

Vehicle rent and hire options are described below.

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

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

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

Activity 3

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

Ideally 3 functions should be developed for this purpose as follows:

Function 1: Rent calculation.


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

Function 2: Day tour - hire calculation.


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

Function 3: Long tour - hire calculation.


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

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

Unit 01: Programming 11


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

Activity 4

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

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

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

Unit 01: Programming 12


Assignment 01
Grading Rubric

Grading Criteria Achieved Feedback

LO1 Define basic algorithms to carry out an operation


and outline the process of programming an
application.

20-27
P1 Provide a definition of what an algorithm is and outline
the process in building an application.1.1

26-27
M1 Determine the steps taken from writing code to
execution.

D1 Examine the implementation of an algorithm in a suitable 23-25


language. Evaluate the relationship between the written 31-34
algorithm and the code variant

LO2 Explain the characteristics of procedural, object


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

Unit 01: Programming 13


Assignment 01
37-39
P2 Give explanations of what procedural, object orientated,
and event driven paradigms are; their characteristics and the
relationship between them.

61-63
M2 Analyze the common features that a developer has
access to in an IDE.

44-46
D2 Critically evaluate the source code of an application,
which implements the programming paradigms, in terms of
the code structure and characteristics.

LO3 Implement basic algorithms in code using an IDE.

48-60
P3 Write a program that implements an algorithm using an
IDE.

64-87
M3 Use the IDE to manage the development process of the
-program.

Unit 01: Programming 14


Assignment 01
66-69
D3 Evaluate 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

95-98
P4 Explain the debugging process and explain the
debugging facilities available in the IDE.

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

95-98
M4 Evaluate how the debugging process can be used to
help develop more secure, robust applications.

99-102
D4 Critically evaluate why a coding standard is necessary in
a team as well as for the individual.

Unit 01: Programming 15


Assignment 01
Contents

Acknowledgement......................................................................... Error! Bookmark not defined.


1.1 Define what an algorithm is and outline the characteristics of a good algorithm. Develop
algorithms for linear search and binary search using Pseudo code. ............................................19
1.2 Describe the steps involved in the process of writing and executing a program. Take an array
of 10 or more elements and dry run the above two algorithms. Show the outputs at the end of
each iteration and the final output. .............................................................................................27
1.3 Define what Big-O notation is and explain its role in evaluating efficiencies of algorithms.
Write the Python program code for the above two algorithms and critically evaluate their
efficiencies using Big-O notation. .............................................................................................32
2.1 Define what is meant by a Programming Paradigm. Explain the main characteristics of
Procedural, Object oriented and Event-driven paradigms and the relationships among them. .....36
2.2 Write small snippets of code as example for the above three programming paradigms using a
suitable programming language(s). ............................................................................................39
2.3 Critically evaluate the code samples that you have above in relation to their structure and the
unique characteristics. ...............................................................................................................43
In the second example this codded example for Object oriented programming paradigm using the
programming language C#. The Object-oriented programming is based on the concept of
"objects". ..................................................................................................................................45
Activity 03 ................................................................................................................................48
3.1 .............................................................................................................................................48
Design suable algorithms for vehicle tariff calculation for rents and hires. Ideally 3 functions
should be developed for this purpose as follows: .......................................................................48
3.2 Implement the above algorithms using visual studio IDE (using C#.net) and design the
suitable database structure for keeping the tariffs for vehicle types and different packages which
must be used for implementing the above functions...................................................................51
3.3 Analyze the features of an Integrated Development Environment (IDE) and explain how
those features help in application development. Evaluate the use of the Visual Studio IDE for
your application development contrasted with not using an IDE. ...............................................65
4.1 Design and build a small system to calculate vehicle hire amounts and record them in a
database for customer billing and management reporting for Ayubo drive. This includes the
completing the database design started in 3.2 and implementing one or more GUIs for vehicle,
vehicle type, and package add/edit/delete functions. It essentially requires an interface for hire
calculation and recording function described above. Generating customer reports and customer
invoices are not required for this course work............................................................................70
4.2 What is debugging an application? Explain the features available in Visual studio IDE for
debugging your code more easily. Evaluate how you used the debugging process to develop
more secure, robust application with examples. .........................................................................95
4.3 Explain the coding standards you have used in your application development. Critically
evaluate why a coding standard is necessary for the team as well as for the individual. ........... 100
List of references ..................................................................................................................... 104

Unit 01: Programming 16


Assignment 01
Figure of contents

Figure 1 How Linear search works ............................................................................................23


Figure 2 How Binary search works ............................................................................................25
Figure 3 Output for the C++ code ..............................................................................................40
Figure 4 Output for the C# code ................................................................................................41
Figure 7 Flowchart for rent calculation ......................................................................................48
Figure 8 Flow chart for day tour hire calculation .......................................................................49
Figure 9 Flow chart for long tour hire calculation ......................................................................50
Figure 10 output for rent calculation code..................................................................................52
Figure 11 Output for day tour calculation ..................................................................................53
Figure 12 Output for long tour calculation .................................................................................55
Figure 13 Ayubo Drive Database Structure................................................................................56
Figure 14 insert values for package registration .........................................................................56
Figure 15 Before update ............................................................................................................57
Figure 16 After update ..............................................................................................................58
Figure 17 The Before Delete Package Table ..............................................................................59
Figure 18 The after delete package table ....................................................................................59
Figure 19 Insert values to vehicle registration ............................................................................60
Figure 20 Before update ............................................................................................................61
Figure 21 After update ..............................................................................................................62
Figure 22 Before delete .............................................................................................................63
Figure 23 After delete................................................................................................................63
Figure 24 Example visual studio IDE ........................................................................................65
Figure 25 Login page for ayubo drive ........................................................................................70
Figure 26 Display exit button ....................................................................................................71
Figure 27 Login as admin ..........................................................................................................73
Figure 28 Main menu ................................................................................................................74
Figure 29 Logout button ............................................................................................................74
Figure 30 Insert values for vehicle registration ..........................................................................76
Figure 31 Update seat capacity ..................................................................................................77
Figure 32 After update seat capacity ..........................................................................................77
Figure 33 Delete value ..............................................................................................................78
Figure 34 Insert driver details ....................................................................................................78
Figure 35 Update over night charge ...........................................................................................79
Figure 36 Delete driver id ..........................................................................................................80
Figure 37 Insert package detailes ...............................................................................................81
Figure 38 Update package type..................................................................................................82

Unit 01: Programming 17


Assignment 01
Figure 39 Delete package id ......................................................................................................83
Figure 40 Login as receptionist..................................................................................................84
Figure 41 Main menu for receptionist ........................................................................................84
Figure 42 Insert rent values .......................................................................................................86
Figure 43 Update return date .....................................................................................................87
Figure 44 Delete rent details ......................................................................................................88
Figure 45 Insert details for day tour hire calculation ..................................................................89
Figure 46 Update package type..................................................................................................90
Figure 47 Delete detail from day tour hire calculation ...............................................................91
Figure 48 Insert detail for long tour hire calculation ..................................................................92
Figure 49 Update vehicle type ...................................................................................................93
Figure 50 Delete details in long tour hire calculation .................................................................94
Figure 51 The debugging menu .................................................................................................95
Figure 52 Break point in code....................................................................................................96
Figure 53 Run to click in visual studio.......................................................................................96
Figure 54 Examine exceptions ...................................................................................................97
Figure 55 Error list ....................................................................................................................98
Figure 56 Exception ..................................................................................................................99

Unit 01: Programming 18


Assignment 01
Activity 01

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

The algorithm is a process or formula for solving the problems. It is based on conducting a
sequence of specified actions. It is commonly used for data processing, calculation, and other
related computer and mathematical operations. In computer programming, by using
algorithms we can create functions. Those functions can serve as small programs that can be
mention by a larger program.

When we think of an algorithm is in the most common way it is not just in regards to
computer algorithms are in everywhere. Such as a recipe for making a food is an algorithm.
The technique we use to solve the addition or long division problems are an algorithm and
the process of folding a shirt or a pair of pants are an also algorithm. Even our morning
routine could be considered an algorithm (Techtarget.com, 2018).

An example for algorithm to calculate its average and then display the result.

Begin

Input a,b,c,d,e

Total = a+b+c+d+e

Average = total/5

Print average

End

Unit 01: Programming 19


Assignment 01
An algorithm is represent or show by flow chart and pseudo code.

Flow chart

A flowchart is a pictorial representation of an algorithm, which used to show the steps in a


procedure in a more understandable manner. A flowchart purpose is to provide the people
with a common language or a reference point when dealing with the project or process.

We can use simple symbols and arrows to describe relationships in a flow chart. In a
flowchart, the Start and end of programs are represented by an oval shape. An input/output is
represented by the parallelogram, An a process is represented by a rectangle shape, a decision
is represented by a diamond shape and the flow line is represented by an arrow
(Techtarget.com, 2018).Flow chart Symbols

Start/End

Process

Input /Output

Decision

Unit 01: Programming 20


Assignment 01
Flow line

Pseudocode

The pseudocode is an informal method of a programming that is does not required any strict
programming language syntax or fundamental technology. It can be used for creating an
outline or a rough draft of program. Pseudocode is sometimes used as a detailed step by step
in the process of developing a program. The pseudocode is allows to designers or lead the
programmers to show the design in a great details and also provides programmers a detailed
design for the next procedure of writing code in a specific programming language.
(economictimes.indiatimes.com, 2018).

Example for Flowchart and pseudocode

Begin
Marks= 45
If Marks > = 75 Then
Grade = “Distinction”
Else If Mark > = 55 Then
Grade =”Credit”
Else If Mark> = 35 Then
Grade = “Pass”
Else
Grade = “Fail”
End If
End If
End If
Print Grade
End

Unit 01: Programming 21


Assignment 01
The characteristics of a good algorithm

There are few important characteristics of good algorithm.

Finiteness-: an algorithm is should be terminate without any number of steps and each step
must be finish in finite amount of time.

Definiteness-: the procedure of algorithm is should be clearly and exactly define and there
should not be any uncertainty.

Input-: an algorithm is must have zero or more but must be limitation number of inputs.

Output -: an algorithm should have one or more defined outputs and should match the desired
output.

Effectiveness-: an algorithm is should be effective. Effective means that procedure should be


mention as most important and should be executing in limitation time.

Uniqueness-: the each step taken in the algorithm should give a definite result. The results
should not change by any means.

Feasibility-: the algorithm should be possible and practicable in real life. It should not be
abstract or imaginary.

Precision-: a good algorithm must have some outlined steps. The steps should be exact
enough and not variable (Owlgen.com, 2018).

Unit 01: Programming 22


Assignment 01
Liner search and binary search

Liner search

The linear search is a very simple and basic search algorithm. In Linear search we search an
element or value in a provide array by traversing the array from the starting until the desired
element or value is found (studytonight.com, 2018).

Example:-

Searching for Item 17 in the following array

Figure 1 How Linear search works

Unit 01: Programming 23


Assignment 01
Algorithm for Linear Search using Pseudo code.

BEGIN LINEARSAERCH

lastIndex = ARRAYLENGTH(array)`

FoundIt = false

Index = 1

Read Find

WHILE FoundIt = false AND Index <= lastIndex

IF array(index) = Find THEN

FoundIt = true

ENDIF

index= Index + 1

ENDWHILE

IF FoundIt = true THEN

DISPLAY "Found", Find

ELSE

DISPLAY Find, "Not found"

ENDIF

END LINEARSAERCH

Unit 01: Programming 24


Assignment 01
Binary search

Rather than searching individual elements sequentially a sorted array can be more efficiently
searched using binary search. We compare the middle element and continue the search on
upper or lower half or the array based on the value is greater or smaller than the middle. This
continues until the value is found at the middle or until we confirm the value is not present
(Geeksforgeeks, 2018).

Example -:

Searching for Item 29 in the following array

Figure 2 How Binary search works

Unit 01: Programming 25


Assignment 01
Algorithm for Binary Search using Pseudo code.

FUNCTION binarySearch(list, value)


left = 0
right = LEN(list) - 1
WHILE left ≤ right
mid = floor((right+left)/2)
IF list[mid] = value THEN
return Found
IF value < list[mid] THEN
right = mid-1
ELSE
left = mid+1
RETURN Not Found
END FUNCTION

Unit 01: Programming 26


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

A program is a set of step-by-step instructions that directs the computer to do the tasks we
want it to do and produce the results we want (homepage.cs.uri.edu, 2017)
The most important steps in write and executing a computer program would be like this

Defining the Problem


Design the Program
Code the Program
Test the Program
Document and Maintain

Defining the Problem


The problem needs to identify at the beginning of the process, as it needs to be clearly
understood. If the problem is found clearly then the programmers are capable of working
towards an objective. Identifying the problem includes identifying the user and system
requirements in order to provide the exact solution for the problem.

Design the Program


The program need to be designed at the next stage. The outline of the program should be
built up in order for the programmers to get a clear idea of the concept. Concepts like
pseudocodes and flowcharts are used to show up the program.

Code the Program


After the program is designed, it is the time to code the program using a appropriate
programming language. It is the programmer’s duty to select a programming language
according to the necessity. Once the language is chosen the program is coded using a
suitable IDE.

Unit 01: Programming 27


Assignment 01
Test the Program
The next step is to check the coded program in order to detect any errors in it and to ensure
that it provides us with the expected outcome. Testing is considered as an critical part in the
creating of a program. Several techniques are used to do a testing according to the
circumstance.

Document and Maintain


The documentation should be ongoing from the very beginning because it is needed for
those complicated with program now and future. And also the program is finalized the user
documentation for the commercial use to an operator the documentation for the people who
run the computer system and the programmer documentation for the programmers charged
with maintenance.

Dry run

The dry run is can be test or check performed on a program. Run to check the performance
or stability of a particular program before it is made available (computerhope.com, 2018).
The dry run conducted by using a trace table. Trace table is track the values of variables as
they change throughout the program. This is useful when a program is not producing the
desired result (101computing.com, 2018)

Unit 01: Programming 28


Assignment 01
Dry run for linear search
Array=[2,5,9,12,33,47,24,50,67,3]

Array Input Index Array[Index] Input= Array[Index] Result

[2,5,9,12,33,47,24,50,67,3] 2 0 2 True Found

[2,5,9,12,33,47,24,50,67,3] 33 0 2 False
1 5 False Found

2 9 False
3 12 False
4 33 True
[2,5,9,12,33,47,24,50,67,3] 50 0 2 False
1 5 False Found

2 9 False
3 12 False

4 33 False
5 47 False
6 24 False

Unit 01: Programming 29


Assignment 01
7 50 True

[2,5,9,12,33,47,24,50,67,3] 99 0 2 False
1 5 False

2 9 False
Not Found
3 12 False
4 33 False
5 47 False

6 24 False
7 50 False
8 67 False
9 3 False

Unit 01: Programming 30


Assignment 01
Dry run for binary search
Array= [2,9,14,22,38,29,46,58,66,90]

List Value Left Right Mid Result

[2,9,14,22,38,29,46,58,66,90] 14 0 9 4
0 3 1
2 3 2 Found
[2,9,14,22,38,29,46,58,66,90] 29 0 5 Found

[2,9,14,22,38,39,46,58,66,90] 90 0 09 5

8 09 09

8 09 9

09 09 09 Found

Unit 01: Programming 31


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

Big o notation is simplified analyses of an algorithm's efficiency. Big o notation is an


algorithm complexity in term of input size and it gives the way to efficiency or code from
the machine is runout we don't care of the start the machine rather we assign in the basic
computer step of the code. We can use big o to analyze both time and space. There are
couple ways to look at the algorithm efficiencies. That we can divide as worst-case, best-
case and average-case.
The best case is here we look at the most favorable situation and check the efficiency of
the algorithm. For an example sorting a nearly sported array. The worst case is here we
look at most adverse situation and analyze the efficiency of the algorithm. For example
sorting an array arranged in descending order to ascending order and the average case is
average of the best case and the worst case scenarios (Geekforgeeks.com, 2017).

The following is a list of common types of notation and their names


Notation Names

O(1) Constant

O(N) Linear

O(N2) Quadratic

O(LogN) Logarithmic

Unit 01: Programming 32


Assignment 01
Constant  O(1)

This is called constant. O(1) is describes an algorithm that will be always execute in the
equal time regardless of the size of the input data set. The algorithm does a constant number
of operations independent on the input (rob-bell.net, 2009).

Linear O(N)

This is called has linear O(N) is a describes the algorithm is which performance will be raise
the linearly and in the direct proportion to the size of the input data set. The best example
for linear time complexity is the linear search where an element is searched through an array
sequentially. The time depends on the amount of elements in the array (rob-bell.net, 2009).

Quadratic   O(N²)

This is call quadratic. The running time of the algorithm is as a result of performing a linear
operation N times. So it’s N multiplied by N. An a common sorting algorithms like bubble
sort, selection sort and insertion sort takes O(N²). This is common with algorithms that
involve nested iterations over the data set. Deeper nested iterations will result in O(N 3),
O(N4)and etc. (rob-bell.net, 2009).

Logarithmic O(LogN)

This is called logarithmic. The running time of the algorithm is decreased by some factor
with each step. A very simple and small example of this type is an algorithm that keeps
dividing the input by two. A binary search algorithm follows the same rule (rob-bell.net,
2009).

Unit 01: Programming 33


Assignment 01
Python code for linear search

arr = []

num = int(input("enter number of elements: "))

for i in range(0, 10):

arr.insert(i, int(input("enter element: ")))

print(arr)

# searching element

item = int(input("enter element to be searched: "))

position = 0

while position <= num:

if item == arr[position]:

print("element is at ", position + 1, " position")

break

elif item not in arr:

print("element not found")

break

position += 1

In linear search a particular element is searched through an array in a sequential order. If the
provided array contains a few elements, finding the required. Element is easy, but if the array
contains more elements, then it will appear a bit tough as it will consist more and more time.
Therefore this can be considered as an time complexity notation where the consummation
depends on the on the size of the input.

Unit 01: Programming 34


Assignment 01
Python code for binary search

def binary_sort(sorted_list, length, key):


start = 0
end = length-1
while start <= end:
mid = int((start + end)/2)
if key == sorted_list[mid]:
print("\nEntered number %d is present at position: %d" % (key, mid))
return -1
elif key < sorted_list[mid]:
end = mid - 1
elif key > sorted_list[mid]:
start = mid + 1
print("\nElement not found!")
return -1

lst = []

size = int(input("Enter size of list: \t"))

for n in range(size):
numbers = int(input("Enter any number: \t"))
lst.append(numbers)

lst.sort()
print('\n\nThe list will be sorted, the sorted list is:', lst)
x = int(input("\nEnter the number to search: "))

binary_sort(lst, size, x)

In the python code a While search is being found which needs to be run until the define
condition is met. Once the condition is met the code starts to execute the next set of
instructions. Once it is done a if condition is being given as to check whether the predefined
condition is met. According to this it is seen that the time consumed depend on the list of
elements available. But in Binary Search, the elements are divided into 2, thus it will reduce
the time. There for as the notation for efficiency it could be stated as O(Log n).

Unit 01: Programming 35


Assignment 01
Activity 02

2.1 Define what is meant by a Programming Paradigm. Explain the main


characteristics of Procedural, Object oriented and Event-driven paradigms and the
relationships among them.

The programming paradigm is the way of a thinking about or approaching the problems
and also programming paradigm is an important style of a build the structure and
elements of the program. The styles and capabilities of the programming languages are
describe by their paradigms (Quora.com, 2017).

Procedural
Procedural programming is a list of instructions to telling a Computer Step-by- Step. In
an order of how to performance the first Code to the Second and So forth which may
contain loops (Prezi.com, 2011).
The main characteristics of procedural paradigm

The first most important paradigm is puts much importance on Things to be done. And
also the large problems are divided into a smaller programs known as a functions. The
most of the functions are share global data and data move openly around on the system
from function to functions. The functions are transfer data from one form to another form.
Also top down approach in the program designing. And also finally appropriate and
effective techniques are unavailable to secure data of a function from others
(onlineclassnotes.com, 2013).

Object oriented
Object orientated is the programmer examines the problem in an old fashioned way. It
does not write and algorithm but instead breaks down the problem of elements into
classes the process used to create an object is called instantiation (Prezi.com, 2011).

Unit 01: Programming 36


Assignment 01
The main characteristics of object oriented paradigm

The most important and the first object oriented paradigm is encapsulation an
encapsulation is a capturing data and keeping it safely and securely from the outside
interfaces. And also inheritance is the process by which a class can be derived from a
base class with all the features of base class and some of its own. This increases code
reusability. The variety is the ability to the exist in various forms. For example an
operator can be over loaded so as to the add a two integer numbers and add two floats.
And also finally abstraction is the ability to the represent the data at a very conceptual
level without any details. They are characteristics of the object oriented paradigm
(careerride.com, 2016).

Event-driven paradigms
Event driven paradigm which is determined by events or user actions. An example we can
get clicking on a mouse. It can only be used using a graphical user interface. Which is one
of its main features. It can interact with any hardware that is attached to a computer and it
is not a Complex program to use. A program can easily be developed and all of the
properties used in the program are all independent so they can save altogether saving the
programmer time and effort saving them separately (Prezi.com, 2011).

The main characteristics of event driven paradigm

In event driven programming time driven is a characteristics of paradigm it is a code that


runs on a time trigger. Time driven can be a specific code that runs on a specific time.
And also event handlers is a type of functions or method that run a specific action when a
specific event is triggered. The trigger function in event driven programming are a
functions that is decide what code to run when there are a specific event occurs. which are
used to select which event handler to use for the event when there is specific event
occurred finally events is include mouse, keyboard and user interface, which events need
to be triggered in the program in order to happen, that mean user have to interacts with an
object in the program (ukessays.com, 2018).

Unit 01: Programming 37


Assignment 01
Relationship among Procedural, Event Driven and Object Oriented Programming.

The procedural paradigm is we looking at the process needed to solve a problem. There a
definite process and the flow of the data is highly predictable.

Also the object oriented is we observing at the actors and the creating a objects to
represent those actors. For an example and an emulator for a movie line queue. We have
got people the line and a ticket booth. So we build objects around those actors.

The event driven is a used when we have impulsive the moments that need to be taken
care of. We can add some event handlers to the both procedural and the object oriented
paradigms. So as a standalone, it’s not a complete paradigm. For the instance the
procedural report writer a could have an a event to handle out of the papers or the object
oriented program could be have an a event to the handle. when lightning hits a person
standing line for the movie. Events are more a feature to add to other stuff.

Is there a no really relationship between procedural and object oriented. Because it is


based on the problem to be solved we pick a paradigm which allows to solve it most
efficiently (quora.com, 2017).

Unit 01: Programming 38


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

Procedural programming paradigm

In this C++ program the user is asked to enter three numbers and also this program is
finds out the largest number of the among three numbers entered by the user and the
displays it with a proper message.

#include "stdafx.h"
#include <iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])


{
float n1, n2, n3;

cout << "Enter three numbers: ";


cin >> n1 >> n2 >> n3;

if(n1 >= n2 && n1 >= n3)


{
cout << "Largest number: " << n1;
}

if(n2 >= n1 && n2 >= n3)


{
cout << "Largest number: " << n2;
}

if(n3 >= n1 && n3 >= n2) {


cout << "Largest number: " << n3;
}
system("pause");
return 0;
}

Unit 01: Programming 39


Assignment 01
Output for the above C++ code

Figure 3 Output for the C++ code

Object oriented programming paradigm

A simple calculator is created using C# console applications where the sum of the two
numbers entered by the user is displayed. And the difference between the two numbers
entered will be displayed below.

namespace consoleApplication5
{
public class oopprogram
{
public class simplecalculator
{
public double add(double number1, double number2)
{
return number1 + number2;
}

public double minus(double number1, double number2)


{
return number1 - number2;
}
}
static void Main(string[] args)

{
Console.Write("Type your first Number: ");

Unit 01: Programming 40


Assignment 01
double x = double.Parse(Console.ReadLine());
Console.Write("Type your second Number: ");
double y = double.Parse(Console.ReadLine());
simplecalculator operation = new simplecalculator();
Console.Write("The addition of " + x + " and " + y + " is : ");
Console.WriteLine(operation.add(x, y));
Console.Write("The difference between " + x + " and " + y + " is : ");
Console.WriteLine(operation.minus(x, y));
Console.ReadLine();
}
}

Out put for the above C# code

Figure 4 Output for the C# code

Unit 01: Programming 41


Assignment 01
Event driven programming paradigm (Mouse click event)

import turtle

turtle.setup(400,500)

wn = turtle.Screen()

wn.title("How to handle mouse clicks on the window!")

wn.bgcolor("lightgreen")

tess = turtle.Turtle()

tess.color("blue")

tess.pensize(3)

tess.shape("turtle")

def h1(x, y):

tess.goto(x, y)

wn.onclick(h1) # Wire up a click on the window.

wn.mainloop()

Output for the above python code

Figure 5 Output for the python paradigm

Unit 01: Programming 42


Assignment 01
2.3 Critically evaluate the code samples that you have above in relation to their
structure and the unique characteristics.
Procedural Programming using C++

#include "stdafx.h"
#include <iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])


{
float n1, n2, n3;

cout << "Enter three numbers: ";


cin >> n1 >> n2 >> n3;

if(n1 >= n2 && n1 >= n3)


{
cout << "Largest number: " << n1;
}

if(n2 >= n1 && n2 >= n3)


{
cout << "Largest number: " << n2;
}

if(n3 >= n1 && n3 >= n2) {


cout << "Largest number: " << n3;
}
system("pause");
return 0;
}

In the first example this codded example Procedural programming paradigm using the
programming language C++. When referring the structure of this code the header files need
to be predefined. Then the input and out needs to be declared using cin and cout variables.
Cout is used to define the phrase to be displayed. The phrases written in front couts is
displayed in the console window when the program is being run. Once the output is
declared the numbers entered by the user is declared. 3 if conditions are being used to
choose between the 3 numbers as to find out which one is the largest number.
The user can able to enter the values of his choice. The declared variable n1, n2 and n3 is
being used here.

Unit 01: Programming 43


Assignment 01
The uniqueness of this language is that it uses shift operators(<<) for its coding. After the
steps are instructed to the computer it needs to be instructed to the computer the to pause the
program in order to see the output, if system(“pause”) is not included the user will not be
able to see the output.

Object Oriented Paradigm using C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace consoleApplication5
{
public class oopprogram
{
public class simplecalculator
{
public double add(double number1, double number2)
{
return number1 + number2;
}

public double minus(double number1, double number2)


{
return number1 - number2;
}
}
static void Main(string[] args)
{
Console.Write("Type your first Number: ");
double x = double.Parse(Console.ReadLine());
Console.Write("Type your second Number: ");
double y = double.Parse(Console.ReadLine());
simplecalculator operation = new simplecalculator();
Console.Write("The addition of " + x + " and " + y + " is : ");
Console.WriteLine(operation.add(x, y));
Console.Write("The difference between " + x + " and " + y + " is : ");
Console.WriteLine(operation.minus(x, y));
Console.ReadLine();
}
}

Unit 01: Programming 44


Assignment 01
In the second example this codded example for Object oriented programming paradigm using
the programming language C#. The Object-oriented programming is based on the concept of
"objects". In this object-oriented programs, we can see that the code is well structured, and

the programmer makes it easy. However there are two main classes <oopprogram> and
<simplecalculate> and we have the <main> method under the <oopprogram> class. The
<total> function under the <simplecalculate> class. The one of the unique features of object-
oriented programming is that it has classes and objects. In this code almost all have public
access specifiers.

The Classes, Object and Methods

Classes

Object

Method

Unit 01: Programming 45


Assignment 01
Event driven Paradigm using python (Mouse click event)

import turtle
turtle.setup(400,500)
wn = turtle.Screen()
wn.title("How to handle mouse clicks on the window!")
wn.bgcolor("lightgreen")

tess = turtle.Turtle()
tess.color("blue")
tess.pensize(3)
tess.shape("triangle")

def h1(x, y):


tess.goto(x, y)

wn.onclick(h1) # Wire up a click on the window.


wn.mainloop()

In our last example python language is being used to code the event driven program. I used
mouse click event on this program. An a mouse click event is for an each widget it’s
possible to bind python functions and methods to an event. If the defined event occurs in the
widget, the handler function is called with event object describing the event. Every time we
move the mouse in the message widget, the position of the mouse pointer will be printed
(python-course.eu, 2017).

Here the coded program actually uses python turtle, which is used in drawings in python. A
mouse event is a bit different from a keypress event because its handler needs two parameters
to receive x, y coordinate information telling us where the mouse was when the event
occurred.

Unit 01: Programming 46


Assignment 01
This turtle method allows us to move the turtle to an absolute coordinate position. I named
the handler function h1 it like this.

So what this program does is move the turtle and draw a line to wherever the mouse is
clicked and this program is very is to use. An a mouse click event is very useful and import
event.

Unit 01: Programming 47


Assignment 01
Activity 03

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

Rent calculation

Figure 5 Flowchart for rent calculation

Unit 01: Programming 48


Assignment 01
Day tour hire calculation

Figure 6 Flow chart for day tour hire calculation

Unit 01: Programming 49


Assignment 01
Long tour hire calculation

Figure 7 Flow chart for long tour hire calculation

Unit 01: Programming 50


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

The IDE for above algorithm using C#

Rent calculation code

private void button2_Click(object sender, EventArgs e)


{
double Check = 0;

int charges = 0;

DateTime date1 = dateTimePicker1.Value;


DateTime date2 = dateTimePicker2.Value;
int numberDays = (int)date2.Subtract(date1).TotalDays + 1;
int month = numberDays / 30;
int week = (numberDays % 30) / 7;
int day = (numberDays % 30) % 7;

if (numberDays < 7)
{
charges = day * 2000; //2000 per
day charges
}
if (numberDays >= 7 || numberDays < 30)
{
charges = week * 8500 + day * 2000; //8500 per
week charges
}
if (numberDays >= 30)
{
charges = month * 32000 + week * 8500 + day * 2000; //32000 per
month charges
}

if (checkBox1.Checked)
{
Check = 1500 * numberDays; // per
Driver Charge
}
if (checkBox2.Checked)
{
Check = 0;
}

double total = Check + charges;


textBox5.Text = total.ToString();

Unit 01: Programming 51


Assignment 01
Output for above rent calculation code

Figure 8 output for rent calculation code

Day tour hire calculation code


private void button1_Click_1(object sender, EventArgs e)
{
int waiting = 0;
int Extra = 0;

DateTime Time1 = dateTimePicker1.Value;


DateTime Time2 = dateTimePicker2.Value;
int TimeAmount = (int)Time2.Subtract(Time1).TotalHours + 1;
int start = int.Parse(textBox2.Text);
int end = int.Parse(textBox3.Text);
int totalKM = end - start;
int BHC, maximumkm, priceperkm,THC;

maximumkm = int.Parse(textBox9.Text);
priceperkm = int.Parse(textBox10.Text);

BHC = maximumkm * priceperkm ;


textBox6.Text = BHC.ToString();

Unit 01: Programming 52


Assignment 01
if (totalKM > 100)
{
Extra = (totalKM - 100) * 100; // 100 per Extra KM Charges
}

if (TimeAmount > 3 || TimeAmount <= 12) // maximum 3 hours is time


allowed
{
waiting = (3 - TimeAmount) * 150;

THC = BHC + waiting + Extra;


textBox7.Text = THC.ToString(); ;
textBox4.Text = waiting.ToString();

textBox5.Text = Extra.ToString();
textBox7.Text = THC.ToString();

Output for above day tour calculation code

Figure 9 Output for day tour calculation

Long tour hire calculation code


private void button1_Click(object sender, EventArgs e)
{
string vehicleno, customername, packagetype,vehicaletype;

Unit 01: Programming 53


Assignment 01
int maximumkm, pricepercharge,customercontactno,driverovernightcharge,
BHC;
int overnight = 0;
int parking = 600;
int EKM = 0;
DateTime date1 = dateTimePicker1.Value;
DateTime date2 = dateTimePicker2.Value;
int numberDay = (int)date2.Subtract(date1).TotalDays + 1;
int start = int.Parse(textBox10.Text);
int end = int.Parse(textBox11.Text);
int TK = end - start;

if (TK > 400)


{
EKM = (TK - 400) * 100; //100 Per Extra KM CHARGE
}

driverovernightcharge = int.Parse(textBox7.Text);
if (numberDay > 2)
{
overnight = (numberDay - 2) * 500 + parking+ driverovernightcharge;
}
customername = textBox12.Text;
customercontactno = int.Parse(textBox13.Text);
packagetype = textBox9.Text;
vehicaletype = comboBox1.Text;
vehicleno = textBox1.Text;

maximumkm = int.Parse(textBox3.Text);
pricepercharge = int.Parse(textBox8.Text);
driverovernightcharge = int.Parse(textBox7.Text);
if (numberDay > 2)
{
driverovernightcharge = (numberDay - 2) * 250;
}

BHC = maximumkm * pricepercharge + driverovernightcharge;


textBox5.Text = BHC.ToString();
double total = overnight + EKM + BHC;
textBox2.Text = EKM.ToString();
textBox6.Text = overnight.ToString();
textBox4.Text = total.ToString();

Unit 01: Programming 54


Assignment 01
Output for above long tour hire calculation

Figure 10 Output for long tour calculation

Database structure for keeping the tariffs for vehicle types and different packages.

The system is supported by two databases. Where login database stores the login information
and the Login activity log. The vehicle tariff and packages details are two tables have been
created under this database. While the database stores the vehicle details and package details
respectively and it is able to easily insert, update and delete the data within the database.

Unit 01: Programming 55


Assignment 01
Figure 11 Ayubo Drive Database Structure

Insert values for package registration

Figure 12 insert values for package registration


Message box for package registration

Unit 01: Programming 56


Assignment 01
Insert code for package registration

private void button1_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into packageregistration values('" +
textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text
+ "','"+textBox5.Text+"')";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Inserted successfully!");

Update value for package registration

Before update package price

Figure 13 Before update

Unit 01: Programming 57


Assignment 01
After update package price

Figure 14 After update

Message box for update

Coding for update values

private void button2_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "update packageregistration set packagetype='" +
textBox2.Text + "',packageprice= '" + textBox3.Text + "',maximumkm='" + textBox4.Text
+ "',maximumhours='"+textBox5.Text+"' where packageid= '" + textBox1.Text + "'";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Upadted Successfully!");
}

Unit 01: Programming 58


Assignment 01
Delete package id

Before delete

Figure 15 The Before Delete Package Table

After delete

Figure 16 The after delete package table

Unit 01: Programming 59


Assignment 01
Delete Message box

Code for delete


private void button3_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "delete from packageregistration where packageid='" +
textBox1.Text + "'";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Deleted Successfully!");
}

Insert values for vehicle registration

Figure 17 Insert values to vehicle registration

Unit 01: Programming 60


Assignment 01
Message box for vehicle registration

Insert codeing for vehicle registrion

private void button1_Click(object sender, EventArgs e)


{

con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into vehicalregistration values('" +
textBox1.Text + "','" + comboBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text
+ "')";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Vehical Registration Inserted successfully!");

Update for vehicle registration

Before update

Figure 18 Before update

Unit 01: Programming 61


Assignment 01
After registration

Figure 19 After update

Code for update

private void button3_Click_1(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "update vehicalregistration set vehicaltype='" +
comboBox1.Text + "',overnightparkingrate= '" + textBox2.Text + "',seatcapacity='" +
textBox3.Text + "' where vehicalid= '"+textBox1.Text+"'";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Upadted Successfully!");
}

Unit 01: Programming 62


Assignment 01
Delete vehicle id

Figure 20 Before delete

Figure 21 After delete

Unit 01: Programming 63


Assignment 01
Code for delete

private void button2_Click_1(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "delete from vehicalregistration where Vehicalid='" +
textBox1.Text + "'";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Deleted Successfully!");
}

Delete Message box

Unit 01: Programming 64


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

Figure 22 Example visual studio IDE

An (IDE) or we can call integrated development environment is an a application that


facilitates application development. The IDEs are designed to encompass the all of
programming tasks in a one application. An IDE is normally and mainly consists of
a source code editor, Compiler, Build automation tools and a debugger. However there are
many multiple language IDEs have such as Eclipse , Komodo and NetBeans. Finally C++,
C#, Python, PHP, Ruby, Javascript and more. These languages are supported to IDE. The
Integrated development system (IDE) is may be standalone application or it may be contain
as the part of the one or more existing and compatible applications. There are have
Integrated development system (IDEs) exactly for the mobile development, consist
PhoneGap and finally Appcelerator's Titanium Mobile (veracode.com, 2018).

Unit 01: Programming 65


Assignment 01
Features of IDE and how it helps in application developement

Debugger
The debugger is helps to observe the run time behavior of the program and find the
problems. The debugger is works with all the Visual Studio programming languages and
there are associated libraries. The debugger we can break the execution of the program to
examine the all code ,examine and edit the all variables, view the registers, see entirely the
instructions created from the source code and view the memory space used by the
application (msdn.microsoft.com, 2015).

Build automation tools


These Build automation tools is help to save the time by the automatically doing the
processes that would otherwise be done by hand. These could be include the testing or
compiling. These build automation tools are extremely useful when the program has many
thousands of the lines of code.

Compiler
This compiler tool is help to transforms the source code written in a human readable and
writable language into the form executable by the computer.

Source code editor

The source code editor is the text editor program it’s help to designed a specifically for the
editing source code of a computer programs. It’s may be standalone application or it may be
built into an integrated development environment (IDE) or web browser.

And also the source code editors are to a fundamental programming tool as a fundamental
job of the programmers is to write and edit the source code

Unit 01: Programming 66


Assignment 01
Use of Visual Studio Integrated Development Environment

Debugger
The debugger is works with all visual Studio program. In the Visual Studio program context
when the debug the application it usually mean that we are running the application with
debugger attached so that is in debugger mode. The errors are show in the error list when
the application is being debugged. If Integrated development system (IDE) is not using in
visual studio errors could not be identify until the program is entire run.
Display the error Message

Display the error list

source code editor

The source code editor is the text editor program it’s help to designed a specifically for the
editing source code of a computer programs. In the role of the source code editor Visual
Studio Code is allows to changing the code page in which the active document is saved, the
character that identifies line break and the programming language of the active document.
Once the program is being run it is also able to edit the source code while on run mode in
order to adjust any mistakes. If an IDE has not been used the entire code need to be typed
manually and there is a higher percentage to make errors.

Unit 01: Programming 67


Assignment 01
Toolbox
The visual studio provide. Toolbox displays icons for controls and other items that we can
add to Visual Studio projects. We can dock the Toolbox and we can pin it open or set it to
Auto Hide. Toolbox icons can be dragged to a design view or pasted in a code editor. Also
action adds the fundamental code to create an instance of the Toolbox item in the active
project file. If IDE has not been used for this the traditional text editors does not contains
these kind of tools thus does not assist it creating Graphical User Interfaces.

Build in compact SQL server

Visual Studio contains a built in compact Structured Query Language version where
database can be created within Visual Studio without creating a database using a database
software and exporting it to Visual Studio. This makes programmer’s workload less and the

Unit 01: Programming 68


Assignment 01
complexity of the program reduces and it is the necessity of most of the programs to contain
a database in order to records details of the functions of the program.
If a text editor has been used for this without an IDE this task might be much tougher as it
needs longer time and knowledge in exporting a Database.

Compiler

Visual Studio contains an inbuilt compiler, which converts the source code into machine
code automatically, and it saves the time of the programmer. If the IDE does not contain the
compile in built source, code has converted to the machine code separately otherwise, the
machine would not understand the given instructions.

Unit 01: Programming 69


Assignment 01
Activity 04

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

Login form for ayubo drive

Figure 23 Login page for ayubo drive

A login page designed using role base facility. The logins are available within the
database Login which is created to store the user name, password and user type. All three
fields should tally in order for a particular user to login.
Two users are included and they are Admin and Receptionist.

Unit 01: Programming 70


Assignment 01
Login form exit button

Figure 24 Display exit button

Login form coding

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;

using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Ayubo_Leisure
{
public partial class Form1 : Form
{
SqlConnection con = new SqlConnection(@"Data Source=DESKTOP-
LVB5OI9\SQLEXPRESS;Initial Catalog=Login;Integrated Security=True");
public Form1()
{
InitializeComponent();
timer1.Start();
}

private void Form1_Load(object sender, EventArgs e)


{
textBox1.Text = Properties.Settings.Default.username;
}

private void button1_Click(object sender, EventArgs e)


{
Properties.Settings.Default.username = textBox1.Text;
Properties.Settings.Default.Save();

Unit 01: Programming 71


Assignment 01
SqlCommand cmd = new SqlCommand("select * from Login Where username='" + textBox1.Text
+ "' and password='" + textBox2.Text + "' and usertype='" + comboBox1.Text + "'",
con);

SqlDataAdapter sda = new SqlDataAdapter(cmd);


DataTable dt = new DataTable();

sda.Fill(dt);
string cmbItemValue = comboBox1.SelectedItem.ToString();
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
if (dt.Rows[i]["usertype"].ToString() == cmbItemValue)
{
MessageBox.Show("You are successfuly login as" + dt.Rows[i]
[2]);
if (comboBox1.SelectedIndex == 0)
{
this.Hide();
Form8 fr = new Form8();
fr.ShowDialog();

}
else
{
this.Hide();

Form2 fr = new Form2();


fr.ShowDialog();

}
}
else
{
MessageBox.Show("Incorrect username and password!");
}
}

private void button2_Click(object sender, EventArgs e)


{
comboBox1.Text = string.Empty;
textBox2.Text = string.Empty;
}

private void button3_Click(object sender, EventArgs e)


{
this.Dispose();
}

private void checkBox1_CheckedChanged(object sender, EventArgs e)


{
this.textBox2.PasswordChar =
this.checkBox1.Checked ? char.MinValue : '●';
}

private void timer1_Tick(object sender, EventArgs e)


{

Unit 01: Programming 72


Assignment 01
DateTime datetime = DateTime.Now;
this.label4.Text = datetime.ToString();
}

private void textBox1_TextChanged(object sender, EventArgs e)


{

private void exitToolStripMenuItem_Click(object sender, EventArgs e)


{
this.Dispose();

private void button3_Click_1(object sender, EventArgs e)


{
this.Dispose();
}

}
}
}

Login as a admin

Figure 25 Login as admin

If I login as admin it display main menu like this. There are three functions available in main
menu.

Unit 01: Programming 73


Assignment 01
Figure 26 Main menu

Main menu form logout button

Figure 27 Logout button

Coding for above three function

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Ayubo_Leisure
{
public partial class Form8 : Form
{
public Form8()
{
InitializeComponent();
}

Unit 01: Programming 74


Assignment 01
private void Form8_Load(object sender, EventArgs e)
{

private void button1_Click(object sender, EventArgs e)


{

this.Hide();
Form3 fr = new Form3();
fr.ShowDialog();
}

private void button5_Click(object sender, EventArgs e)


{

this.Hide();

Form6 fr = new Form6();


fr.ShowDialog();
}

private void button2_Click(object sender, EventArgs e)


{
this.Hide();

Form1 fr = new Form1();


fr.ShowDialog();

private void button3_Click(object sender, EventArgs e)


{
this.Hide();
Form9 fr = new Form9();
fr.ShowDialog();
}

private void logoutToolStripMenuItem_Click(object sender, EventArgs e)

{
this.Hide();
Form1 fr = new Form1();
fr.ShowDialog();
}
}
}

Unit 01: Programming 75


Assignment 01
Vehicle registration

Insert values for vehicle registration

Figure 28 Insert values for vehicle registration

Code for insert

private void button1_Click(object sender, EventArgs e)


{

con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into vehicalregistration values('" +
textBox1.Text + "','" + comboBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text
+ "')";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Vehical Registration Inserted successfully!");

Unit 01: Programming 76


Assignment 01
Update values vehicle registration

Before update

Figure 29 Update seat capacity


After update

Figure 30 After update seat capacity


Code for update

private void button3_Click_1(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "update vehicalregistration set vehicaltype='" +
comboBox1.Text + "',overnightparkingrate= '" + textBox2.Text + "',seatcapacity='" +
textBox3.Text + "' where vehicalid= '"+textBox1.Text+"'";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Upadted Successfully!");
}

Unit 01: Programming 77


Assignment 01
Delete value in vehicle registration

Figure 31 Delete value

Code for delete

private void button2_Click_1(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "delete from vehicalregistration where Vehicalid='" +
textBox1.Text + "'";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Deleted Successfully!");
}
Driver registration
Insert values for driver registration

Figure 32 Insert driver details

Unit 01: Programming 78


Assignment 01
Code for insert

private void button1_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into driverregistration values('" +
textBox1.Text + "','" +textBox2.Text+ "','" + textBox3.Text + "','" + textBox4.Text +
"')";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Inserted successfully!");
}

Update values for driver registration

Figure 33 Update over night charge

Code for update

private void button3_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;

Unit 01: Programming 79


Assignment 01
cmd.CommandText = "update driverregistration set drivername='"
+textBox2.Text + "',overnightcharge= '" + textBox3.Text + "',hourlywaitingcharge='" +
textBox4.Text + "' where driverid= '" + textBox1.Text + "'";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Upadted Successfully!");
}

Delete value for driver registration

Figure 34 Delete driver id

Code for delete

private void button5_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "delete from driverregistration where driverid='" +
textBox1.Text + "'";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Deleted Successfully!");
}

Unit 01: Programming 80


Assignment 01
Package registration

Insert values for package registration

Figure 35 Insert package detailes


Code for insert

private void button1_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into packageregistration values('" +
textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text
+ "','"+textBox5.Text+"')";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Inserted successfully!");
}

Unit 01: Programming 81


Assignment 01
Update values for package registration

Figure 36 Update package type

Code for update

private void button2_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "update packageregistration set packagetype='" +
textBox2.Text + "',packageprice= '" + textBox3.Text + "',maximumkm='" + textBox4.Text
+ "',maximumhours='"+textBox5.Text+"' where packageid= '" + textBox1.Text + "'";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Upadted Successfully!");
}

Unit 01: Programming 82


Assignment 01
Delete values for package registration

Figure 37 Delete package id

Code for delete

private void button3_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "delete from packageregistration where packageid='" +
textBox1.Text + "'";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Deleted Successfully!");
}

Unit 01: Programming 83


Assignment 01
Login as a receptionist

Figure 38 Login as receptionist

If I login as receptionist it display main menu like this. There are three functions available in
main menu and they are.

Figure 39 Main menu for receptionist

Unit 01: Programming 84


Assignment 01
Code for main menu

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Ayubo_Leisure
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)


{
}

private void button2_Click(object sender, EventArgs e)


{
this.Hide();
Form4 fr = new Form4();
fr.ShowDialog();

private void button3_Click(object sender, EventArgs e)


{
this.Hide();
Form5 fr = new Form5();
fr.ShowDialog();

private void button4_Click(object sender, EventArgs e)


{
this.Hide();
Form7 fr = new Form7();
fr.ShowDialog();
}

private void button5_Click(object sender, EventArgs e)


{

private void button1_Click_1(object sender, EventArgs e)


{
this.Hide();
Form1 fr = new Form1();
fr.ShowDialog();
}

Unit 01: Programming 85


Assignment 01
private void logoutToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Hide();
Form1 fr = new Form1();
fr.ShowDialog();
}
}
}

Insert values for rent calculation

Figure 40 Insert rent values

Code for insert

private void button1_Click_1(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into rentcalculation values('" + textBox1.Text +
"','" + dateTimePicker1.Text+ "','" + dateTimePicker2.Text + "','" +
checkBox1.Text+"','"+checkBox2.Text+"','"+textBox5.Text+"')";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show(" Inserted successfully!");
}

Unit 01: Programming 86


Assignment 01
Updates values

Figure 41 Update return date

Code for update

private void button3_Click_1(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "update rentcalculation set renteddate='" +
dateTimePicker1.Text+ "',returndate= '" +dateTimePicker2.Text+"',withdriver='"
+checkBox1.Text+ "',withoutdriver='" + checkBox2.Text+
"',totalrentvalue='"+textBox5.Text+"' where vehicleno= '" + textBox1.Text + "'";
cmd.ExecuteNonQuery();

con.Close();
data_view();
MessageBox.Show("Upadted Successfully!");
}

Unit 01: Programming 87


Assignment 01
Delete values

Figure 42 Delete rent details

Code for delete

private void button5_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "delete from rentcalculation where vehicleno='" +
textBox1.Text + "'";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Deleted Successfully!");
}

Unit 01: Programming 88


Assignment 01
Day tour hire calculation

Insert values for hire calculation

Figure 43 Insert details for day tour hire calculation

Code for insert

private void button2_Click_1(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into daytourhighercalculation values('" +
textBox1.Text + "','" + textBox2.Text + "','" + dateTimePicker1.Text + "','" +
dateTimePicker2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" +
textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text
+ "','" + textBox9.Text + "','" + textBox10.Text + "')";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Inserted successfully!");

Unit 01: Programming 89


Assignment 01
Update values for day tour hire calculation

Figure 44 Update package type

Code for update

private void button3_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "update daytourhighercalculation set packagetype='" +
textBox2.Text + "',starttime= '" + dateTimePicker1.Text + "',endtime='" +
dateTimePicker2.Text + "'
,startkm='"+textBox3.Text+"',endkm='"+textBox4.Text+"',maximumkm='"+textBox5.Text+"',p
riceperkm='"+textBox6.Text+"',waitingcharge='"+textBox7.Text+"',extrakmcharge='"+textB
ox8.Text+"',basehirecharge='"+textBox9.Text+"',totalhirecharge='"+textBox10.Text+"'
where vehicleno= '" + textBox1.Text + "'";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Upadted Successfully!");
}

Unit 01: Programming 90


Assignment 01
Delete value in day tour hire calculation

Figure 45 Delete detail from day tour hire calculation

Code for delete

private void button4_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "delete from daytourhighercalculation where Vehicleno='"
+ textBox1.Text + "'";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Deleted Successfully!");
}

Unit 01: Programming 91


Assignment 01
Long tour hire calculation

Insert detail for long tour hire calculation

Figure 46 Insert detail for long tour hire calculation

Code for insert

private void button2_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into longtourhirecalculation values('" +
textBox12.Text + "','" + textBox13.Text +
"','"+textBox1.Text+"','"+comboBox1.Text+"','"+textBox9.Text+"','" +
dateTimePicker1.Text + "','" + dateTimePicker2.Text + "','" + textBox3.Text + "','" +
textBox8.Text + "','" + textBox10.Text + "','" + textBox11.Text + "','" +
textBox7.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text
+ "','"+textBox2.Text+"')";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Inserted successfully!");
}

Unit 01: Programming 92


Assignment 01
Update values for long tour hire calculation

Figure 47 Update vehicle type

Code for update

private void button5_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "update longtourhirecalculation set customercontactno='"
+textBox13.Text+ "',vehicleno= '" +textBox1.Text+ "',vehicletype='" + comboBox1.Text +
"',packagetype='" + textBox9.Text + "',startdate='" +dateTimePicker1.Text +
"',enddate= '" +dateTimePicker2.Text+
"',maximumkm='"+textBox3.Text+"',pricepercharge='"+textBox8.Text+"',startkm='"+textBox
10.Text+"',endkm='"+textBox11.Text+"',driverovernightcharge='"+textBox7.Text+"',totalc
harge='"+textBox4.Text+"',basehirecharge='"+textBox5.Text+"',overnightstaycharge='"+te
xtBox6.Text+"',extrakmcharge='"+textBox2.Text+"' where customername='"+textBox12+"'";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Upadted Successfully!");
}

Unit 01: Programming 93


Assignment 01
Delete value for long tour hire calculation

Figure 48 Delete details in long tour hire calculation

Code for delete


private void button6_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "delete from longtourhirecalculation where
customername='" + textBox12.Text + "'";
cmd.ExecuteNonQuery();
con.Close();
data_view();
MessageBox.Show("Deleted Successfully!");
}

Unit 01: Programming 94


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

The debugging application is the routine the process of a locating and the removing computer
program bugs, errors and abnormalities. Which is methodically handled by the software
programmers through debugging tools and also debugging checks detects and corrects errors
or a bugs to the allow proper program operation according to the set of specifications and also
the debugging is also known as debug.

And also developing the software programs are undergo heavy testing ,updating
,troubleshooting and the maintenance and also usually the software include errors and the
bugs. Which are the routinely removed. In this debugging process complete software
programs are regularly compiled and the executed to the identify and rectify the issues. The
large software programs which contain millions of the source code lines are divided into the
small components. For an efficiency each component is the debugged separately at first
followed by the program as a whole (economictimes.indiatimes.com, 2018).

The features available in integrated development environment for debugging

Debugging menu

The top level debug menu has the most common debug commands

Figure 49 The debugging menu

Unit 01: Programming 95


Assignment 01
Break point

The break point is an intentional stop marked in the code of the application where execution
pauses for the debugging. This is allows the programmer to inspect the internal state of the
application at that point.

Figure 50 Break point in code

Run to click

The run to click is a related to setting a temporary breakpoint and also run to click is
a near for getting the around quickly within a visible the region of app code.

Figure 51 Run to click in visual studio

Unit 01: Programming 96


Assignment 01
Examine an exception

The exception is an indication of an error state that is occurs to while a program is being
executed. We can be should provide the handlers that respond to the most important
exceptions.

Figure 52 Examine exceptions

Configuration manager have been used to choose the method of debugging of with ion the
various phases in the process. The active solution platform is not and the configuration mode
can be choose from debug and release.

Unit 01: Programming 97


Assignment 01
Evaluate how you used the debugging process to develop more secure, robust application
with examples.

In my case I have used the debugging process broadly in developing my applications, which
is fairly significant. It kind of has done a main role in identifying and spotting many faults
and errors in my application code helping me to correct that faults and errors. However,
almost many of my applications developed literally are so huge in context of code and
complexity. The application is created in this valuation is an example of it in a generally main
way.
Creating these types of applications confidently basically had generally
lot of fault and errors in it, but however the debugging features are in the Visual studio IDE
usually has done a absolutely great role in the resolving them one of the basically main ways
I mostly got very out of fault and errors was, when the Visual studio IDE identifies faults and
present the errors with its place.so it very easy and useful to solve problems. However
particularly many logical errors will be automatically identified by the visual studio IDE. But
the Breakpoints feature for all intents and purposes has actually helped me in identifying
those conceptual errors in my code. The figure shows the way I used the breakpoints feature
to debug my application, which specifically is quite significant. However, when debugging
the application it is possible to identify the errors and faults, which have been created in the
system. When these errors are identified beforehand, therefore it is possible for use to make
sol.

Using the process of debugging it was able to identify the errors with in they stem easier to
identify the errors before hand. In case we have missed to declare a variable it will be shown
from the debug and will assist us in redirecting and understanding as what the error is.

Figure 53 Error list

Unit 01: Programming 98


Assignment 01
The most common message that is possible to get from Visual studio id some sort of
exception which prevents the program from interruption in the end user.

Figure 54 Exception

Unit 01: Programming 99


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

Coding stands are can be accepted as a collection of procedure for a specific programming
language that determines the programming style, procedure methods for various aspects of
the program written in that language. There are some critical attributes of software
development (webguruz.in 2017).
Coding stands for ensure that all developments write the code in a particular meaningful
language write according to the guidelines specified. This makes the code easy to understand
and provides counting in the code.

One of most essential factors in software system is the consisting of the coding standard. This
is because of it positively affecting the quality of the system, during the time the use of
software system, we need to ensure that the guideline do not deny each other. The source
code that use the stand should be also be harmony with the standard. The completed source
code should introduce as if a single developer has written the code. .

There are some benefits of coding standard and they are

Increase efficiency
Reduce complicity
Minimize the risk of project failure
Maintains should be easy
Correction of bugs
A comprehensive view

Unit 01: Programming 100


Assignment 01
Coding standard I have used in my application

On developing this application, I have used some of several coding standards and they are I
have used a good file structure, use of comments, indentation patterns and variable
declaration. However, these coding standards are very useful and important to my Ayubo
drive application.

Use of comments

A comment is a programmer readable explanation in the source code of a computer program.


So they are added with the purpose of making the source code easier for humans to
understand and are generally ignored by compilers and interpreters. However, I have used
these using of comments to describe what calculations take place

Renaming of the tables

When making databases the renaming of the tables have been done according to the name of
the form.

Unit 01: Programming 101


Assignment 01
Variable declaration

The variables are being declared at the beginning in each if the code in order to specify the
type of the data type that can be entered I the particular field. All the varaibles are to be
declared were used with the full name as it would be very easy for me to understand.

Indentation patterns

Indentation is one of the most important aspects in any programming domain. Indentation is
the placement of text farther to the right, or left, to separate it from surrounding
text. Indent style, in programming a convention governing the indentation of blocks of code
to convey the program structure.

Unit 01: Programming 102


Assignment 01
Coding standrad for team

When developing application in a team, its highly important to have coding standards.For
example Coding guidelines also help software developing teams to write consistent code
which is easy to read and understand for all team members. Establishing such guidelines can
be problematic if it is done wrong but it will be very beneficial for the whole team if it is
done the right way. The codeing standards in a team help to reduce the risk of project falier
and also the following codeing standets help to developer for the maintent of the software .
The codeing standets in a team help to minimize the risk of project failer and it reduce the
compleccity. Another important benefit for a team is to identify the ongoing process of the
fellow team members who may be developing a different part of the same process of the
application. If a proper coding standard were maintained within a team, it would be able to
switch between teams as anytime as everyone is familiar with the process of development.
When codeing standats are followed it is to make changes to the code when ever needed.
Actually the coding standards are very important and useful for a team.

Coding standrad for individual

Coding standard is very very highly important when we work as induvidually. It is not the
way in which a team develops a program, an individual would develop it. For a individual
following coding standards helps to get a clear idea of what is happening within the code and
also in case the devolopeing of the code it’s be stop the completion of theprogramme code be
given to a onther individual it is also possiable. How ever, another important benefit if that it
is possible to transfer the project to another programmer it can be done without a mess, as it
is easy to understand the coding if a single pattern is followed throughout the program. When
developing as an individual if coding standards are followed it will help the individual to
adapt to changes where he can go with the modern methods. If proper coding standards are it
is possibale to make changes to the system in a way that any one could understand. Finally
the coding standard are very important for individual.

Unit 01: Programming 103


Assignment 01
List of references
www.whatis.techtarget.com. 2018. What is algorithm. [ONLINE] Available at:
https://whatis.techtarget.com/definition/algorithm. [Accessed 15 July 2018].

www.owlgen.com. 2018. Characteristic of good algorithm. [ONLINE] Available at:


https://www.owlgen.com/question/what-is-an-algorithm-explain-characteristics-of-an-
algorithm-with-the-help-of-an-example. [Accessed 15 July 2018].

whatis.techtarget.com. 2018. What is flow chart [ONLINE] Available at:


https://whatis.techtarget.com/definition/flowchart. [Accessed 16 July 2018].

economictimes.indiatimes.com. 2018. pseudocode. [ONLINE] Available at:


https://economictimes.indiatimes.com/definition/pseudocode. [Accessed 16 July 2018].

www.studytonight.com. 2018. linear search. [ONLINE] Available at:


https://www.studytonight.com/data-structures/linear-search-algorithm. [Accessed 18 July
2018].

www.geeksforgeeks.org. 2018. binary search. [ONLINE] Available at:


https://www.geeksforgeeks.org/binary-search/. [Accessed 18 July 2018].

www.computerhope.com. 2018. dry run. [ONLINE] Available at:


https://www.computerhope.com/jargon/d/dryrun.htm. [Accessed 19 July 2018].

rob-bell.net. 2018. Big notions notation. [ONLINE] Available at: https://rob-


bell.net/2009/06/a-beginners-guide-to-big-o-notation/. [Accessed 19 July 2018].

prezi.com. 2018. Programming paradigm. [ONLINE] Available at:


https://prezi.com/xbpqj5wekzgf/procedural-object-oriented-and-event-driven-programming-
paradigms/. [Accessed 20 July 2018].

www.quora.com. 2018. what is paradigm. [ONLINE] Available at:


https://www.quora.com/What-is-the-meaning-of-a-programming-paradigm. [Accessed 20
July 2018].

www.quora.com. 2018. relationship for the paradigm. [ONLINE] Available at:


https://www.quora.com/What-are-the-relationships-between-programming-procedural-
object-oriented-and-even-driven-paradigms. [Accessed 20 July 2018].

www.onlineclassnotes.com. 2018. characteristics of procedural paradigm. [ONLINE]


Available at: https://www.onlineclassnotes.com/2013/08/what-are-main-characteristics-
of.html. [Accessed 25 July 2018].

Unit 01: Programming 104


Assignment 01
www.careerride.com. 2018. characteristics of object oriented paradigm. [ONLINE]
Available at: https://www.careerride.com/oops-characteristics.aspx. [Accessed 26 July
2018].

www.ukessays.com. 2018. characteristics of event driven paradigm. [ONLINE] Available


at: https://www.ukessays.com/essays/computer-science/eventdriven-programming-features-
6167.php. [Accessed 27 July 2018].

www.veracode.com. 2018. Ide. [ONLINE] Available at:


https://www.veracode.com/security/integrated-development-environments. [Accessed 31
July 2018].

msdn.microsoft.com. 2018. debugger. [ONLINE] Available at:


https://msdn.microsoft.com/en-us/library/sc65sadd.aspx. [Accessed 31 July 2018].

economictimes.indiatimes.com. 2018. debugging. [ONLINE] Available at:


https://economictimes.indiatimes.com/definition/debugging. [Accessed 2 August 2018].

Unit 01: Programming 105


Assignment 01
Gantt chart

Unit 01: Programming 106


Assignment 01

You might also like