Unit 01 - Programming Assignment

You might also like

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

Higher Nationals

Internal verification of assessment decisions – BTEC (RQF)


INTERNAL VERIFICATION – ASSESSMENT DECISIONS

Programme title HND Programming

Assessor Internal Verifier

Unit(s) Unit 01: Programming

Assignment title Design & Implement a GUI based system using a suitable Integrated
Development Environment
Student’s name K. A. Damith Sriyantha Karunathilake
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

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 1


Confirm action completed
Remedial action taken

Give details:

Assessor signature Date

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

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 2


Higher Nationals - Summative Assignment Feedback Form
Student Name/ID K. A. Damith Sriyantha Karunathilake / GAM/A-008724
Unit Title Design & Implement a GUI based system using a suitable Integrated
Development Environment
Assignment Number Unit 01 Assessor
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 suit
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.

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 3


Assignment Feedback
Formative Feedback: Assessor to Student

Action Plan

Summative feedback

Feedback: Student to Assessor

Assessor Date
signature

Student Date
signature

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 4


Pearson Higher Nationals in
Computing
Unit 01: Programming
Assignment 01

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 5


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.

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 6


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.

kadamith@gmail.com

Student’s Signature: Date:


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

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 7


Higher National Diploma in Computing
Assignment Brief
Student Name /ID Number K. A. Damith Sriyantha Karunathilake / GAM/A-008724

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

Submission Date

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.

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 8


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

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 9


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.

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 10


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

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 11


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

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

Activity 4

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

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

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

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 12


Grading Rubric

Grading Criteria Achieved Feedback

LO1 Define basic algorithms to carry out an operation


and outline the process of programming an
application.

P1 Provide a definition of what an algorithm is and outline


the process in building an application.

M1 Determine the steps taken from writing code to


execution.

D1 Examine the implementation of an algorithm in a suitable


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

LO2 Explain the characteristics of procedural, object


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

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 13


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

M2 Analyze the common features that a developer has


access to in an IDE.

D2 Critically evaluate the source code of an application


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

LO3 Implement basic algorithms in code using an IDE.

P3 Write a program that implements an algorithm using an


IDE.

M3 Use the IDE to manage the development process of the


program.

D3 Evaluate the use of an IDE for development of


applications contrasted with not using an IDE.

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 14


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

P4 Explain the debugging process and explain the


debugging facilities available in the IDE.

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

M4 Evaluate how the debugging process can be used to


help develop more secure, robust applications.

D4 Critically evaluate why a coding standard is necessary in


a team as well as for the individual.

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 15


Acknowledgement

I would like to thanks for our HND coordinator Mr. Theekshana Gunathilake. And also I
would like to thank my parents and all of my friends who gave hand to make this subject
assignment in a successful way.

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 16


Table of Contents
Activity 01................................................................................................................................ 23

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

1.1.1. What is an algorithm? ........................................................................................ 23

1.1.2. Characteristics of good algorithm ...................................................................... 23

1.1.3. Linear Search using Pseudo code ...................................................................... 24

1.1.4. Binary Search using Pseudo code ...................................................................... 25

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

1.2.1. Defining the problem ......................................................................................... 26

1.2.2. Planning the solution.......................................................................................... 27

1.2.3. Coding the program ........................................................................................... 28

1.2.4. Testing the program ........................................................................................... 28

1.2.5. Document the program ...................................................................................... 29

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

1.3.1. What is Big-O notion? ....................................................................................... 30

1.3.2. Efficiencies of algorithms .................................................................................. 30

1.3.3. Linear Search using Python ............................................................................... 31

1.3.4. Binary Search using Python ............................................................................... 32

Activity 02................................................................................................................................ 33

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

2.1.1. What is Programming Paradigm? ...................................................................... 33

2.1.2. Procedural programming ................................................................................... 33

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 17


2.1.3. Object-oriented programming ............................................................................ 34

2.1.4. Event-driven programming ................................................................................ 35

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

2.2.1. Three programming paradigms using suitable language(s) ............................... 36

2.2.2. What is an IDE? ................................................................................................. 39

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

2.3.1. Procedural programming (C++)......................................................................... 41

2.3.2. Object-oriented programming (C#) ................................................................... 42

2.3.3. Event-driven programming (Python) ................................................................. 43

Activity 03................................................................................................................................ 45

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

3.1.1. Function 1: Rent Calculation ............................................................................. 45

3.1.2. Function 2: Day tour – Hire Calculation............................................................ 46

3.1.3. Function 3: Long tour – Hire Calculation .......................................................... 47

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

3.2.1. Details of vehicle types and packages ............................................................... 48

3.2.2. Databases ........................................................................................................... 52

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

3.3.1. IDE features ....................................................................................................... 54

3.3.2. Overview of IDE benefits .................................................................................. 55

Activity 04................................................................................................................................ 58

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 18


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

4.1.1. Interfaces for Rent Calculation .......................................................................... 58

4.1.2. Interfaces for Hire Calculation........................................................................... 61

4.1.3. Add New Vehicle ............................................................................................... 63

4.1.4. Package .............................................................................................................. 66

4.1.5. History................................................................................................................ 68

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

4.2.1. What is Debugging? ........................................................................................... 72

4.2.2. Debugging process ............................................................................................. 76

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

4.3.1. Coding Standard................................................................................................. 77

4.3.2. Why is a coding standard necessary? ................................................................. 78

4.3.3. Why a coding standard is necessary in a team as well as for the individual? .... 79

Gantt chart ................................................................................................................................ 80

Bibliography............................................................................................................................. 81

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 19


List of Figure

Figure 1: Programming Process (Author Developed).............................................................. 26


Figure 2: Solution Flow chart .................................................................................................. 27
Figure 3: Linear Search using Python ...................................................................................... 31
Figure 4: Linear Search output................................................................................................. 31
Figure 5: Binary Search using Python ..................................................................................... 32
Figure 6: Binary Search output ................................................................................................ 32
Figure 7: C++ Code ................................................................................................................. 36
Figure 8: C++ output ................................................................................................................ 36
Figure 9: OOP code.................................................................................................................. 37
Figure 10: OOP output ............................................................................................................. 37
Figure 11: Event-driven code ................................................................................................... 38
Figure 12: Event-driven output ................................................................................................ 38
Figure 13: Rectangle Class ...................................................................................................... 42
Figure 14: Vehicle charges ...................................................................................................... 52
Figure 15: Rent......................................................................................................................... 52
Figure 16: Hire ......................................................................................................................... 52
Figure 17: Add new vehicle ..................................................................................................... 53
Figure 18: Package ................................................................................................................... 53
Figure 19: Correct coding ........................................................................................................ 55
Figure 20: Debugging .............................................................................................................. 56
Figure 21: Customize ............................................................................................................... 57
Figure 22: Rent with driver ...................................................................................................... 58
Figure 23: Select category and charge ..................................................................................... 59
Figure 24: Rent with Driver Calculation.................................................................................. 59
Figure 25: Rent without Driver ................................................................................................ 60
Figure 26: Select category and charges.................................................................................... 60
Figure 27: Rent without Calculation ........................................................................................ 61
Figure 28: Hire Calculation...................................................................................................... 61
Figure 29: Select category and base hire ................................................................................. 62
Figure 30: Calculate Days ........................................................................................................ 62
Figure 31: Calculate Hire ......................................................................................................... 63
Figure 32: Add New Vehicle ................................................................................................... 63

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 20


Figure 33: Generate an Auto ID ............................................................................................... 64
Figure 34: Add New Vehicle ................................................................................................... 64
Figure 35: Update Vehicle Details ........................................................................................... 65
Figure 36: Delete Vehicle ........................................................................................................ 65
Figure 37: Package ................................................................................................................... 66
Figure 38: Generate an Auto ID ............................................................................................... 66
Figure 39: Add Package ........................................................................................................... 67
Figure 40: Update Package ...................................................................................................... 67
Figure 41: Delete Package ....................................................................................................... 68
Figure 42: History of Rent ....................................................................................................... 68
Figure 43: Retrieve Rent Data ................................................................................................. 69
Figure 44: Search Grid Data - Rent ......................................................................................... 69
Figure 45: History of Hire ........................................................................................................ 70
Figure 46: Search Grid Data - Hire .......................................................................................... 70
Figure 47: Retrieve Hire Data .................................................................................................. 71
Figure 48: Source Level Debugger .......................................................................................... 73
Figure 49: Debug a Running Process ....................................................................................... 73
Figure 50: Breakpoint .............................................................................................................. 74
Figure 51: Edit and Continue ................................................................................................... 75
Figure 52: Value and Variable ................................................................................................. 75

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 21


List of Table

Table 1: Vehicle daily rate ....................................................................................................... 48


Table 2: Hire package 1 ........................................................................................................... 50
Table 3: Package Hire 2 ........................................................................................................... 51

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 22


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.

1.1.1. What is an algorithm?


An algorithm is a set of instructions designed to perform a task. This can be a simple process
like multiplying two numbers. Search engines use proprietary algorithms to show the most
relevant results from their search index for specific queries. In computer programming,
algorithms are often created as functions. These functions serve as small programs that can be
redirected to a larger program. For example, a software application may include a collection
of functions that use an algorithm to present different code formats. Examples of computer
configuration algorithms include configuration, space, and activation.

1.1.2. Characteristics of good algorithm


Not all cryptographic procedures can be called algorithms. In particular, an algorithm should
have the following features:

 Unambiguous − Algorithm should be clear and unambiguous. Each of its steps (or
phases), and their inputs/outputs should be clear and must lead to only one meaning.
 Input − An algorithm should have 0 or more well-defined inputs.
 Output − An algorithm should have 1 or more well-defined outputs, and should
match the desired output.
 Finiteness − Algorithms must terminate after a finite number of steps.
 Feasibility − Should be feasible with the available resources.
 Independent − An algorithm should have step-by-step directions, which should be
independent of any programming code.
(tutorialspoint, 2020)

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 23


1.1.3. Linear Search using Pseudo code
LinearSearch(list, target_element):
{
initialize index = 0
while (index < number of items in the list)
{
if (list[index] == target element)
{
return index
}
increment index by 1
}
return -1
}
(Tarade, 2019)

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 24


1.1.4. Binary Search using Pseudo code
BinarySearch(a, n, key)

Begin

Set start = 0, end = n-1, mid = (start + end)/2;

while( start <= end && a[mid] != key) do

if (key < a[mid]) then

Set end = mid – 1; //search in the left half

else

Set start = mid + 1; //search in the right half

endif

Set mid = (start + end)/2;

endwhile

if(start > end)

return -1; //key not found

return mid; //returning key index

End

(dyclassroom)

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 25


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.

It usually consists of a code generation method and an execution method. Code generation is
usually done in a special computer language. This is usually a collection of short words and
special characters written in a special structure called syntax.

Code execution means that the computer usually reads the code and understands what it takes
to start processing it. The code will be based on the method used by the computer to convert
it into machine instructions.

There are five main ingredients in the programming process:

1.2.1. Defining the problem


It is essential to identify a problem before solving it. Meets users of the client organization to
analyze the problem. Or meet with a system analyst who provides information about the
project. Specifically, the task of defining a problem consists of identifying it and the output
required to obtain it. Finally, you submit a written agreement. Specifies, among other things,
the required input processing and output. This is not a simple process.

Input Process Output

Figure 1: Programming Process (Author Developed)

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 26


1.2.2. Planning the solution
Two common methods of designing a solution to a problem are drawing a flow chart and
writing a pseudo-code, or both. A flow chart is a graphical representation of a step-by-step
solution to a problem. The program consists of boxes and other symbols representing arrows
and vertices indicating the direction of travel. It's a map of what your program is going to do
and how to do it.

Pseudo code is a non-standard language such as English. That solution allows you to
pronounce more accurately in plain English, but with less accuracy than is required when
using a formal programming language. Pseudo code allows you to focus on program logic
without having to worry about the specific phrase in any programming language.

Figure 2: Solution Flow chart

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 27


1.2.3. Coding the program
The next step as a programmer is coding. That is, the solution is to express it in a
programming language. You can translate the logic into a programming language using a
flow chart or a pseudocode or other tool. The programming language is a set of rules. At the
same time, it instructs its computer on what to do with the programming language. There are
many programming languages: Java, C#, C++, .Net and Visual Basic are some examples.

Programming languages are grammatically functional. They are as accurate as the English
language. In order for the program to run, the phrase in the language used must be applied
correctly. Of course, using the language correctly does not guarantee that the program will
work. The main point here is that the first step is to use the language correctly. The coded
program must then be typed. Often in a way that the computer can understand using a
terminal or personal computer.

1.2.4. Testing the program


Some say that a well-designed program can be written correctly for the first time. In fact,
some would say that there are mathematical methods to prove that a program is correct. So
many programmers may have some bugs in the newly written programs and at first this is a
bit discouraging. Because programmers are precise, careful, detailed people who take pride in
their work. There are still many opportunities to introduce errors to any program. Just like the
ones before you, you will find some new ones.

Finally, the program will encode the test after encryption. These step-by-step steps include:

 Desk-checking - After writing any program, a programmer will be interested in running it


on his computer. However, a careful inspection of the program can help identify errors
and save time. The logic of the program, which seeks to ensure flawlessness and
functionality, is that many organizations take this stage one step further.
 Translating - The translator will check the program's phrases to make sure that the
programming language is used correctly and return all the syntax-error messages known
as its diagnosis. The program then converts it to a computer form.
 Debugging - A widely used application in both programming and debugging, it usually
detects, locates, and corrects errors by running the program. These errors are logical

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 28


errors, telling a computer to repeat an operation does not tell it how to stop repeating. At
this stage the program is executed using the test data designed.

1.2.5. Document the program


Documentation is an essential process. It will help you as well as many programmers to carry
out more interesting computer activities. Documentation is a written description of a
computer program and the facts about the program. The ideas of the program will also be
accepted as an essential part of the documentation. Most programmers document when they
are coded.

The trusted programmer documents those facts throughout the program design, development,
and testing. It is essential to document human memory and program design, and
documentation will be very important for dealing with others who are interested in the
program.

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 29


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.

1.3.1. What is Big-O notion?


Big O notation is a mathematical notation, and it describes the behavior of a limited function
when oriented toward specific argument or infinite value. In other words, Big O notation is a
basic tool for computer scientists to analyze the cost of an algorithm. It was discovered by
Paul Bachmann and Edmund Landau. Collectively, this is also known as the Bachmann-
Landau numbering or asymmetric numbering.

1.3.2. Efficiencies of algorithms


The Big-O notation provided a machine-independent efficiency that allowed the algorithm to
be compared. It makes more sense for larger input volumes. It ignores the constant factors
that are inherent in the algorithm. Measuring the efficiency of an algorithm does not depend
on time alone. Instead it is based on many factors. Algorithm performance is described by the
following factors.

 Time efficiency
 Space efficiency

Time efficiency is calculated using the CPU. Space efficiency is calculated using an
algorithm memory and disk.

The developer will know the difference between performance and complexity. Complex
analysis does not depend on any computer resource. It will vary depending on the size of the
input. Algorithm performance is machine independent and does not depend on other factors.

The algorithm should be based on analysis machines independently. RAM mode is the
analysis of memory models that measure the runtime by calculating the steps used to compute
the algorithm. It may vary depending on the size of the input. However, this algorithm
analysis does not depend on the type of computer. The worst case scenario is to help the
algorithm behave in the worst case scenario and to understand the algorithm functionality.

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 30


Big O notation simplifies algorithm analysis by asking simple questions to simplify algorithm
functionality. Big O numbering simplifies the comparison of the algorithm.

1.3.3. Linear Search using Python

Figure 3: Linear Search using Python

Linear Search output

Figure 4: Linear Search output

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 31


1.3.4. Binary Search using Python

Figure 5: Binary Search using Python

Binary Search output

Figure 6: Binary Search output

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 32


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.

2.1.1. What is Programming Paradigm?


A programming paradigm is a philosophy, style, or general approach to writing code. Most
definitions of the term are so broad as to be fairly useless-the term tends to make more sense
when discussing specific paradigms.

If you are programming from Python or C, you are using essential programs. Essential
programming defines a solution to a problem as a series of steps. Programs written in the
essential style are often similar to recipes. Essential programs often assign new variables that
change the status of the program on each line and refer to or modify the old ones. Small
problems are intelligent to solve and essential programs cannot be controlled quickly when
they are large.

(Smyth, 2018)

There are three main programming paradigm characteristics.

2.1.2. Procedural programming


Procedural programming is a method of assisting in dividing functionality into a number of
programs. In procedural programming, a large program is divided into smaller manageable
parts known as procedures or functions. Here tasks are given priority over data. Procedures In
a programming language, a program basically consists of a series of instructions. Each of
them tells the computer to read the user's input, calculate the required number, and show the
output.

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 33


Characteristics of procedural programming:

 A large program is divided into smaller manageable procedures or tasks.


 Reduces code duplication, thereby increasing the readability and maintenance of the
code.
 Data can be shared across global variables by different functions.
 Tasks can change global data.
 Procedural programming follows the top-down methodology. That is, the workflow
moves from top to bottom.

(lightbringer, 2019)

2.1.3. Object-oriented programming


Object Oriented Programming (OOP) is a programming model based on the concept of
classes and objects. A software program is used to structure a simple, reusable code plan into
pieces. In other words, since OOP is a programming model, it has many object-oriented
programming languages including: C++, Java, C #, and Python. (Doherty, 2020)

Characteristics of object-oriented programming:

 Emphasis on data rather than action procedure.


 Data structures are designed in such a way that they are characterized by objects.
 Functions that function on an object's data are associated with data structures.
 Data is hidden and cannot be accessed by external activities.
 New data and functions can be easily added when needed.
 Follows the bottom line when planning a program.

(careerride)

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 34


2.1.4. Event-driven programming
Event-based programming is when a program is created to respond to contact users in a
variety of ways. It is called a programming model. Meanwhile, it is the flow of program
implementation that is determined by the events involved. Events are any user interaction
such as clicking or pressing in response to a query from the system. Events are monitored by
a code called event listener. (Edge Tech Academy)

Characteristics of event-drive programming:

 Service Orientation - Service focus will be a key component of the programs used to
create programs. At the same time, service orientation is a small part of computer
control power because it is not slow.
 Time Driven - Affected time is an ideal in an event-driven programming.
 Event handlers - Event handlers are the kind of people who execute a specific action
when a specific event is requested.
 Triggers Functions - Induction-based coding functions are functions that determine
which code should be performed when a specific event occurs.
 Events - Events include the mouse, computer keyboard, and user interface, and events
must be triggered in order for this to happen.

(Maria, 2018)

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 35


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

2.2.1. Three programming paradigms using suitable language(s)


1. Procedural programming (C++)

Figure 7: C++ Code

Figure 8: C++ output

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 36


2. Object-oriented programming (C#)

Figure 9: OOP code

Figure 10: OOP output

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 37


3. Event-driven programming (Python)

Figure 11: Event-driven code

Figure 12: Event-driven output

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 38


2.2.2. What is an IDE?
Integrated Development Environment (IDE) is software for building applications that
integrates common developer tools into a single graphical user interface (GUI). At the basic
level, the IDE provides users with interfaces to write code, write a sentence, and run a
program. But instead of a skeletal code editor, IDEs combine the functionality of multiple
programming processes into one. Some IDEs focus more on programming languages such as
Java. But IDEs like Android Studio and Visual Studio have cross-language capabilities.

Creates a hierarchy in the IDE for one or more users throughout the writing process, attaching
those code groups to their named region. Of these, teams can be grouped together, organized
and built. Most IDEs come with Built-Debugger, which enables build. Visual debugging is a
significant benefit of most IDEs. If any errors or omissions are found, the IDE will indicate
which parts of the code are having problems.

Common features of Integrated Development Environment:

1. Text editor - Almost every IDE has a text editor for writing source code and running
code. Some tools may have visible components for dragging the front parts. But most of
them have a simple interface with the highlighting of language specific syntax.
2. Debugger - debugging tools that help users identify and fix bugs in the source code. They
often mimic real-world events to test functionality. Programmers and software engineers
usually check various parts of the code and identify errors before releasing the
application.
3. Compiler - A programming language that converts components into a format machine
and can function as binary code. The machine code is analyzed to ensure its accuracy.
The compiler then analyzes and optimizes the code to optimize performance.
4. Code completion - Supports complete code programmers by intelligently identifying and
entering minor code formats these features save developers time-consuming code and
reduce the likelihood of typos and errors.
5. Programming language support - IDEs are usually specific to a single programming
language, but several will provide multilingual support. So, the first step is to find out

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 39


which languages the code will be edited for and reduce the future IDE list accordingly.
Examples include Python and Java IDE tools.
6. Integrations and plugins - It is not surprising to consider integrations when looking at
IDE. The IDE is the development portal, so being able to integrate all other development
tools will improve the development workflow and productivity. Poor integration can
cause a lot of problems and many headaches, so be sure to understand how well a
potential IDE fits into your existing tool ecosystem.

(Walker, 2018)

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 40


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

Three structures and the unique characteristics:

2.3.1. Procedural programming (C++)


One of the main reasons why C++ is used for procedural programming is not only because it
is easy to perform in such programming languages, but also because it applies all the relevant
classes to one page. And if there is any error here it is to point it out clearly. In C++ each
code starts with “#include <iostream>”. Then “using namespace std;” will be applied, and
then the “int main ()” method will inevitably be applied to C++. Any encoding under this
system takes place and this is where the entire code runs. According to the above code, there
are two arrays, “int” and “char”. Here “int” is Integer and will always use only numbers. And
“char” here means characters and will always use only letters. These two arrays or any other
code, or information for any system, runs information “cout<<number<<endl;” According to
the name code. The code above is “cout<<number[0]<<endl;” The main reason for giving
value with a local variable as is that an array has been used for this code.

Advantages of procedural programming:

 Procedural programming is great for general task programs.


 Coded simplicity and ease of implementation for compilers and converters.
 The source code is portable and can be used to target another CPU.
 The code can be reused in different parts of the program without the need to copy it.
 The need for memory is also reduced through procedural programming technology.
 Program streams can be easily found.

(Bhatia, 2020)

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 41


2.3.2. Object-oriented programming (C#)
The most commonly used programming languages for object-oriented programming (OOP)
are Java and C#, where the C# language is used for the above code, and a separate class is
called to run the code. The “main class” in the code shown here is a subclass called
“Rectangle”. The subclass here is “Changed;” and “length;” said a public event and set up a
private field and they include the "public double" said the double-precision, and has been
used for field parameter.

Figure 13: Rectangle Class

As mentioned above, the subclass “Rectangle” is called the main class. Here “r” is used as the
local variable for the subclass called “Rectangle”. That local variable is represented by a void
program called “EventHandler”. Then “Length” is represented for the “public double” in the
subclass and a value is added under it. It reads “r.Length = 10;” as. The subclass “Rectangle”
is called the “sender” parameter under a separate static method “r_Changed” in the main
class. Finally here is “Console.WriteLine("Value Changed: Length = {0}”, r.Length);” The
value mentioned earlier will run in parentheses mentioned here.

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 42


Advantages of object-oriented programming (OOP):

 Re-usability - This method is easier than re-creating a program. This is done using a
class. It can be used any number of times as required.
 Data Redundancy - Data redundancy is one of the biggest advantages of OOP. If a
user wants similar functionality in multiple classes, they can proceed by writing
common class definitions for similar functions.
 Code Maintenance - This feature is more required than any other programming
language and allows users to rework it in many different ways. Existing codes always
save time in maintaining and modifying it by adding new changes to it.
 Security - The programmer maintains security and provides the data needed to view.
 Design Benefits - The design benefit to the user is that they can easily design and
correct things as well as eliminate risks. Here object-oriented programs force
designers to enter a design phase.
 Better productivity - Definitely increases the overall productivity of its users when
using the app. This allows them to do more work, complete a better program, has
more unique features and is easier to read, write and maintain.

(educba)

2.3.3. Event-driven programming (Python)


Python programming language was used here for event-driven programming. The code that
appears here indicates that the code starts with “import”. The word “import” is preceded by a
code name for any programming language, not just Python, but Java and C#. Here the word
“def” is abbreviated to mean „define‟. It is a keyword that should define a function. Then all
the code placed between the function_name and the end is executed every time
function_name is dialed. Here function_name is given as “hello_world”. Here a parameter is
used in parentheses after the function name “hello_world”. It is very important in code
running. This parameter gives a stop after the print value of the code. Here the parameter
“loop” will make the code name get event. This parameter will then call the method
“hello_world” and the parameter “loop”. Eventually this parameter will be ready to run and
close that parameter.

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 43


Advantages of event-driven programming:

 Flexibility - Programmers that use event-driven can be altered easily if the


programmer wants something to be changed. This paradigm allows the programmer to
produce a form of their requirements.
 Suitability for Graphical Interfaces - Event-driven allows the user to select
different tools from the toolbar to directly create what they need such as buttons, radio
buttons, etc.
 Simplicity of Programming - Event-driven can make programming easier for some
by being able to directly edit the object you want the code for.
 Easy to Find Natural Dividing Lines - it‟s easy to find natural dividing lines for unit
testing infrastructure.
 Highly Compostable - it‟s highly compostable.
 Simple and Understandable - It allows for a very simple and understandable model
for both sides of the DevOps Bridge.

(Partner, 2019)

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 44


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:

3.1.1. Function 1: Rent Calculation


(Rent with driver)

Step 1: Start

Step 2: Rent per day / Rent per week / Rent per month

Step 3: Vehicle category, rented date, return date

Step 4: Set a table in MySQL, Daily rent and drive rent, Linking Visual Studio to MySql

Step 5: Calculate the charges for the numbers of days with module:

Basic Rent: Daily rent * Number of days

Step 6: Add driver rent

Step 7: Calculate the total rent for the module:

Rent with driver: Basic rent (Daily rent * Number of days) + driver rent

Step 8: Calculate total rent

Step 9: End

(Rent without driver)

Step 1: Start

Step 2: Rent per day / Rent per week / Rent per month

Step 3: Vehicle category, rented date, Return date

Step 4: Set a table in MySQL, Daily rent and drive rent, Linking Visual Studio to MySql

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 45


Step 5: Calculate the charges for the numbers of days with module:

Basic Rent: Daily rent * Number of days

Step 6: Calculate total rent

Step 7: End

3.1.2. Function 2: Day tour – Hire Calculation


Step 1: Start

Step 2: Select tour hire category

Step 3: Select vehicle category, Select package type, input driver fee, Start km, Ending km

Step 4: Calculate starting date to ending date in duration

Duration: Start date – End date

Step 5: According to select package type on display the base hire, night park charge,
overnight charge, waiting charge, extra km charge and extra hour charge.

Step 6: Calculate pay hire for the module:

Total hire: Base hire + Night Park + overnight + waiting charge + extra km charge + extra
hour charge

Step 7: Calculate pay hire

Step 8: End

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 46


3.1.3. Function 3: Long tour – Hire Calculation
Step 1: Start

Step 2: Select tour hire category

Step 3: Select vehicle category, Select package type, input driver fee, Start km, Ending km

Step 4: Calculate starting date to ending date in duration

Duration: Start date – End date

Step 5: According to select package type on display the base hire, night park charge,
overnight charge, waiting charge, extra km charge and extra hour charge.

Step 6: Calculate pay hire for the module:

Total hire: Base hire + Night Park + overnight + waiting charge + extra km charge + extra
hour charge

Step 7: Calculate pay hire

Step 8: End

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 47


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

3.2.1. Details of vehicle types and packages


 Function 1

Category ID Vehicle Category Daily rate

1 Small car 1500

2 Sedan 2000

3 SUV 2500

4 Jeep 3000

5 Seven seat van 3500

6 Commuter van 4000

Table 1: Vehicle daily rate

 Function 2

Package Vehicle Max Max Rent Extra Extra Driver


KM Hours hour km rate Rent
rate

Airport Small 100 km 12 1500 150 100 5000


drop

Airport Sedan 100 km 12 2000 150 100 5000


drop

Airport Small 200 km 12 1500 200 200 5000


pickup

Airport Sedan 200 km 12 2000 200 200 5000

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 48


pickup

Airport SUV 200 km 12 2500 200 200 5000


pickup

Airport Seven seat 200 km 12 3500 200 200 5000


pickup van

Airport Commuter 200 km 12 4000 200 200 5000


pickup van

100 km Small 250 km 24 1500 200 300 5000


per day

100 km Sedan 250 km 24 2000 200 300 5000


per day

100 km SUV 250 km 24 2500 200 300 5000


per day

100 km Jeep 250 km 24 3000 200 300 5000


per day

100 km Seven seat 250 km 24 3500 200 300 5000


per day van

100 km Commuter 250 km 24 4000 200 300 5000


per day van

200 km Small 350 km 24 1500 250 350 5000


per day

200 km Sedan 350 km 24 2000 250 350 5000


per day

200 km SUV 350 km 24 2500 250 350 5000


per day

200 km Jeep 350 km 24 3000 250 350 5000


per day

200 km Seven seat 350 km 24 3500 250 350 5000


per day van

200 km Commuter 350 km 24 4000 250 350 5000

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 49


per day van

Summer Small 400 km 72 1500 300 400 6000


tour

Summer Sedan 400 km 72 2000 300 400 6000


tour

Summer SUV 400 km 72 2500 300 400 6000


tour

Summer Jeep 400 km 72 3000 300 400 6000


tour

Summer Seven seat 400 km 72 3500 300 400 6000


tour van

Summer Commuter 400 km 72 4000 300 400 6000


tour van

Table 2: Hire package 1

 Function 3

Package Vehicle Max Max Rent Overnight Extra Driver


KM days rate km rate Rent

Airport Small 100 km 2 8250 150 100 5000


drop

Airport Sedan 100 km 2 9250 150 100 5000


drop

Airport SUV 200 km 2 10400 200 200 5000


pickup

Airport Seven seat 200 km 2 12400 200 200 5000


pickup van

Airport Commuter 200 km 2 13400 200 200 5000


pickup van

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 50


100 km Small 250 km 2 8450 200 250 5000
per day

100 km Sedan 250 km 2 9450 200 250 5000


per day

100 km SUV 250 km 2 10450 200 250 5000


per day

100 km Jeep 250 km 2 11450 200 250 5000


per day

100 km Seven seat 250 km 2 12450 200 250 5000


per day van

100 km Commuter 250 km 2 13450 200 250 5000


per day van

200 km Small 350 km 3 10050 250 300 5000


per day

200 km Sedan 350 km 3 11550 250 300 5000


per day

200 km SUV 350 km 3 13050 250 300 5000


per day

200 km Jeep 350 km 3 14550 250 300 5000


per day

200 km Seven seat 350 km 3 16050 250 300 5000


per day van

200 km Commuter 350 km 3 17550 250 300 5000


per day van

Table 3: Package Hire 2

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 51


3.2.2. Databases

 VEHICLE CHARGES

Figure 14: Vehicle charges

 RENT

Figure 15: Rent

 HIRE

Figure 16: Hire

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 52


 NEW VEHICLE

Figure 17: Add new vehicle

 PACKAGE

Figure 18: Package

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 53


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.

3.3.1. IDE features


Text editors - have their own source code for writing text in integrated development
environments. There may be visual components to support certain elements. Programs are
easy to use interfaces with specific language syntax.

Debugger - This is how the source code is fixed when there is a problem with the code.

Compiler - This is how it works as a translator for various programs such as binary code.
Here the translator looks at the accuracy of the data and the compiler interprets the code.

Code completion - This helps the programmer to identify common code elements. This saves
the programmer time and minimizes problems before they occur.

Programming language support - Externally IDE is a single programming language that


also supports multiple languages.

Integrations and plugins - The gateway to developing an IDE program. This is because
development and sophistication can be improved by integrating other development tools.
Therefore, a developer must understand whether this potential IDE fits the essence of his
work.

Famous IDE: Netbeans, Microsoft Visual Studio, Android Studio

Advantages of IDE:
 Easy to use.
 Simplifies the creation of database applications.
 No detailed knowledge of the database is required.
 Provides predefined facilities for searching, sorting, retrieving and processing data
within a database

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 54


 It also facilitates the creation of an attractive user interface with menu, button and text
boxes, etc.

(jabeen)

3.3.2. Overview of IDE benefits


Microsoft Visual Studio is used to set up and run this system.

 Correct Coding

The C# programming language is used here in the Visual Studio IDE, providing live
encoding support regardless of the programming language. Provides hints and details about
the platform's built-in IntelliSense API, and automatically completes lines for better speed. In
addition, the user completes the code required for the system. If there is any error in the code,
it is indicated by an underline.

Figure 19: Correct coding

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 55


 Quick Debugging

Error detection can be a challenge, but the left side of the Visual Studio IDE has a lot of
tools. The troubleshooting support platform is available for all languages included. This
process can be done locally, remotely, and in the middle of production, allowing developers
to apply it to desktop or mobile devices and other debugging methods.

Figure 20: Debugging

 Rigorous Testing

Visual Studio features an IDE application testing platform that ensures that developers are
ready to deploy high quality products. They can do this in the language and test framework of
their choice with minimal effort.

 Team Collaboration

The makers of Visual Studio IDE understand that eye sets are better than one eye. That‟s why
the platform has collaborative capabilities that increase team productivity. These tools are
closely integrated with the development life cycle.

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 56


Furthermore, Visual Studio IDE works well in collaboration mode, regardless of each
member's preferred platform.

 Customized Options

Visual Studio IDE offers customization options for every user. They can expand the
functionality of the platform through extensions and add-ons available from the Visual Studio
market.

Figure 21: Customize

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 57


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.

4.1.1. Interfaces for Rent Calculation


 Rent with Driver

Figure 22: Rent with driver

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 58


Figure 23: Select category and charge

Figure 24: Rent with Driver Calculation

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 59


 Rent without Driver

Figure 25: Rent without Driver

Figure 26: Select category and charges

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 60


Figure 27: Rent without Calculation

4.1.2. Interfaces for Hire Calculation

Figure 28: Hire Calculation

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 61


Figure 29: Select category and base hire

Figure 30: Calculate Days

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 62


Figure 31: Calculate Hire

4.1.3. Add New Vehicle

Figure 32: Add New Vehicle

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 63


Figure 33: Generate an Auto ID

Figure 34: Add New Vehicle

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 64


Figure 35: Update Vehicle Details

Figure 36: Delete Vehicle

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 65


4.1.4. Package

Figure 37: Package

Figure 38: Generate an Auto ID

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 66


Figure 39: Add Package

Figure 40: Update Package

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 67


Figure 41: Delete Package

4.1.5. History
 History of Rent

Figure 42: History of Rent

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 68


Figure 43: Retrieve Rent Data

Figure 44: Search Grid Data - Rent

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 69


 History of Hire

Figure 45: History of Hire

Figure 46: Search Grid Data - Hire

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 70


Figure 47: Retrieve Hire Data

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 71


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.2.1. What is Debugging?


In computer programming and engineering, debugging is a multi-process process that
identifies a problem in one‟s system, isolates the source of the problem, and fixes the
problem or a way to work around it. The final step in debugging is to repair or activate your
system and make sure it is working.

In software development, the debugging process begins when a developer is able to find and
reproduce an error in the code of a computer program. Debugging is part of the software
testing process and is an integral part of the overall software development lifecycle.

(Rouse)

Debugging features of Visual Studio

1. Source level debugger

Debugging that appears in a line or expression in the source code is machine code for a
running memory program. Instead of machine control instructions and memory, it is used to
analyze the behavior of programs for high-level applications such as root control flow control
constructions, operating procedures, and designated variables.

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 72


Figure 48: Source Level Debugger

2. Debug a running process

This is a troubleshooting process in the visual studio used by the programmer. If this is the
source code, the code is displayed.

Figure 49: Debug a Running Process

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 73


3. Breakpoints

Debugging allows you to set breakpoints. This allowed them to suspend their operations.

Figure 50: Breakpoint

4. Controlled execution of the code

The following 4 steps will help you to control how Breakpoints work.

I. Step End
II. Take action
III. Exit
IV. IntelliTrace

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 74


5. Edit and Continue

This allows the programmer to edit the code during debugging.

Figure 51: Edit and Continue

6. Display values of variable

There are three options for checking current values encoded by the visual studio programmer.

I. Data tools
II. Quick clock
III. Add the clock

Figure 52: Value and Variable

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 75


4.2.2. Debugging process
 If there is a problem with the system as the first step in debugging, that problem
should be reproduced.
 Once reproduced, it should be described to facilitate debugging. To do this, the
programmer must simplify the input of the program.
 When an error appears, take a quick photo of the program and try to get all the
variable values and conditions in that program.
 Analyze the problem based on the situation and the action and try to find the cause of
the error based on that.
 Correct the existing error. But that no new error occurs.

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 76


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.

4.3.1. Coding Standard


Sometimes a coding standard is an accepted usage for a language. For example, programmers
C# programmers generally accept that when writing source code, they write parameters and
personal and security fields using a cover. This means they will write all the other identities
using a Pascal cover. This means that the programmer can quickly identify parts by looking at
a C# source code written by someone else. This increases the ability to read.

In professional environments, the advantages of coding standards are readability,


maintainability, and compatibility. A code written by anyone in a development can be read by
another member. With encoding standards, different groups can rely on how they interact
with the code built by a separate team.

Benefits:

 Code integration
 Team member integration
 Maintenance
 Uniform problem solving
 Minimizes communication
 Minimizes performance pitfalls
 Saves money due to Less man hours

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 77


4.3.2. Why is a coding standard necessary?
Without a coding standard, developers will use their own methods for encoding. In the
meanwhile this will face some decisive implications.

1. Security Issues: Inconsistencies and logic errors are the main reasons for software
insecurities that are commonly exploited in software. Many of these problems arise due to
poor coding and programming errors caused by their running.
2. Site Performance Issues: Incompatible encoding will affect the overall functionality of
the site. Various performance issues include:
 User interaction
 Server response
 Ability to reuse code
 Flow problems

Implementing coding standards avoids these issues and provides the user with a secure
website with minimal performance issues.

That‟s why Ayubo developers have used application-specific encoding standards, such as
camel masks, Pascal casing, Hungarian numbering, screaming hats, short applications, curved
brackets, and space between all operators and brackets. These standards make the
programmer‟s application more effective. Any developer can and will easily implement new
updates now and in the future because the structure is easily identifiable.

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 78


4.3.3. Why a coding standard is necessary in a team as well as for the individual?
Encoding standards help reduce this, as a system developed by a unitary developer can be
complicated for other developers to understand. Each developer also has their own encoding
style created. Therefore, those standards should also be documented. This allows other
developers to connect to the application from the beginning.

The coding standards of a group will not be the same for an individual. Since group
communication requires good communication, there should be no misunderstandings when
developing applications. For example, if a developer uses a short application, the application
may not be understood by another developer. Encoding standards should therefore be
discussed and outlined, as this can save time, money and labor.

Coding standards even help keep secrets between members of one group and members of the
other.

Using a standard encoding standard will provide efficiency and reliability.

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 79


Gantt chart
2020 October 04 – October 14
Task Description
04 05 06 07 08 09 10 11 12 13 14

Task 01 - Define basic


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

Task 02 - Explain the


characteristics of
procedural, object
orientated and event-
driven programming,
conduct an analysis of a
suitable Integrated
Development
Environment

Task 03 - Implement
basic algorithms in code
using an IDE.

Task 04 - Determine the


debugging process and
explain the importance of
a coding standard.

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 80


Bibliography
1. Bhatia, S. (2020, August 24). Procedural Programming [Definition]. Retrieved October
08, 2020, from hackr.io: https://hackr.io/blog/procedural-programming
2. careerride. (n.d.). Characteristics of Object Oriented programming language - oops.
Retrieved October 07, 2020, from https://www.careerride.com/oops-characteristics.aspx

3. Doherty, E. (2020, April 15). What is Object Oriented Programming? OOP Explained in
Depth. Retrieved October 07, 2020, from educative:
https://www.educative.io/blog/object-oriented-programming

4. dyclassroom. (n.d.). Binary Search. Retrieved October 04, 2020, from


https://dyclassroom.com/searching-algorithm/binary-search

5. Edge Tech Academy. (n.d.). Event-Driven Programming. Retrieved October 07, 2020,
from edgetechacademy: https://www.edgetechacademy.edu/node-js/event-driven-
programming/

6. educba. (n.d.). Advantages of OOP. Retrieved October 08, 2020, from EDUCBA:
https://www.educba.com/advantages-of-oop/

7. jabeen, s. (n.d.). What Is IDE? What Are The Advantages And Disadvantages Of IDE?
Retrieved October 12, 2020, from business-finance: https://business-
finance.blurtit.com/109106/what-is-ide-what-are-the-advantages-and-disadvantages-of-
ide

8. lightbringer. (2019, May 10). Programming paradigms – what is procedural


programming? Retrieved October 06, 2020, from Tuan Nguyen's Blog:
https://www.tuannguyen.tech/2019/05/programming-paradigms-what-is-procedural-
programming/

9. Maria. (2018, October 23). Event-Driven Programming Features. Retrieved October 07,
2020, from Studybay: https://studybay.com/blog/event-driven-development-features/

10. Partner, B. (2019, December 04). Advantages and Disadvantages of Event-Driven


Programming. Retrieved October 08, 2020, from Bench Partner:
https://benchpartner.com/advantages-and-disadvantages-of-event-driven-programming/

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 81


11. Rouse, M. (n.d.). debugging. Retrieved October 12, 2020, from techtarget.com:
https://searchsoftwarequality.techtarget.com/definition/debugging

12. Smyth, P. (2018, March 12). An Introduction to Programming Paradigms. Retrieved


October 06, 2020, from GC Digital Fellows:
https://digitalfellows.commons.gc.cuny.edu/2018/03/12/an-introduction-to-programming-
paradigms/
13. Tarade, S. (2019, September 07). SEARCHING ALGORITHMS. Retrieved October 04,
2020, from https://fullyunderstood.com/pseudocodes/linear-search/

14. tutorialspoint. (2020). Data Structures - Algorithms Basics. Retrieved October 04, 2020,
from
https://www.tutorialspoint.com/data_structures_algorithms/algorithms_basics.htm#:~:text
=Characteristics%20of%20an%20Algorithm&text=Input%20%E2%88%92%20An%20al
gorithm%20should%20have,a%20finite%20number%20of%20steps.

15. Walker, A. (2018, November 19). What is an IDE (Integrated Development


Environment)? Retrieved October 07, 2020, from Learning Hub: https://learn.g2.com/ide

K. A. Damith Sriyantha Karunathilake Unit 01-Programming Page 82

You might also like