Uploaded by esofthndtuan

Unit 01 -Programming btec assignment

advertisement
2/28/24, 12:11 AM
Unit 01 -Programming
Higher Nationals
Internal verification of assessment decisions – BTEC (RQF)
INTERNAL VERIFICATION – ASSESSMENT DECISIONS
Programme title
Higher National Diploma in Computing
Assessor
Internal Verifier
Unit(s)
Assignment title
Student’s name
List which assessment criteria
the Assessor has awarded.
Pass
Merit
Distinction
INTERNAL VERIFIER CHECKLIST
Do the assessment criteria awarded match
those shown in the assignment brief?
Is the Pass/Merit/Distinction grade awarded
justified by the assessor’s comments on the
student work?
Y/N
Y/N
Has the work been assessed
accurately?
Y/N
Is the feedback to the student:
Give details:
• Constructive?
• Linked to relevant assessment criteria?
• Identifying opportunities for
improved performance?
• Agreeing actions?
Y/N
Y/N
Y/N
Y/N
Does the assessment decision need
amending?
Y/N
Assessor signature
Date
Internal Verifier signature
Date
Programme Leader signature (if required)
Unit 01: Programming
about:blank
Date
1
1/103
2/28/24, 12:11 AM
Unit 01 -Programming
Confirm action completed
Remedial action taken
Give details:
Assessor signature
Date
Internal Verifier
signature
Date
Program Leader
signature (if required)
Date
Unit 01: Programming
about:blank
2
2/103
2/28/24, 12:11 AM
Unit 01 -Programming
Higher Nationals - Summative Assignment Feedback Form
Student Name/ID
Unit Title
Programming
Assignment Number
Assessor
18/06/2022
Submission Date
Date Received 1st
submission
Re-submission Date
Date Received 2nd
submission
Assessor Feedback:
LO1. Define basic algorithms to carry out an operation and outline the process of programming an application.
Pass, Merit & Distinction Descriptions
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
M3
D3
LO3. Implement basic algorithms in code using an IDE.
Pass, Merit & Distinction Descripts
P3
LO4. Determine the debugging process and explain the importance of a coding standard.
Pass, Merit & Distinction Descripts
Grade:
P4
P5
M4
Assessor Signature:
Date:
Assessor Signature:
Date:
D4
Resubmission Feedback:
Grade:
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
about:blank
3
3/103
2/28/24, 12:11 AM
Unit 01 -Programming
Assignment Feedback
Formative Feedback: Assessor to Student
Action Plan
Summative feedback
Feedback: Student to Assessor
Assessor
signature
Date
Student
signature
Date
Unit 01: Programming
about:blank
4
4/103
2/28/24, 12:11 AM
Unit 01 -Programming
Pearson Higher Nationals in
Computing
Unit 01: Programming
Assignment 01
Unit 01: Programming
about:blank
5
5/103
2/28/24, 12:11 AM
Unit 01 -Programming
General Guidelines
1. A Cover page or title page – You should always attach a title page to your assignment. Use
previous page as your cover sheet and make sure all the details are accurately filled.
2. Attach this brief as the first section of your assignment.
3. All the assignments should be prepared using a word processing software.
4. All the assignments should be printed on A4 sized papers. Use single side printing.
5. Allow 1” for top, bottom, right margins and 1.25” for the left margin of each page.
Word Processing Rules
The font size should be 12 point, and should be in the style of Time New Roman.
Use 1.5 line spacing. Left justify all paragraphs.
Ensure that all the headings are consistent in terms of the font size and font style.
Use footer function in the word processor to insert Your Name, Subject, Assignment No, and
Page Number on each page. This is useful if individual sheets become detached for any reason.
5. Use word processing application spell check and grammar check function to help editing your
assignment.
1.
2.
3.
4.
Important Points:
1. It is strictly prohibited to use textboxes to add texts in the assignments, except for the compulsory
information. e.g. Figures, tables of comparison etc. Adding text boxes in the body except for the
before mentioned compulsory information will result in rejection of your work.
2. Carefully check the hand in date and the instructions given in the assignment. Late submissions will
not be accepted.
3. Ensure that you give yourself enough time to complete the assignment by the due date.
4. Excuses of any nature will not be accepted for failure to hand in the work on time.
5. You must take responsibility for managing your own time effectively.
6. If you are unable to hand in your assignment on time and have valid reasons such as illness, you
may apply (in writing) for an extension.
7. Failure to achieve at least PASS criteria will result in a REFERRAL grade.
8. Non-submission of work without valid reasons will lead to an automatic RE FERRAL. You will then
be asked to complete an alternative assignment.
9. If you use other people’s work or ideas in your assignment, reference them properly using
HARVARD referencing system to avoid plagiarism. You have to provide both in-text citation and a
reference list.
10. If you are proven to be guilty of plagiarism or any academic misconduct, your grade could be
reduced to A REFERRAL or at worst you could be expelled from the course
Unit 01: Programming
about:blank
6
6/103
2/28/24, 12:11 AM
Unit 01 -Programming
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:
(Provide E-mail ID)
Date:
(Provide Submission Date)
Unit 01: Programming
about:blank
7
7/103
2/28/24, 12:11 AM
Unit 01 -Programming
Higher National Diploma in Computing
Assignment Brief
Student Name /ID Number
Unit Number and Title
Unit 01: Programming
Academic Year
2021/22
Unit Tutor
Assignment Title
Design &Implement a GUI based system using a suitable
Integrated Development Environment
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.
Unit Learning Outcomes:
Unit 01: Programming
about:blank
8
8/103
2/28/24, 12:11 AM
Unit 01 -Programming
LO1. Define basic algorithms to carry out an operation and
outline the process of programming an application.
LO2. Explain the characteristics of procedural, objectorientated 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
about:blank
9
9/103
2/28/24, 12:11 AM
Unit 01 -Programming
Assignment Brief and Guidance:
Activity 1
A. The Fibonacci numbers are the numbers in the following integer
sequence.
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144,
In mathematical terms, the sequence Fn of Fibonacci numbers is
defined by the recurrence relation.
Fn = F n-1 + F n-2
B. Factorial of a non-negative integer is multiplication of all integers
smaller than or equal to n. For example, factorial of 6 is
6*5*4*3*2*1 which is 720.
n! = n * (n - 1) * …….. 1
Define what an algorithm is and outline the characteristics of a good
algorithm. Write the algorithms to display the Fibonacci series and
the factorial value for a given number using Pseudo code.
Determine the steps involved in the process of writing and executing
a program.
Take a sample number and dry run the above two algorithms. Show
the outputs at the end of each iteration and the final output.
Examine what Big-O notation is and explain its role in evaluating
efficiencies of algorithms. Write the Python program code for the
above two algorithms and critically evaluate their efficiencies using
Big-O notation.
Unit 01: Programming
about:blank
10
10/103
2/28/24, 12:11 AM
Unit 01 -Programming
Activity 2
2.1
Explain what is meant by a Programming Paradigm and
the main characteristics of Procedural, Object oriented and
Event-driven paradigms and the relationships among them.
Write small snippets of code as example for the above three
programming paradigms using a suitable programming
language(s). You also need to critically evaluate the code
samples that you have given above in relation to their structure
and the unique characteristics.
Activity 3 and Activity 4 are based on the following Scenario.
Ayubo Drive is the transport arm of Ayubo Leisure (Pvt) Ltd, an
emerging travel & tour company in Sri Lanka. It owns a fleet of vehicles
ranging from cars, SUVs to vans.
The vehicles that it owns are hired or rented with or without a driver.
The tariffs are based on the vehicle type. Some of the vehicle types that
it operates are, small car, sedan car, SVUs, Jeep (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
Unit 01: Programming
11
about:blank
11/103
2/28/24, 12:11 AM
Unit 01 -Programming
vehicle typeif that is applicable for that type of vehicle.For each
package maximum km limit and maximum number of hours arealso
defined. Extra km rate is also defined which is applicable if they run
beyond the allocated km limit for the tour. For day tours if they
exceed max hour limit, a waiting charge is applicable for extra hours.
Driver overnight rate and vehicle night park rate also defined which
is applicable for each night when the vehicle is hired for 2 or more
days.
Activity 3
3
Function 1: Rent calculation.
Return the total rent_value when vehicle_no, rented_date,
return_date, with_driver parameters are sent in. with_driver parameter
is set to true or false depending whether the vehicle is rented with or
without driver.
Function 2: Day tour - hire calculation.
Calculate total hire_value when vehicle_no, package_type, start_time,
end_time, start_km_reading, end_km_reading parameters are sent in.
Should return base_hire_charge, waiting_charge and extra_km_charge
as output parameters.
Function 3: Long tour - hire calculation.
Calculate total hire_value when vehicle_no, package_type, start_date,
end_date, start_km_reading, end_km_reading parameters are sent in.
Should return base_hire_charge, overnight_stay_charge and
extra_km_charge as output parameters.
Write suable algorithms for vehicle tariff calculation for rents
and hires. Ideally, 3 functions should be developed for this
purpose as above. Use the visual studio IDE (using C#.net) to
Implement the above algorithms and design the suitable
database structure for keeping the tariffs for vehicle types and
different packages which must be used for implementing the
above functions.
Unit 01: Programming
12
about:blank
12/103
2/28/24, 12:11 AM
Unit 01 -Programming
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
2
3
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 Explain debugging process and the features available in Visual studio
IDE for debugging your code more easily. Evaluate how you used the
debugging process to develop more secure, robust application with
examples.
Unit 01: Programming
13
about:blank
13/103
2/28/24, 12:11 AM
Unit 01 -Programming
4.3 Outline the coding standards you have used in your application
development. Critically evaluate why a coding standard is necessary
for the team as well as for the individual.
Unit 01: Programming
about:blank
14
14/103
2/28/24, 12:11 AM
Unit 01 -Programming
Unit 01: Programming
about:blank
15
15/103
2/28/24, 12:11 AM
Unit 01 -Programming
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 Evaluate the implementation of an algorithm in a suitable
language. Evaluate the relationship between the written
algorithm and the code variant
Unit 01: Programming
about:blank
16
16/103
2/28/24, 12:11 AM
Unit 01 -Programming
LO2 Explain the characteristics of procedural,
object orientated and event-driven
programming, conduct an analysis of a
suitable Integrated Development
Environment (IDE)
P2Give explanations of what procedural, object
orientated, and event driven paradigms are; their
characteristics and the relationship between
them.
M2 Compare and contrast the procedural,
object orientated and event driven paradigms
used in given source code of an application
D2Critically evaluate the source code of an
application which implements the programming
paradigms, in terms of the code structure and
characteristics.
LO3Implement basic algorithms in code using
an IDE.
Unit 01: Programming
about:blank
17
17/103
2/28/24, 12:11 AM
Unit 01 -Programming
P3Write a program that implements an
algorithm using an IDE.
M3Use the IDE to manage the development
process of the program.
D3Evaluate the use of an IDE for development of
applications contrasted with not using an IDE.
LO4 Determine the debugging process and
explain the importance of a coding
standard
P4Explain the debugging process and explain the
debugging facilities available in the IDE.
P5Outline the coding standard you have used in
your code.
Unit 01: Programming
about:blank
18
18/103
2/28/24, 12:11 AM
Unit 01 -Programming
M4Evaluate how the debugging process can be
used to help develop more secure, robust
applications.
D4 Critically evaluate why a coding standard is
necessary in a team as well as for the individual.
Unit 01: Programming
about:blank
19
19/103
2/28/24, 12:11 AM
Unit 01 -Programming
Unit 01: Programming
about:blank
20
20/103
2/28/24, 12:11 AM
Unit 01 -Programming
Table of Contents
Introduction to Algorithms................................................................................................................26
What is an Algorithm?...................................................................................................................26
Flow Charts................................................................................................................................26
Pseudo Code..............................................................................................................................27
Algorithm Design...........................................................................................................................28
Control Structures......................................................................................................................28
Example for an algorithm..........................................................................................................29
Introduction to Computer Programming...........................................................................................31
What is a Computer Program?......................................................................................................31
Computer Programming Languages..............................................................................................31
1st Generation Programming Languages....................................................................................31
2nd Generation Programming Languages...................................................................................31
3rd Generation Programming Languages...................................................................................31
Introduction to Python Programming Language...........................................................................32
Python IDLE................................................................................................................................32
Coding with Python IDLE............................................................................................................34
Algorithm Implementation............................................................................................................41
Activity 01..........................................................................................................................................42
Big O Notation....................................................................................................................................53
Introduction to Programming paradigms..........................................................................................54
Imperative programming paradigms.............................................................................................54
Procedural paradigms................................................................................................................55
Object-oriented paradigms........................................................................................................55
Event-driven paradigm..............................................................................................................55
Declarative Programming Paradigms............................................................................................55
Logic paradigms.........................................................................................................................56
Functional paradigms.................................................................................................................56
Usage of procedural paradigms.....................................................................................................56
Usage of object-oriented paradigms.............................................................................................57
Unit 01: Programming
about:blank
21
21/103
2/28/24, 12:11 AM
Unit 01 -Programming
Usage of event-driven paradigms..................................................................................................58
Activity 02..........................................................................................................................................59
Event-driven programming paradigms..............................................................................................61
Introduction to Integrated Development Environment (IDE)...........................................................63
What is an IDE?..............................................................................................................................63
Source code editor:....................................................................................................................63
Local build automation:.............................................................................................................63
Debugger:...................................................................................................................................63
Some of the popular IDEs..............................................................................................................63
Usage of an IDE..............................................................................................................................65
Why do developers use IDEs?........................................................................................................68
Activity 03..........................................................................................................................................69
Debugging Features in Visual Studio.................................................................................................72
Break-Point Debugging..................................................................................................................72
Live Code Editing............................................................................................................................73
Set a watch.....................................................................................................................................73
Examine the call stack....................................................................................................................74
Coding Standards...............................................................................................................................74
Some of the C# coding standards..................................................................................................74
Purpose of debugging applications....................................................................................................77
Importance of the Coding standards.................................................................................................78
Enhancing the efficiency................................................................................................................78
The risk of project failure is reduced.............................................................................................78
Minimal Complexity.......................................................................................................................78
Bug Rectification............................................................................................................................78
Activity 04..........................................................................................................................................79
Ayubo Drives Use Case Diagram....................................................................................................79
Ayubo Drives Class Diagram..........................................................................................................80
Ayubo Drives ER Diagram..............................................................................................................81
Ayubo Drives Application – Interfaces...........................................................................................82
Unit 01: Programming
about:blank
22
22/103
2/28/24, 12:11 AM
Unit 01 -Programming
Login Form.................................................................................................................................82
Main Menu Form.......................................................................................................................82
Service Form..............................................................................................................................83
Customers Form.........................................................................................................................83
Customers Edit Form.................................................................................................................84
Drivers Form...............................................................................................................................84
Drivers Edit Form.......................................................................................................................85
Vehicles Form.............................................................................................................................85
Vehicles Edit Form.....................................................................................................................86
Vehicle Owners Edit Form.........................................................................................................86
Rent Form..................................................................................................................................87
Rent Finish Form........................................................................................................................87
Packages For..............................................................................................................................88
Hire Form...................................................................................................................................88
Hire Finish Form.........................................................................................................................89
Quick Search Form.....................................................................................................................89
Ayubo Drive Application Testing....................................................................................................90
Vehicle - Add..............................................................................................................................90
Vehicle - Edit / Delete................................................................................................................92
Package – Add................................................................................................................................94
Hire Calculation..............................................................................................................................95
Record in Database....................................................................................................................96
Finishing Hire.............................................................................................................................97
Rent Calculation.............................................................................................................................98
Record in Database....................................................................................................................99
Finishing Rent.............................................................................................................................99
References.......................................................................................................................................101
Unit 01: Programming
about:blank
23
23/103
2/28/24, 12:11 AM
Unit 01 -Programming
Table of Figures
Figure 1: How Algorithm works........................................................................................................26
Figure 2: Flow Chart Standard Symbols............................................................................................27
Figure 3: How Sequence Structure Works.........................................................................................28
Figure 4: How Selection Structure Works.........................................................................................28
Figure 5: How Repetition Structure Works.......................................................................................29
Figure 6: Python IDLE......................................................................................................................33
Figure 7: Python IDLE - Creating New File......................................................................................34
Figure 8: Python New File.................................................................................................................35
Figure 9: Python Code.......................................................................................................................36
Figure 10: Python Code - Save..........................................................................................................37
Figure 11: Python File Saving Type..................................................................................................38
Figure 12: Python File Execution......................................................................................................39
Figure 13: Python File Execution- Output.........................................................................................40
Figure 14: Fibonacci Flow chart........................................................................................................42
Figure 15: Python Code output..........................................................................................................44
Figure 16: instruction 01 memory overview......................................................................................44
Figure 17: instruction 02 memory overview......................................................................................44
Figure 18: instruction 03 memory overview......................................................................................45
Figure 19: instruction 04 memory overview......................................................................................45
Figure 20: instruction 05 memory overview......................................................................................45
Figure 21: instruction 06 memory overview......................................................................................46
Figure 22: instruction 07 memory overview......................................................................................46
Figure 23: instruction 08 memory overview......................................................................................46
Figure 24: instruction 09 memory overview......................................................................................47
Figure 25: instruction 10 memory overview......................................................................................47
Figure 26: instruction 11 memory overview......................................................................................47
Figure 27: Factorial Flow Chart.........................................................................................................48
Figure 28: Python Code Output.........................................................................................................50
Figure 29: instruction 01, 02, 03 memory overview..........................................................................50
Figure 30: instruction 04 memory overview......................................................................................51
Figure 31: instruction 05 memory overview......................................................................................51
Figure 32: instruction 06 memory overview......................................................................................52
Figure 33: instruction 07 memory overview......................................................................................52
Figure 34: instruction 08 memory overview......................................................................................53
Figure 35: Usage of procedural paradigm – (C# Code Sample)........................................................56
Figure 36: Object-oriented paradigm (C# Code sample)...................................................................57
Figure 37: GUI Design (C# WinForms Application)........................................................................58
Figure 38: Click Event for the Update button in GUI Design (Figure 16)........................................58
Unit 01: Programming
about:blank
24
24/103
2/28/24, 12:11 AM
Unit 01 -Programming
Figure 39: Python Code Sample for procedural paradigms...............................................................59
Figure 40: Python Code Sample for Object Oriented Paradigm........................................................60
Figure 41: C# WinForms application sample....................................................................................61
Figure 42: C# Code Sample for Click Event - "Insert" button (figure 20)........................................62
Figure 43: Visual Studio IDE............................................................................................................63
Figure 44: Eclipse IDE......................................................................................................................64
Figure 45: PyCharm IDE...................................................................................................................64
Figure 46: Example flow chart..........................................................................................................65
Figure 47: C# code sample................................................................................................................67
Figure 48: C# Code sample output....................................................................................................67
Figure 49: Rent calculation C# code..................................................................................................69
Figure 50: Hire calculation C# Code.................................................................................................70
Figure 51: Hire Calculation long tour C# Code.................................................................................71
Figure 52: Break Point.......................................................................................................................72
Figure 53: Step by Step Debugging with Break points.....................................................................72
Figure 54: Debugging controllers......................................................................................................72
Figure 55: Live Code Editing............................................................................................................73
Figure 56: Table of Variables............................................................................................................73
Figure 57: Call Stack Table...............................................................................................................74
Figure 58: Class name in Pascal Case................................................................................................74
Figure 59: Method name in pascal case.............................................................................................75
Figure 60: Camel case arguments......................................................................................................75
Figure 61: Identifiers without underscore..........................................................................................75
Figure 62: Using predefined data types.............................................................................................76
Figure 63: aligned curly braces..........................................................................................................76
Figure 64: Ayubo Drives Use case diagram......................................................................................79
Figure 65: Ayubo Drives Class Diagram...........................................................................................80
Figure 66: Ayubo Drives ER Diagram..............................................................................................81
Figure 67: Application Login Form...................................................................................................82
Figure 68: Application Main menu form...........................................................................................82
Figure 69: Service form.....................................................................................................................83
Figure 70: Customer form..................................................................................................................83
Figure 71: Customer details form......................................................................................................84
Figure 72: Driver form.......................................................................................................................84
Figure 73: driver detailed form..........................................................................................................85
Figure 74: Vehicle form.....................................................................................................................85
Figure 75: Vehicle Edit Form............................................................................................................86
Figure 76: Vehicle Owner Edit Form................................................................................................86
Figure 77: Rent Form.........................................................................................................................87
Figure 78: Rent finish form...............................................................................................................87
Unit 01: Programming
about:blank
25
25/103
2/28/24, 12:11 AM
Unit 01 -Programming
Figure 79: Packages Form.................................................................................................................88
Figure 80: Hire Form.........................................................................................................................88
Figure 81: Hire Finish Form..............................................................................................................89
Figure 82: Quick Search Form...........................................................................................................89
Figure 83: Vehicle Add Interface......................................................................................................90
Figure 84: Vehicle Edit and Delete interface.....................................................................................92
Figure 85: Package Add Interface......................................................................................................94
Figure 86: Hire Adding Interface.......................................................................................................95
Figure 87: Records Saved in the database.........................................................................................96
Figure 88: Hire Calculation...............................................................................................................97
Figure 89: Rent Adding Interface......................................................................................................98
Figure 90: Record Saved in the Database..........................................................................................99
Figure 91: Rent Calculation...............................................................................................................99
Table of Tables
Table 1 : Test case 01.........................................................................................................................91
Table 2: Test Case 02.........................................................................................................................93
Table 3 : Test Case 03........................................................................................................................95
Table 4: Test Case 04.........................................................................................................................96
Table 5: Test Case 05.........................................................................................................................97
Table 6: Test Case 06.........................................................................................................................98
Table 7: Test Case 07.......................................................................................................................100
Unit 01: Programming
about:blank
26
26/103
2/28/24, 12:11 AM
Unit 01 -Programming
Introduction to Algorithms
What is an Algorithm?
Simply, in computing terms, an algorithm is a solution for a particular problem. It is a set of
well-defined instructions on how to solve a specific problem and get the best solution for that
particular problem.
It takes inputs and follows the instructions, completes each procedure, and finally generates a
solution for our problem.
Figure 1: How Algorithm works
There is two-step for implementing an algorithm.
1. Flow Charts
2. Pseudo Code
Flow Charts
The flow chart is the graphical representation of the algorithm. Each step is shown by the
standard symbol. Also, each symbol has a different meaning.
Some of the Standard Symbol for Flow Chart
Unit 01: Programming
about:blank
27
27/103
2/28/24, 12:11 AM
Unit 01 -Programming
Figure 2: Flow Chart Standard Symbols
Pseudo Code
Pseudocode is the way of describing the flow chart by going through each procedure.
Pseudocode has a way of describing things. Especially “Data-types” and “Keyword”. Unlike a
real programming language, all of these "Keywords" and “Data-types” are written in English and
helps the programmer to turn this pseudocode into an actual programming language code very
easily.
Data Types in pseudo-code

Integer: Mostly use to represent numerical values. E.g. 1234565, -2133244…etc.

String: This data type is used to represent “Words”.

Decimal: Use to represent floating-point values.

Char: Use for characters.
E.g. “Dog”, “Cat”…etc.
E.g. 1.232, 6.022…etc.
E.g. ‘a’, ‘A’, ‘C’…etc.
Some of the Keywords in pseudo-code
All keywords must be written in capital letters

DISPLAY: Display current result or content to screen.

INPUT: input something to program

INITIALIZE / ACCEPT: Assign values to the variables.

IF, ELSE IF, ENDIF: Conditional statements.

FOR / WHILE / DO WHILE / REPATE UNTIL: Use with repetition statements.
Unit 01: Programming
about:blank
28
28/103
2/28/24, 12:11 AM
Unit 01 -Programming
Algorithm Design
From an Algorithm, we can only get one solution for our problem. When it comes to
different problems we have to design algorithms separately for each problem. Flow chart allows
us to get the idea of how to create the solution and pseudo-code can simplify that solution much
further.
Control Structures
Sequence
“Sequence” controls the program in a specific order, which means executing each
instruction in the program line-by-line. This includes arithmetic operations, Logical operations,
and read and write operations.
Figure 3: How Sequence Structure Works
Selection
The selection structure depends on true or false condition. It allows us to control
sequence flow in the program. From that, we’ll be able to control the instruction execution and
execute different instructions on true or false condition.
Figure 4: How Selection Structure Works
Unit 01: Programming
29
about:blank
29/103
2/28/24, 12:11 AM
Unit 01 -Programming
Repetition
Repetition allows us to run a certain block of instruction several times depending on
true or false condition. We can keep our code DRY (Don’t Repeat Yourself) by using these
repetition and also we can do much more things within a few lines of instructions.
Figure 5: How Repetition Structure Works
Control structures are the fundamental building blocks for application development. The
combination of these three control structures opens the doorway to problem-solving. Also, a
control structure can break down a complex problem into simple and manageable pieces. So when
it comes to the programmer, algorithm is very easy to understand and also code implementation is
not very challenging.
Example for an algorithm
Problem: Find the largest number from two-digit?
Solution:
Unit 01: Programming
about:blank
30
30/103
2/28/24, 12:11 AM
Unit 01 -Programming
01. Flow Chart:
Figure 6: Solution Flow Chart
02. Pseudo Code:
Program Find_Max
Local Data:
X, Y: Integer;
Begin
INPUT X, Y;
ACCEPT X, Y;
IF X > Y THEN:
DISPLAY X;
ELSE
DISPLAY Y;
END IF
End.
Unit 01: Programming
about:blank
31
31/103
2/28/24, 12:11 AM
Unit 01 -Programming
Introduction to Computer Programming
What is a Computer Program?
The computer program, a detailed plan or procedure for solving a problem with a
computer more specifically, is an unambiguous, ordered sequence of computational instructions
necessary to achieve such a solution. The distinction between computer programs and equipment
is often made by referring to the former as software and the latter as hardware. (Gregersen., 2021)
Computer Programming Languages
Computer programming language has a great history. Generation to generation it has
become more reliable, flexible and more effective way give to computer instruction. There is lot
of type of programming language and most of them are following the same instruction pattern.
1st Generation Programming Languages
First-generation programming languages are also known as “Machine Language” or
“Machine Codes”. Machine codes are written in “1” and “0” (Binary format). Which is very hard
to understand. Programmers have to put their time and effort to understand single instruction. As a
solution, 2nd generation programming languages were invented.
2nd Generation Programming Languages
The second-generation programming language is also known as “Assembly Language”.
Main feature of assembly language was, English word within the language and use special
converter call “Assembler”. The assembler converts the assembly language instruction to machine
code. This makes the programmer to understand the instructions very easily, but the disadvantage
was one assembly program cannot run on another machine. As a result, different types of
converters and programming languages were invented.
3rd Generation Programming Languages
After two generations in 1957, IBM (International Business Machines Corporation) release the
first high-level language called “FORTRAN”. FORTRAN is a Compile language which can run
on
Unit 01: Programming
about:blank
32
32/103
2/28/24, 12:11 AM
Unit 01 -Programming
different machines. Also most of the keywords are in the English language. And soon it becomes
a very popular language for scientific works. In 1959 the IBM released “COBOL” language for
developing business management systems.
After that next-generation programming languages started to take action in the computer science
industry. Nowadays most of this programming languages are in the English language. For
example “Python” programming language is the most human-friendly programming language
ever released.
Introduction to Python Programming Language
Python was developed in 1991 by Guido van Rossum. Python is a beginner-friendly
language. This means anyone new to programming can easily follow the steps in python. Also,
python comes with an IDLE (Integrated Developing Learning Environment) which any beginner
can find their mistakes.
Python Keyword List
False
None
True
and
as
assert
async
await
break
class
continue
def
del
elif
else
except
finally
for
from
global
if
import
in
is
lambda
nonlocal
not
or
pass
raise
return
try
while
with
yield
Python IDLE
Python is an interpreted language. It’s executed code line by line. When it catches an error it
gives a proper message about that error. For example, what cause it, where it’s located? So, when
the keywords does not highlights you can easily find errors in your code.
Unit 01: Programming
about:blank
33
33/103
2/28/24, 12:11 AM
Unit 01 -Programming
Figure 6: Python IDLE
Unlike another programming language python is full of English words. Because of that when we
implement an algorithm we can easily convert our pseudo-code into python code.
Unit 01: Programming
about:blank
34
34/103
2/28/24, 12:11 AM
Unit 01 -Programming
Coding with Python IDLE
Let’s take look at how to implement our last algorithm with python IDLE
(Mention on page 29).
Creating a new python file
Figure 7: Python IDLE - Creating New File
Unit 01: Programming
about:blank
35
35/103
2/28/24, 12:11 AM
Unit 01 -Programming
Figure 8: Python New File
Unit 01: Programming
about:blank
36
36/103
2/28/24, 12:11 AM
Unit 01 -Programming
Python Coding
Figure 9: Python Code
Unit 01: Programming
about:blank
37
37/103
2/28/24, 12:11 AM
Unit 01 -Programming
Before executing the python code we must save our python file.
Figure 10: Python Code - Save
Unit 01: Programming
about:blank
38
38/103
2/28/24, 12:11 AM
Unit 01 -Programming
We can save our python anywhere we want. But it must save as with .py extension. Otherwise it is
not able to recognize our file by python interpreter.
Figure 11: Python File Saving Type
Unit 01: Programming
about:blank
39
39/103
2/28/24, 12:11 AM
Unit 01 -Programming
Python Code Execute
Figure 12: Python File Execution
Unit 01: Programming
about:blank
40
40/103
2/28/24, 12:11 AM
Unit 01 -Programming
Figure 13: Python File Execution- Output
Unit 01: Programming
about:blank
41
41/103
2/28/24, 12:11 AM
Unit 01 -Programming
Algorithm Implementation
Each algorithm in different level of complexity. Python is not always the best approach for
implementing an algorithm. Lot of programming languages can implement complex algorithms.
For example, Python is not a fully OOP (object-oriented programming) language. OOP is the
fundamental concept in programming. Because of that, we cannot use python for every algorithm.
Since Python is an interpreted programming language code implementation is a little bit tricky.
Before running our code we can detect our syntax errors, bad implementations through other
languages such as C#, C++, C which have compiled programming languages. Disadvantage of the
python interpreter are Syntax errors, bad implementation which can only detect on run-time. This
could lead to horrible mistakes.
The algorithm is about finding the best solution and getting the best result. When it comes to
implementing an algorithm choosing a programming language is very important. Because the
result of the algorithm depends on the programming language that we are using.
C and C++ are all about efficiency, if we want to create more memory manageable and speed
application, C and C++ is the best approach. On the other hand C# and Java are the best languages
for Object-oriented programming because we can develop GUI (Graphical User Interface)
applications and CLI (Command Line Interface) applications. We can easily implement complex
algorithms by using those languages. We can use python as a scripting language because usually
python used for A. I (Artificial Intelligent) programming.
There are lot of differences between each programming language. Finding the best language for
an algorithm depends on algorithm structure. From that, we can choose a good programming
language.
Unit 01: Programming
about:blank
42
42/103
2/28/24, 12:11 AM
Unit 01 -Programming
Activity 01
A. The
Fibonacci
numbers
are
the
numbers
in
the
following
integer
sequence.
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144,
In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence
relation.
Fn = F n-1 + F n-2
Flow Chart:
Figure 14: Fibonacci Flow chart
Unit 01: Programming
about:blank
43
43/103
2/28/24, 12:11 AM
Unit 01 -Programming
Pseudo Code:
Program Fibonacci_numbers
Local Data:
t1 , t2, next_term, N: Integer;
Begin
t1 = 0;
t2= 1;
next_term = 0;
INPUT N;
ACCEPT N;
DISPLAY t1, t2;
next_term = t1 + t2;
WHILE next_term <= N THEN:
DISPLAY next_term;
t1 = t2;
t2= next_term;
next_term = t1 + t2;
END WHILE
End.
Python Code:
# Fibonacci_numbers
t1 = 0
t2 = 1
nxt_term = 0
n = int (input (“N :”))
print (t1, t2, end=’,’)
nxt_term = t1 + t2
while nxt_term <= n:
print (nxt_term, end=’,’)
t1 = t2
t2 = nxt_term
nxt_term = t1 + t2
Unit 01: Programming
about:blank
44
44/103
2/28/24, 12:11 AM
Unit 01 -Programming
Python Code Output:
Figure 15: Python Code output
Source Code:
https://drive.google.com/file/d/1cyxg_j2TKxjGO8KDdP_W0Ruqkt77UnXx/view?usp=sharing
Python Code Dry Run:
1. t1 = 0
Figure 16: instruction 01 memory overview
2. t2 = 1
Figure 17: instruction 02 memory overview
Unit 01: Programming
about:blank
45
45/103
2/28/24, 12:11 AM
Unit 01 -Programming
3. nxt_term = 0
Figure 18: instruction 03 memory overview
4. n = int(input(“N : “))
( sample input: 150)
Figure 19: instruction 04 memory overview
5. print(t1, t2, end=’,’)
Figure 20: instruction 05 memory overview
6. nxt_term = t1 + t2
about:blank
46/103
2/28/24, 12:11 AM
Unit 01 -Programming
7. while nxt_term <= n:
Figure 22: instruction 07 memory overview
8. print(nxt_term, end=’,’)
Figure 23: instruction 08 memory overview
Unit 01: Programming
about:blank
47
47/103
2/28/24, 12:11 AM
Unit 01 -Programming
9. t1 = t2
Figure 24: instruction 09 memory overview
10. t2 = nxt_term
Figure 25: instruction 10 memory overview
11. nxt_term = t1 + t2
Figure 26: instruction 11 memory overview
Unit 01: Programming
about:blank
48
48/103
2/28/24, 12:11 AM
Unit 01 -Programming
Same procedure keeps repeat until the “nxt_term <= n” returns false, then the program stops.
B. Factorial of a non-negative integer is multiplication of all integers smaller than or equal to
n. For example, factorial of 6 is 6*5*4*3*2*1 which is 720.
i. n! = n * (n - 1) * …….. 1
Flow Chart:
Figure 27: Factorial Flow Chart
Unit 01: Programming
about:blank
49
49/103
2/28/24, 12:11 AM
Unit 01 -Programming
Pseudo Code:
Program Factorial
Local Data:
M, F, N: Integer;
Begin
INPUT N;
ACCEPT N;
M = 1;
F = 1;
F = F * M;
WHILE M != N THEN:
M = M + 1;
F = F*M
END WHILE;
DISPLAY F;
End.
Python Code:
#Factorial
m=1
f=1
n = int (input (“N :”))
f=f*m
while m!= n:
m=m+1
f=f*m
print (f)
Unit 01: Programming
about:blank
50
50/103
2/28/24, 12:11 AM
Unit 01 -Programming
Python Code Output:
Figure 28: Python Code Output
Source Code:
https://drive.google.com/file/d/1cw1IZxiRq7NvIuiB0YwWlJSjMF9DcaL8/view?usp=sharing
Python Code Dry Run:
1. m = 1
2. f = 1
3. n = int(input(“N: “))
Figure 29: instruction 01, 02, 03 memory overview
Unit 01: Programming
about:blank
51
51/103
2/28/24, 12:11 AM
Unit 01 -Programming
4. f = f * m
Figure 30: instruction 04 memory overview
5. while m != n:
Figure 31: instruction 05 memory overview
6. m = m + 1
Fig re 32: instr ction 06 memor o er ie
about:blank
52/103
2/28/24, 12:11 AM
Unit 01 -Programming
7. f = f * m
Figure 33: instruction 07 memory overview
Same procedure keeps repeat until the “m != n” returns false, then the program produce the final
result.
8. print(f)
Figure 34: instruction 08 memory overview
Unit 01: Programming
53
about:blank
53/103
2/28/24, 12:11 AM
Unit 01 -Programming
Big O Notation
Big O describe how the time taken, or memory used, by a program scales with the amount of data
it has to work on. Also it describes the “Complexity” of a program.
01. Calculating Big O for Fibonacci numbers (mentioned in page 42)
Fn = F n-1 + F n-2
# Fibonacci_numbers
t1 = 0
t2 = 1
O (1)
nxt_term = 0
n = int(input (“N :”))
print (t1, t2, end=’,’)
nxt_term = t1 + t2
O (1)
while nxt_term <= n:
print (nxt_term, end=’,’)
t1 = t2
t2 = nxt_term
O (log n)
nxt_term = t1 + t2
O (1)
O (n)*O (1) = O (log n)
Fn = O (1) * O (1) * O (log n)
= O (log n)
02. Calculating complexity for factorial numbers (mention in the page 48)
n! = n * (n - 1) * …….. 1
#Factorial
m=1
f=1
n = int (input (“N :”))
f=f*m
while m!= n:
m=m+1
f=f*m
print (f)
O (1)
O (1)
O (1)
O (1)
O (log n)
O (1)
Unit 01: Programming
about:blank
O (1) * O (1) * O (log n)
54
54/103
2/28/24, 12:11 AM
Unit 01 -Programming
n! = O (1) * O (1) * O (log n)
= O (log n)
Introduction to Programming paradigms
A programming paradigm is a method of solving a problem by using algorithms and
programming technics. Lot of programming languages build with this methodology/strategy.
There are two types of programming paradigms.
01. Imperative Programming Paradigms.
02. Declarative Programming Paradigms.
Imperative programming paradigms
Imperative programming paradigms are one of the most important and oldest paradigms.
It’s very easy to implement and it contains loops and variables etc. It works by changing the
program state through assignment statements. It performs step by step tasks by changing state.
Some of the imperative programming paradigms
01. Procedural paradigms.
02. Object-oriented paradigms.
03. Event-driven paradigms.
Procedural paradigms
This paradigm emphasizes procedure in terms of the underlying machine model. There is no
difference between the procedural and imperative approaches. It can reuse the code and it was a
boon at that time when it was in use because of its reusability. (geeksforgeeks, 2022)
Object-oriented paradigms
The program is written as a collection of classes and objects which are meant for
communication. The smallest and basic entity is the object and all kinds of computations are
performed on the objects only. More emphasis is on data rather than procedure. It can handle
almost all kinds of real-life problems which are today in scenario. (geeksforgeeks, 2022)
Unit 01: Programming
about:blank
55
55/103
2/28/24, 12:11 AM
Unit 01 -Programming
Event-driven paradigm.
Event-driven programming is a programming paradigm in which the flow of program
execution is determined by events - for example, a user action such as a mouse click, keypress, or
a message from the operating system or another program. An event-driven application is designed
to detect events as they occur and then deal with them using an appropriate event-handling
procedure. (Technology UK, 2022)
Declarative Programming Paradigms
In terms of computer science, declarative programming is the style that builds programs
without talking about control flow. It can be divided into Logic, Functional, and Database. The
focus is on what needs to be done rather than how it should be done emphasizing what the code is
doing.
Some of the declarative programming paradigms
01. Logic paradigms
02. Functional paradigms
Logic paradigms
It can be termed an abstract model of computation. It would solve logical problems like
puzzles, series, etc. In logic programming we have a knowledge base that we know before and
along with the question and knowledge base which is given to the machine, it produces the result.
In normal programming languages, such a concept of a knowledge base is not available but while
using the concept of artificial intelligence, machine learning we have some models like the
Perception model which is using the same mechanism. (geeksforgeeks, 2022)
Functional paradigms
The functional programming paradigms have their roots in mathematics and it is language
independent. The key principle of this paradigm is the execution of a series of mathematical
Unit 01: Programming
about:blank
56
56/103
2/28/24, 12:11 AM
Unit 01 -Programming
functions. The central model for the abstraction is the function that is meant
for some specific computation and not the data structure. Data are loosely coupled to functions.
The function hides their implementation. The function can be replaced with their values without
changing the meaning of the program. Some of the languages like Perl, and JavaScript mostly use
this paradigm. (geeksforgeeks, 2022)
Usage of procedural paradigms
The procedural paradigm is all about breaking down a big chunk of repeated code into
smaller code that can be used at any time. The main purpose of this procedural paradigm is
keeping the code “DRY (Don’t Repeat yourself)” which is very easy to manage program memory.
Figure 35: Usage of procedural paradigm – (C# Code Sample)
As shown in the sample code (Figure 14) when the code is broken down into fewer codes the
reusability is limitless. Also, it’s not going to affect program efficacy or memory because of
procedural paradigm implementation. It saves on a different block of memory. While we are using
it all of the parameters are passed on to that block of memory
We can keep the code very clean and understandable by using procedural paradigms. Also, the
programmer doesn’t worry about the editing code.
Unit 01: Programming
about:blank
57
57/103
2/28/24, 12:11 AM
Unit 01 -Programming
Usage of object-oriented paradigms
Object-oriented paradigms are the most important topic in programming. The main structure
of this is creating an object in computing terms. This could be a real-life object or entity. Also,
this
paradigm combines with the procedural paradigm. This means any object could have a different
type of functionality, with the procedural paradigm object-oriented paradigm to achieve that goal.
Figure 36: Object-oriented paradigm (C# Code sample)
“Class” is the blueprint for creating object. In addition, an object can be full of properties
(variables) and methods (functions). Using the class we can create many objects as we like. Each
object has all functionality from the class that uses to create the object.
Usage of event-driven paradigms
The event-driven paradigm is the most often used, because all the GUI applications are
written in event-driven structure.
Unit 01: Programming
about:blank
58
58/103
2/28/24, 12:11 AM
Unit 01 -Programming
Figure 37: GUI Design (C# WinForms Application)
Figure 38: Click Event for the Update button in GUI Design (Figure 16)
In order to event trigger, the User action or operating system must take control over the UI design.
Otherwise, the event waits until the action happens. This is a common technic to run the program,
Most of the part did operating system, keep monitoring events triggered by the user and send
commands which code execute first and what’s next. Also, it helps use CPU (Central Processing
Unit) cycles more efficiently.
Activity 02
Explain what is meant by a Programming Paradigm and the main characteristics of Procedural,
Object-oriented, and Event-driven paradigms and the relationships among them. Write small
Unit 01: Programming
about:blank
59
59/103
2/28/24, 12:11 AM
Unit 01 -Programming
snippets of code as an example for the above three programming paradigms
using a suitable programming language(s). You also need to critically evaluate the code samples
that you have given above in relation to their structure and the unique characteristics.
Procedural programming paradigms
The purpose of the procedural paradigms is dividing large blocks of codes into smaller subcodes also called procedures. These procedures can be accessed anywhere within the same source
code. C, C++, Python, and C#, are the best languages for procedural programming.
Figure 39: Python Code Sample for procedural paradigms
Code description:
 Line 01: “find_max” is the function name and numbers passing using ‘a’, ‘b’ parameters.

Line 02: Check which number is the largest.

Line 03: If the condition is true display ‘a’ as the largest number.

Line 05: If the condition is false display ‘b’ as the largest number.

Line 06, 07: Calling the “find_max” procedure and passing the number to it.
As shown in the code sample (figure 18) “find_max” is a good example for procedural paradigms.
This is an algorithm for finding the largest number from two numbers. If we had more than one
pair we have to write code for each pair. Using the procedural paradigm concept we can build one
procedure for all the pairs and with that we can use the procedure anytime we want.
Object-oriented programming paradigms
The object-oriented paradigm is a widely used concept for implementing algorithms and
data structures. The main aim of the Object-oriented paradigm is to simplify complex algorithms
Unit 01: Programming
60
about:blank
60/103
2/28/24, 12:11 AM
Unit 01 -Programming
and make them very easy to understand. Also, using an object-oriented
paradigm we can build more secure and more manageable applications.
Figure 40: Python Code Sample for Object Oriented Paradigm
Code description:
 Line 01: “Employee” class name.


Line 03 – 08: Constructor, Creator of “Employee” class runtime.
Line 10 – 28: Some methods to change the functionality in the “Employee” class after
creating the object.
Python is not a fully object-oriented language. Because of that the functionality or concepts do not
work with python. As shown in the python code sample (Figure 19), using the “Employee” class
we can create many objects as we like. Also, each object has its methods and properties like
“set_fullname, get_fullname, first, last, pay” those are the feature that we can identify each object
uniquely. Using the Object-Oriented Paradigms we can reduce the complexity of a program.
Unit 01: Programming
about:blank
61
61/103
2/28/24, 12:11 AM
Unit 01 -Programming
Event-driven programming paradigms.
Event-driven paradigms are mostly found in GUI applications. The usage of an event-driven
paradigm is waiting for a user action to continue code execution. An event could be anything.
“MouseClick, Keyboard key press, or files opening/close” are the some of examples for events
that detect by our operating system. We can use detected events with our programs.
Figure 41: C# WinForms application sample
“Buttons” can be in many forms. For example, as shown in the picture (figure 20) “Insert” button
can have many events, “Click Event” is one of them. This event waiting to user to click on the
“Insert” button.
Unit 01: Programming
about:blank
62
62/103
2/28/24, 12:11 AM
Unit 01 -Programming
Figure 42: C# Code Sample for Click Event - "Insert" button (figure 20)
Code Description:
 Checking for empty fields

Password text box field matching check

If the Password Text box field doesn’t match Display Error Messages

If the Password text box field does match insert data into the database.
This event doesn’t run until the user clicks on the “Insert” button. Unlike in a loop, the CPU
doesn’t need used-up any CPU cycle for one program. With help of the Event-driven paradigm
CPU need to wait for the event to start executing codes.
Unit 01: Programming
about:blank
63
63/103
2/28/24, 12:11 AM
Unit 01 -Programming
Introduction to Integrated Development Environment (IDE)
What is an IDE?
An IDE is a collection of developing tool that use for software building in a single GUI
interface. Typically an IDE covers three main categories,
Source code editor:
A text editor can help with, language keyword highlighting, Syntax errors identification,
etc. Also base on the code, editor can suggest way to optimize our codes.
Local build automation:
With the help of local builder developer, can compile or interpreter source code with the
click of a button. In other hand builder can automate the software testing part and packages
handling part.
Debugger:
A program for testing other programs that can graphically display the location of a bug in
the original code.
Some of the popular IDEs
01. Visual Studio
Visual studio is very good IDE
for beginners and professional
developers. Also, it can be
configure for any programming
language.
Unit 01: Programming
about:blank
64
64/103
2/28/24, 12:11 AM
Unit 01 -Programming
Figure 43: Visual Studio IDE
02. Eclipse IDE
Mostly
use
programming.
in
C/C++
Configure
and
for
Java
another
language is little bit tricky. Not very
beginner friendly. Best for professional
developers.
Figure 44: Eclipse IDE
03. PyCharm IDE
Pycharm is best IDE for python
programming.
From
beginner
to
professional can use IDE as grate tool.
Most support for python language.
Hardly configure for another language.
Unit 01: Programming
about:blank
Figure 45: PyCharm IDE
65
65/103
2/28/24, 12:11 AM
Unit 01 -Programming
Usage of an IDE
Usage of and IDE changes depend on algorithm or data structure that developer have to
implement. An IDE is most important in GUI (Graphical User Interface) application development.
Simple algorithm implementation using an IDE:
Q1. Finding largest number on a list?
List: (12, 45, 34, 67, 85, 12, 4, 69, 85, 87, 113, 3, 78)
Flow Chart:
Unit 01: Programming
66
Figure 46: Example flow chart
about:blank
66/103
2/28/24, 12:11 AM
Unit 01 -Programming
Pseudo Code:
Program FindLargest
Local Data:
I, MAX, V, N: Integer;
Begin
INPUT List;
N = size of List;
I = 0;
MAX = 0;
V = 0;
WHILE I <= N:
V = value of List (I);
IF MAX >= V THEN
MAX = V;
END IF
I = I + 1;
END WHILE
DISPLE MAX;
End.
Unit 01: Programming
about:blank
67
67/103
2/28/24, 12:11 AM
Unit 01 -Programming
C# Code:
Figure 47: C# code sample
Output:
Figure 48: C# Code sample output
about:blank
68/103
2/28/24, 12:11 AM
Unit 01 -Programming
Why do developers use IDEs?
An IDE allows developers to start programming new applications quickly because multiple
utilities don’t need to be manually configured and integrated as part of the setup process.
Developers also don’t need to spend hours individually learning how to use different tools when
every utility is represented in the same workbench. This can be especially useful for onboarding
new developers who can rely on an IDE to get up to speed on a team’s standard tools and
workflows. In fact, most features of IDEs are meant to save time, like intelligent code completion
and automated code generation, which removes the need to type out full character sequences.
Other common IDE features are meant to help developers organize their workflow and solve
problems. IDEs parse code as it is written, so bugs caused by human error are identified in realtime. Because utilities are represented by a single GUI, developers can execute actions without
switching between applications. Syntax highlighting is also common in most IDEs, which uses
visual cues to distinguish grammar in the text editor. Some IDEs additionally include class and
object browsers, as well as class hierarchy diagrams for certain languages.
It is possible to develop applications without an IDE, or for each developer to essentially build
their own IDE by manually integrating various utilities with a lightweight text editor like Vim or
Emacs. For some developers the benefit of this approach is the ultra-customization and control it
offers. In an enterprise context, though, the time saved, environment standardization,
and automation features of modern IDEs usually outweigh other considerations. (red hat, 2022)
Unit 01: Programming
about:blank
69
69/103
2/28/24, 12:11 AM
Unit 01 -Programming
Activity 03
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.
C# Code:
Unit 01: Programming
about:blank
70
70/103
2/28/24, 12:11 AM
Unit 01 -Programming
Figure 49: Rent calculation C# code
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.
C# Code:
Unit 01: Programming
about:blank
71
71/103
2/28/24, 12:11 AM
Unit 01 -Programming
Figure 50: Hire calculation C# Code
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.
C# Code:
Unit 01: Programming
about:blank
72
72/103
2/28/24, 12:11 AM
Unit 01 -Programming
Figure 51: Hire Calculation long tour C# Code
Debugging Features in Visual Studio
Debugging is the method that detects and removes potential errors that could lead to worstcase seniors. Error or undefined behaviors is called “bugs”. Bugs could be in many forms and
identifying them is a very difficult task. But using the debugging feature available in Visual
Studio developers do not need to waste time on finding critical errors.
Unit 01: Programming
about:blank
73
73/103
2/28/24, 12:11 AM
Unit 01 -Programming
Break-Point Debugging
Breakpoint debugging is debugging method that is available on lot of IDEs. The main
feature of this debugging technique is that we can run our program step by step. From that, we can
look at how variable values changes. Also, if there was an “Error” we have no idea where it
occurs. With a breakpoint debugging we easily identify where the “Errors” is occurred and what
causes them.
Figure 52: Break Point
Figure 53: Step by Step Debugging with Break points
Figure 54: Debugging controllers
Live Code Editing
Live code editing is a newly added feature to the visual studio. The main advantage
of this live code editing is we can edit our program while the program is running. We can see the
changes in the variable values and the changes did not do what we are expected. We can edit that
variable while the program is running. But the disadvantage of the live code editing is that the
Unit 01: Programming
about:blank
74
74/103
2/28/24, 12:11 AM
Unit 01 -Programming
changes we made did not take effect soon. In order to check the changes, we
have to restart the program.
Figure 55: Live Code Editing
Set a watch
Using the set watch debugging method we can create table of variable that we want inspect
value changes on each variable.
Figure 56: Table of Variables
Examine the call stack
The Call Stack shows the order in which methods and functions are getting called. The call
stack is a good way to examine and understand the execution flow of an app.
Unit 01: Programming
about:blank
75
75/103
2/28/24, 12:11 AM
Unit 01 -Programming
Figure 57: Call Stack Table
Coding Standards
When it comes to group projects or open-source projects coding standards are very
important because each person has a different overview of the project. For example, name is a
variable, different from each person. Because of that coding standards are very important.
Some of the C# coding standards
01. Class and Method names should always be in Pascal Case
Figure 58: Class name in Pascal Case
Figure 59: Method name in pascal case
about:blank
76/103
2/28/24, 12:11 AM
Unit 01 -Programming
02. Method argument and Local variables should always be in Camel case.
Figure 60: Camel case arguments
03. Avoid the use of underscore while naming identifiers.

Figure 61: Identifiers without underscore
04. Avoid the use of System data types and prefer using the Predefined data types.
Figure 62: Using predefined data types
about:blank
77/103
2/28/24, 12:11 AM
Unit 01 -Programming
05. For better code indentation and readability always align the curly braces vertically.
Figure 63: aligned curly braces
Purpose of debugging applications
The main purpose of debugging an application is to create the application more secure and
user-friendly. There are different kinds of Errors and Exceptions that occur while debugging.
Unit 01: Programming
about:blank
78
78/103
2/28/24, 12:11 AM
Unit 01 -Programming
Finding answers for every single error could be a hard thing to do. This
could lead to many horrible situations probably, and crashing the whole application could be one
of them.
Also, Applications are human-written programs. Nowadays many programs are written by
automated systems or BOTS. But these programs were also developed by humans. We cannot
expect 100% security for each program development. For example, when it’s come to C/C++
language support is very minimum, unlike C# languages C/C++ is not a much managed language.
Anyone who develops an application using these languages has to be more careful. On other hand
C/C++ is a powerful language, is used for controlling hardware and writing firmware to specific
hardware. Because of that, single mistake while writing codes can end up with damaging
hardware.
Security is another essential thing to an application. Any application with bad coding could
potentially thread to any system. If the developer fails to identify the application errors on right
time the application's undefined behavior could damage the installed system. Even if we have able
to install “Patch” for the application. When we use a managed language like C#, Java or Python
which have lots of subsystems it helps to manage our program memory for us. If codes that we
have written is not under the coding standard of programming language, those subsystem starts to
fail and end up with collecting lots of unnecessary data on the memory or RAM (Random Access
Memory). The disadvantage of this is, that our computer starts to slow down and some of the
application works very poorly because of the low memory until the next restart
This is why application debugging is very important. If we want to develop a more secure
application that helps the user to archive their goals without having any trouble, the right thing to
do is debugging and finding errors, and fixing them.
Unit 01: Programming
about:blank
79
79/103
2/28/24, 12:11 AM
Unit 01 -Programming
Importance of the Coding standards
Coding standards very important because it’s good discipline for every developers. There
are lot of programming language. Each programming language has different coding standards. For
example if we are coding in C#. Class, Method and Identifiers declare in “Pascal Case” standard.
If we are using C/C++, Class, Method and Properties declare in “Camel Case” and “Snake Case”.
Enhancing the efficiency
Enhancing the efficiency of a program is very important part of application development.
Most of time developer wasting time on finding and fixing problem in the application. That is
why it’s very important to coding standard must have on each team or individuals. From that we
have able to find problems and errors very early.
The risk of project failure is reduced
Each project or Task has its own time limit. Completing the task or the project on time is
the main and number one priority of each developer. But due to the time-wasting on problem
identification, there is always the risk of project failure. This is one reason coding standards could
affect everything.
Minimal Complexity
If one developer use the coding standards correctly other developers do not have to waste
time understanding codes again. Also, it is very helpful for completing projects or tasks on time.
Bug Rectification
It becomes really easy to locate and correct bugs in the software if the source code is written
in a consistent manner.
Thanks to coding standards we have been able to reduce a lot of trouble during coding and
debugging. Developers should take a serious and deep look at coding standards for their own
benefit.
Unit 01: Programming
about:blank
80
80/103
2/28/24, 12:11 AM
Unit 01 -Programming
Activity 04
Ayubo Drives Use Case Diagram
Figure 64: Ayubo Drives Use case diagram
Unit 01: Programming
about:blank
81
81/103
2/28/24, 12:11 AM
Unit 01 -Programming
Ayubo Drives Class Diagram
Figure 65: Ayubo Drives Class Diagram
Unit 01: Programming
about:blank
82
82/103
2/28/24, 12:11 AM
Unit 01 -Programming
Ayubo Drives ER Diagram
Figure 66: Ayubo Drives ER Diagram
Unit 01: Programming
about:blank
83
83/103
2/28/24, 12:11 AM
Unit 01 -Programming
Ayubo Drives Application – Interfaces
Login Form
Figure 67: Application Login Form
Main Menu Form
Figure 68: Application Main menu form
Unit 01: Programming
about:blank
84
84/103
2/28/24, 12:11 AM
Unit 01 -Programming
Service Form
Figure 69: Service form
Customers Form
Figure 70: Customer form
Unit 01: Programming
about:blank
85
85/103
2/28/24, 12:11 AM
Unit 01 -Programming
Customers Edit Form
Figure 71: Customer details form
Drivers Form
Figure 72: Driver form
Unit 01: Programming
about:blank
86
86/103
2/28/24, 12:11 AM
Unit 01 -Programming
Drivers Edit Form
Figure 73: driver detailed form
Vehicles Form
Figure 74: Vehicle form
Unit 01: Programming
about:blank
87
87/103
2/28/24, 12:11 AM
Unit 01 -Programming
Vehicles Edit Form
Figure 75: Vehicle Edit Form
Vehicle Owners Edit Form
Figure 76: Vehicle Owner Edit Form
Unit 01: Programming
about:blank
88
88/103
2/28/24, 12:11 AM
Unit 01 -Programming
Rent Form
Figure 77: Rent Form
Rent Finish Form
Figure 78: Rent finish form
Unit 01: Programming
about:blank
89
89/103
2/28/24, 12:11 AM
Unit 01 -Programming
Packages For
Figure 79: Packages Form
Hire Form
Figure 80: Hire Form
Unit 01: Programming
about:blank
90
90/103
2/28/24, 12:11 AM
Unit 01 -Programming
Hire Finish Form
Figure 81: Hire Finish Form
Quick Search Form
Figure 82: Quick Search Form
Unit 01: Programming
about:blank
91
91/103
2/28/24, 12:11 AM
Unit 01 -Programming
Ayubo Drives Source code and Database:
https://drive.google.com/file/d/1cm3ze-V10MbM-C3A5J9bmN5AQSogWC30/view?usp=sharing
Application Login Credentials
User name: Admin
Password: esoft@123
Ayubo Drive Application Testing
Vehicle - Add
Figure 83: Vehicle Add Interface
Unit 01: Programming
about:blank
92
92/103
2/28/24, 12:11 AM
Unit 01 -Programming
Test case no: 01
Test case: Vehicle – Add
Date: 2022.05.14
Tester: Isuru Senanayaka
Test
Description
ID
01
Expected
Actual Result
Feed Back
Result
Add Vehicle
Record
Fill all fields
successfully
before save.
saved
02
Add Vehicle
Record
Record inserted
successfully
successfully.
saved
Table 1 : Test case 01
Unit 01: Programming
about:blank
93
93/103
2/28/24, 12:11 AM
Unit 01 -Programming
Vehicle - Edit / Delete
Figure 84: Vehicle Edit and Delete interface
Test case no: 02
Test case: Vehicle – Edit / Delete
Date: 2022.05.14
Tester: Isuru Senanayaka
Test ID
Description
Expected
Actual Result
Unit 01: Programming
about:blank
Feed Back
94
94/103
2/28/24, 12:11 AM
Unit 01 -Programming
Result
01
Editing
Record
Record
Vehicle
updated
ated
Records
successful
essful
ly
02
Deleting
Record
Vehicle
successful
Record
Records
ly
cessful
removed.
moved.
Table 2: Test Case 02
Unit 01: Programming
about:blank
95
95/103
2/28/24, 12:11 AM
Unit 01 -Programming
Package – Add
Figure 85: Package Add Interface
Test case no: 03
Test case: Package Add
Date: 2022.05.14
Tester: Isuru Senanayaka
Test ID
Description
01
Package Add
Expected
Result
Package
successfully
Saved
Actual Result
Unit 01: Programming
about:blank
Feed Back
Fill all fields
before add
records
96
96/103
2/28/24, 12:11 AM
02
Package
Add
Unit 01 -Programming
Package
successful
ly
Saved
Package
uccessful
aved
Table 3 : Test Case 03
Hire Calculation
Figure 86: Hire Adding Interface
Test case no: 04
Test case: Hire record saving
Date: 2022.05.14
Tester: Isuru Senanayaka
Unit 01: Programming
about:blank
97
97/103
2/28/24, 12:11 AM
Unit 01 -Programming
Test ID
Description
01
Hire Vehicle
Expected
Result
Record Saved
Actual Result
Feed Back
Record Saved
Table 4: Test Case 04
Record in Database
Figure 87: Records Saved in the database
Unit 01: Programming
about:blank
98
98/103
2/28/24, 12:11 AM
Unit 01 -Programming
Finishing Hire
Figure 88: Hire Calculation
Test case no: 05
Test case: Hire calculation and payments
Date: 2022.05.14
Tester: Isuru Senanayaka
Test ID
Description
Expected
Result
01
Calculate the Hire
hire charge
Charge :
when
3000
Actual Result
Feed Back
Expected
Result
produced.
StartKM : 0
StopKM : 200
Retun Date:
2022.05.15
Table 5: Test Case 05
Unit 01: Programming
about:blank
99
99/103
2/28/24, 12:11 AM
Unit 01 -Programming
Rent Calculation
Figure 89: Rent Adding Interface
Test case no: 06
Test case: Rent record saving
Date: 2022.05.14
Tester: Isuru Senanayaka
Test ID
Description
Expected Result
01
Rent Vehicle
Record Saved
Actual Result
Feed Back
Record Saved
Table 6: Test Case 06
Unit 01: Programming
about:blank
100
100/103
2/28/24, 12:11 AM
Unit 01 -Programming
Record in Database
Figure 90: Record Saved in the Database
Finishing Rent
Figure 91: Rent Calculation
Test case no: 07
Test case: Rent calculation and payment
Date: 2022.05.14
Tester: Isuru Senanayaka
Unit 01: Programming
about:blank
101
101/103
2/28/24, 12:11 AM
Unit 01 -Programming
Test ID
Description
01
Calculate the
rent charge
when
Expected
Result
Rent charge
Actual Result
Feed Back
Expected
Result
produced.
Weekly Rent:
700
Daily Rent:
800
Daily Driver
Cost : 300
Return Date:
2022.05.19
Table 7: Test Case 07
Unit 01: Programming
about:blank
102
102/103
2/28/24, 12:11 AM
Unit 01 -Programming
References
geeksforgeeks, 2022. GeeksforGeeks. [Online]
Available at: https://www.geeksforgeeks.org/introduction-of-programming-paradigms/
[Accessed 23 03 2022].
Gregersen., E., 2021. https://www.britannica.com/. [Online]
Available at: https://www.britannica.com/technology/database-management-system
[Accessed 10 02 2022].
Gregersen, E., 2021. www.britannica.com. [Online]
Available at: https://www.britannica.com/technology/computer-circuitry
[Accessed 24 01 2022].
red hat, 2022. What is an IDE?. [Online]
Available at: https://www.redhat.com/en/topics/middleware/what-is-ide
[Accessed 13 04 2022].
Technology UK, 2022. www.technologyuk.net. [Online]
Available at: https://www.technologyuk.net/computing/software-development/softwaredesign/event-driven-programming.shtml
[Accessed 23 03 2022].
Unit 01: Programming
about:blank
103
103/103
Download