Dishan Sanjaya - E007781 - Unit 01 Programming Assignment - Reworded 2021
Dishan Sanjaya - E007781 - Unit 01 Programming Assignment - Reworded 2021
Unit(s)
Assignment title
Student’s name
List which assessment criteria Pass Merit Distinction
the Assessor has awarded.
Give details:
Internal Verifier
Date
signature
Programme Leader
Date
signature (if required)
Higher Nationals - Summative Assignment Feedback Form
Student Name/ID
Unit Title
Assignment Number 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.
LO2. Explain the characteristics of procedural, object-orientated and event-driven programming, conduct an analysis
Integrated Development Environment (IDE).
LO4. Determine the debugging process and explain the importance of a coding standard.
Pass, Merit & Distinction Descripts P4 P5 M4 D4
* Please note that grade decisions are provisional. They are only confirmed once internal and external moderation has taken place and
grades decisions have been agreed at the assessment board.
Assignment Feedback
Formative Feedback: Assessor to Student
Action Plan
Summative feedback
Assessor Date
signature
Student Date
signature
Pearson Higher Nationals in
Computing
Unit 01: Programming
Assignment 01
General Guidelines
1. A Cover page or title page – You should always attach a title page to your assignment.
Use previous page as your cover sheet and 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.
1. The font size should be 12 point, and should be in the style of Time New Roman.
2. Use 1.5 line spacing. Left justify all paragraphs.
3. Ensure that all the headings are consistent in terms of the font size and font style.
4. Use footer function in the word processor to insert Your Name, Subject, Assignment No,
and Page Number on each page. This is useful if individual sheets become detached for any
reason.
5. Use word processing application spell check and grammar check function to help editing
your assignment.
Important Points:
1. It is strictly prohibited to use textboxes to add texts in the assignments, except for the
compulsory information. eg: Figures, tables of comparison etc. Adding text boxes in the body
except for the before mentioned compulsory information will result in rejection of your
work.
2. Carefully check the hand in date and the instructions given in the assignment. Late
submissions will not be accepted.
3. Ensure that you give yourself enough time to complete the assignment by the due date.
4. Excuses of any nature will not be accepted for failure to hand in the work on time.
5. You must take responsibility for managing your own time effectively.
6. If you are unable to hand in your assignment on time and have valid reasons such as illness,
you may apply (in writing) for an extension.
7. Failure to achieve at least PASS criteria will result in a REFERRAL grade .
8. Non-submission of work without valid reasons will lead to an automatic RE FERRAL. You will
then be asked to complete an alternative assignment.
9. If you use other people’s work or ideas in your assignment, reference them properly using
HARVARD referencing system to avoid plagiarism. You have to provide both in-text citation
and a reference list.
10. If you are proven to be guilty of plagiarism or any academic misconduct, your grade could be
reduced to A REFERRAL or at worst you could be expelled from the course
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.
Unit Tutor
Issue Date
Submission Date
Submission Format
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)
3. Presentation
With the submitted system student should do a presentation to demonstrate the system that was
developed. Time allocated is 10 to 15 min. Student may use 5 to 10 PowerPoint slides while doing the
presentation, but live demonstration of the system is required. Evaluator will also check the ability to
modify and debug the system using the IDE.
Unit Learning Outcomes:
LO1. Define basic algorithms to carry out an operation and outline the process of
programming an application.
LO4. Determine the debugging process and explain the importance of a coding
standard
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
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.
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.
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:
2. Hire (with driver only) – These are based on packages such as airport drop, airport pickup,
100km per day package, 200km per day package etc. Standard rates are defined for a
package type of a vehicle typeif that is applicable for that type of vehicle.For each package
maximum km limit and maximum number of hours arealso defined. Extra km rate is also
defined which is applicable if they run beyond the allocated km limit for the tour. For day
tours if they exceed max hour limit,a waiting charge is applicable for extra hours. Driver
overnight rate and vehicle night park rate also defined which is applicable for each night
when the vehicle is hired for 2 or more days.
Activity 3
Write suable algorithms for vehicle tariff calculation for rents and hires. Ideally 3
functions should be developed for this purpose as above. Use the visual studio IDE
(using C#.net) to Implement the above algorithms and design the suitable database
structure for keeping the tariffs for vehicle types and different packages which must be
used for implementing the above functions.
Analyze the features of an Integrated Development Environment (IDE) and explain how
those features help in application development. Evaluate the use of the Visual
StudioIDE for your application development contrasted with not using an IDE.
Activity 4
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 forAyubo drive. This includes the
completing the database design started in 3.2 and implementing one or more GUIs for
vehicle, vehicle type, and package add/edit/delete functions. It essentially requires an
interface for hire calculation and recording function described above. Generating customer
reports and customer invoices are not required for this course work.
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.
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.
Grading Rubric
1. Acknowledgement ......................................................................................................... 26
Activity 1 ........................................................................................................................... 27
1. What is an algorithm? .................................................................................................... 27
1.1 Main Characteristics of a good algorithm ................................................................ 27
1.2 Types of Algorithms ................................................................................................ 28
1.2.1 Pseudocode........................................................................................................ 28
1.2.2 Flow charts ........................................................................................................ 29
1.3 Featured Characteristics of a good algorithm: ......................................................... 31
1.4 Algorithms with Examples .................................................................................. 31
1.4.1 The Fibonacci series: ........................................................................................ 31
1.4.2 Factorial: ........................................................................................................... 32
1.5 Programming Process .............................................................................................. 33
1.5.1 Defining the Problem ........................................................................................ 33
1.5.2 Planning the solution ......................................................................................... 33
1.5.3 Coding the Program .......................................................................................... 34
1.5.4 Testing the program .......................................................................................... 34
1.5.5 Documenting the Program ................................................................................ 35
1.6 Steps of executing a program: .................................................................................. 36
1.7 What is Big-O notation? .......................................................................................... 37
1.8 Algorithm Performance............................................................................................ 37
1.9 Analysis types .......................................................................................................... 38
1.9.1 Best-Case .......................................................................................................... 38
1.9.2 Worst case ......................................................................................................... 38
1.9.3 Average Case .................................................................................................... 38
1.10 Determine Complexities ........................................................................................ 39
1.10.1 Linear Complexity (O(n)) ............................................................................... 39
1.10.2 Constant Complexity (O(C)) ........................................................................... 39
1.11 Fibonacci Series Python Code ............................................................................... 39
1.11.1 Program execution .......................................................................................... 40
1.12 Python code for the Factorial: ................................................................................ 40
19 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
1.12.1 Program execution .......................................................................................... 40
Activity 2............................................................................................................................ 41
2. Programming Paradigm ................................................................................................. 41
2.1 Procedural Programming– ....................................................................................... 42
2.1.1 Key Features of Procedural Programming ........................................................ 43
2.1.2 Advantages of Procedural Programming .......................................................... 44
2.1.3 Disadvantages of Procedural Programming ...................................................... 45
2.2 Object Oriented Programming (OOP) – .................................................................. 45
2.2.1 Advantages of Object-Oriented Programming ................................................. 46
2.2.2 Disadvantages of Object-Oriented Programming ............................................. 46
2.3 Event-Driven Programming– ................................................................................... 47
2.3.1 Key Features and Characteristics of event-driven programming...................... 47
2.4 Object-Oriented Programming Vs Procedural Programming .................................. 49
2.5 Key Differences between Procedural & Object-Oriented Programming ................. 49
2.6 Object-Oriented Programming and Event Driven Programming ............................ 50
Activity 3............................................................................................................................ 51
3.1 Function 1: Rent calculation. ................................................................................... 51
3.2 Function 2: Day tour - hire calculation. ................................................................... 53
3.3 Function 3: Long tour - hire calculation. ................................................................. 55
3.4 Database structure for the tariffs for vehicle types and different packages, ............ 56
3.5 Features of an Integrated Development Environment (IDE), .................................. 57
3.6 How Visual Studio help to me develop my application,.......................................... 57
Activity 4............................................................................................................................ 60
4.1 Login Screen ............................................................................................................ 60
4.2 Main Screen ............................................................................................................. 62
4.3 About Screen ............................................................................................................ 64
4.4 Customers Screen ..................................................................................................... 65
4.5 Rent Screen .............................................................................................................. 69
4.6 Packages Screen ....................................................................................................... 73
4.7 Drivers Screen .......................................................................................................... 77
4.8 Vehicle Suppliers Screen ......................................................................................... 81
4.9 Vehicles Screen ........................................................................................................ 86
4.10 Bill Screen .............................................................................................................. 92
20 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
4.11 Database Design ..................................................................................................... 99
4.12 What is Debugging? ............................................................................................. 100
4.12.1 Debugging in MS Visual Studio ................................................................... 100
4.12.2 Error Detection and correction ...................................................................... 101
4.12.3 Breakpoints ................................................................................................... 102
5. References .................................................................................................................... 105
List of Figures
24 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
List of Tables
25 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
1. Acknowledgement
First of all, I want to thank ESOFT Metro Campus from the bottom of my heart for giving
me this chance.
This project's completion was made possible by the encouragement of our lecturer, Mr.
Thanuja Sandaruwan, for those who backed us wholeheartedly.
I am extremely grateful to him for providing such nice support and guidance. Because
without his help and support, this program would be a pipe dream, and ultimately, my
cherished family members, who stood with me through everything. I appreciate all of
your help.
Last but not least, I must state that the satisfaction of completing a task successfully
would be lacking without mentioning the individuals whose ongoing cooperation made it
possible and whose persistent direction and support crown all efforts with success. I'm
grateful to my project mentor, Mr. Thanuja Sandaruwan, for her advice, inspiration, and
helpful criticism as I put my project together.
26 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Activity 1
1. What is an algorithm?
Algorithm is a sequence of steps to be followed to solve a problem. A dangerous situation
in which a particular data set or set of data is used as an input to be understood as an
information output and to have a clear meaning. The mathematical process uses a limited
number of steps, and the algorithm solves problems using a limited number of steps.
1. Input specified –
A well-defined input of an algorithm produces 0 or more inputs. The input is the
data that will be changed during the computation to make the output. At least one
of an algorithm's inputs should be clear. Input accuracy means knowing what kind
of data, how much, and what shape the data should be in.
2. Output specified –
An algorithm must have one or more well defined outputs. The data that comes
out of the calculation is called the output. For example, an algorithm should have
one or more clear outputs that match what is wanted. For output accuracy, you
also need to know what kind of data, how much, and what shape the output should
be.
3. Definiteness –
An algorithm all steps have well defined clearly. Algorithms must describe each
step and the order in which they should be done. Definiteness means that you can
say precisely how input is turned into output. Algorithms should be easy to
understand. Each step must also be explained in detail. It should have everything
that can be measured and nothing that can be described.
27 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
4. Effectiveness –
The subtle steps required to obtain the output should be called principle and
should be implemented in a timely manner. For an algorithm to work, all of the
steps that must be taken to get to the output must be possible with the available
resources. However, it shouldn't have any actions that aren't needed or are
repeated because that would make the algorithm less useful.
5. Finiteness –
The algorithm should end after a limited number of steps. The algorithm will have
to stop at some point. When you stop, you might get the result you were hoping
for, or you might get a message that no solution is possible. Algorithms must end
when they reach a certain number of steps. An algorithm shouldn't go on forever;
it should end after several steps.
We don't need an algorithm that works forever, so there is no point in making one.
6. Independent –
An algorithm should have systematic instruction and be independent of its
duration reduction code. An algorithm should have step-by-step instructions that
are not tied to any specific programming code. Instead, it should be written so that
any programming language can run.
So, these are the things that an algorithm should have for it to work well.
1.2.1 Pseudocode
Pseudocode is a simple step by step text code written by using simple English language
which is describing the solution how will going to solve the problem.
Ex: Pseudocode for calculate sum of 6 numbers you entered.
28 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
PROGRAM GetSummation:
SET Sum TO 0
FOR 6 times
DISPLAY “Enter a score”
GET Score
CALCULATE Sum = Sum + Score
ENDFOR
DISPLAY “The Sum of scores you entered is:”
DISPLAY Sum
END
29 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Ex: Flow chart for calculate sum of 6 numbers you entered,
Start
Count = 0
Sum = 0
Input number
Is No
Count <6
Yes
Sum = Sum + Number
Input number
Stop
30 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
1.3 Featured Characteristics of a good algorithm:
• Algorithms should be clear, precise, and unambiguous steps.
• Algorithms should have finite amount of input and output data
• Algorithms should have finite number of steps to solve the problem in finite time.
• Algorithms should be independent from any programming language.
31 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
PROGRAM Fibonacci_series:
Count = 1
OldNumber1 = 0
OldNumber2 = 1
CurrentNumber = 0
INPUT N
PRINT OldNumber1
PRINT OldNumber2
1.4.2 Factorial:
PROGRAM Factorial:
Total = 1
INPUT Number
WHILE Number > 0
Total = Total * Number
Number = Number - 1
END WHILE
PRINT Total
END.
32 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
1.5 Programming Process
Programming is putting an algorithm into a notation called a programming language so
that a computer can run it. Both the process and the data must be able to be written
down in a programming language. To do this, languages have control structures and
types of data.
Creating a program has steps similar to any other problem-solving task. The
programming process is made up of five main parts:
Steps of writing program:
33 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 1 shows the characters and how they can be used in a simplified flowchart
of a typical daily task: mailing a letter.
Pseudocode is a nonstandard language that is based on English. It let’s you say
things more precisely than you could in plain English, but it doesn't require as
much precision as a formal programming language. With pseudocode, you can
focus on a program's logic without worrying about a programming language's
syntax.
Even though programming languages work like the English language in terms of
grammar, they are much more precise. To get your program to work, you must
follow the syntax of the language you are using exactly. For example, using the
language correctly isn't a guarantee that your program will work, just like using
correct grammar doesn't mean you know what you're talking about. So the point
is that the first step is to use the language correctly. Then, your coded program
must be typed so the computer can understand it. This can be done with a
terminal or a personal computer.
34 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
But the world is still imperfect, so most programmers get used to the idea that
their new programs probably have a few mistakes. At first, this is a bit
discouraging since programmers tend to be careful, precise, and proud of their
work. Still, there are many ways to make mistakes in programs, and you will
probably find a few of them, just like those who have come before you.
Debugging
Debugging is a term used a lot in programming. It means finding and fixing bugs
(mistakes), usually by running the program. These bugs are mistakes in logic,
like telling a computer to do something repeatedly but not telling it how to stop.
So, you run the program with the test data you've created during this step. To
ensure you test every part of the program, you must carefully plan the test data.
35 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
1.6 Steps of executing a program:
A. For 5 to N as input
Count = Count + 1
Print OldNumber1
Print OldNumber2
CurrentNumber =
CurrentNUmber
CurrentNumber
OldNumber1 +
OldNumber1
OldNumber2
OldNumber2
OldNumber1
OldNumber2
Count
Print
1 01 0 1 0 1 1 1 1 2
2 - 1 1 1 2 1 2 2 3
3 - 1 2 2 3 2 3 3 4
4 - 2 3 3 5 3 5 5 5
5 - - - - - - - - -
36 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
1.7 What is Big-O notation?
The Big O notation is the mathematical notation that shows how a function behaves as
its argument approaches a specific value or infinity. It is part of a group of notations
called the Bachmann–Landau notation or asymptotic notation made by Paul Bachmann,
Edmund Landau, and others.
Big-O notation is a method that evaluate the efficiency of an algorithm. Usually in Big-
O notation we use two main methods to evaluate the efficiency.
• Time Complexity (No of steps).
• Memory Complexity.
In time complexity, it describes that the how many steps in algebraic form which follow
to do the task.
In memory complexity, it describes that the how much memory space use the program.
1.9.1 Best-Case
Best-case performance is utilized in engineering to elucidate the Associate in Nursing
algorithm’s behavior under the best conditions—for example, the array of things that are
already sorted.
Worst-case performance is utilized to analyze the formula behavior beneath worst-case
input and is the least accomplishable to unravel the matter. Then, it determines when the
formula will perform worst for the given information.
Average case Performance is the measured practice of the everyday best conditions to
unravel the matter. Example: kind, kindred things practice insertion type
38 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
1.10 Determine Complexities
The formula complex ignores the constant value in formula analysis. If the formula takes
n^2+13n+43 time to calculate all the steps, the formula analysis ignores all the constants
and takes a time of O (n^2).
39 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
1.11.1 Program execution
40 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Activity 2
2. Programming Paradigm
41 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 6 - Programming Paradigms
Simply put, procedural programming means writing down a list of instructions that tell
the computer what to do step-by-step to finish the task.
Ex: Pascal, C
42 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 7 - Procedural Programming example (Written in C language)
1. Predefined functions:
Most of the time, a predefined function is an instruction with a name. Most of the
time, predefined functions are built into higher-level programming languages, but
they come from the library or registry instead of the program. One example of a
predefined function is 'charAt' (), which searches a string for a specific character.
2. Local Variable:
A local variable is declared in the main structure of a method and can only be
used in the local area. This local variable can only be used in the methodology
where it is defined. If it is used outside of the method where it is specified, the
code will stop working.
43 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
3. Global Variable:
A global variable is declared outside of every other function in the code. Because
of this, global variables, unlike local variables, can be used in all functions.
4. Modularity:
Modularity is when two separate structures, each with its own set of tasks, are
combined or grouped to complete a single more significant task. Each group of
systems would have its own set of functions, which would be completed one by
one until the last task was completed.
5. Parameter Passing:
Parameter passing is a method for passing parameters to functions, subroutines,
and procedures. For example, "Pass by value," "pass by comparison," "pass by
the result," "pass by value-result," and "pass by the name" are all methods for
passing parameters.
44 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
2.1.3 Disadvantages of Procedural Programming
• The relationship among all the available classes may become artificial, which may
cause difficulties in development.
• Due to the program's large size, there is a need to execute more instructions.
• Effort: Object-oriented programs require a lot of work to create.
• Speed: Object-oriented programs are slower than other programs because of their
size.
46 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
2.3 Event-Driven Programming–
Event-driven programming is a computer programming paradigm that uses events'
occurrences to determine the program's control flow. This application is designed to
detect events as they occur, and use an appropriate event-handling procedure to deal with
them, which usually uses a callback function or method.
Theoretically, the event-driven programming style is supported in all programming
languages, but they may be different in how it is implemented; for example, it's easier to
implement in languages that provide high-level abstractions, such as closures. Besides,
other programming environments, such as Adobe Flash, are specifically tailored for
triggering program code by events.
Event driven paradigm is controlling the program flow by events like mouse click, key
press.
• This is an example for Event driven Programming paradigm wrote in Java Script
language. This code is written for show hidden CSS block in a website.
2. Time Driven
In event-driven programming, a time-driven paradigm is a piece of code that
runs when a certain amount of time has passed. Time-driven can be a piece of
code that runs at a particular time, like once an hour, once a week, or once a
month. This means it's on your list of things to do. For example, Windows
Update is a time-driven program because users can choose when to update or
check for and download updates.
47 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
3. Event Handlers
Event handlers are functions or methods that perform a specific action when a
particular event is triggered. For an example, it could be a button that, when the
user clicks it, will display a message and close the message when the user clicks
the button again; this is an event handler.
4. Trigger Functions
In event-driven programming, trigger functions decide what code to run when a
specific event occurs. These are used to select which event handler to use for the
event when a particular event occurs.
5. Events
Events include mouse, keyboard, and user interface, in which events need to be
triggered in the program to happen, which means the user has to interact with an
object in the program, for example, clicking a button with a mouse, using the
keyboard to select a button, etc.
48 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
2.4 Object-Oriented Programming Vs Procedural Programming
Procedural programming aims to break down a program into a collection of variables and
data structures. In contrast, the main aim of object-oriented programming is to break
down a programming task into objects. For example, procedural programming uses
procedures to operate on data structures, while object-oriented programming uses objects.
In both programming paradigms, the vocabulary is different, though they have similar
semantics:
Procedure Method
Record Object
Module Class
It focuses on the process and functions. It focuses on the data and classes.
It focuses on procedure rather data which has It focuses on data rather than procedures.
49 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
priority in data-driven systems.
With multi-threading, you can have more than one thread interact with your code
simultaneously. Multi-threading can use all of your CPU's cores, making it faster, but it
can also cause problems, like thread locking, when multiple threads try to access the same
object simultaneously.
Event-driven programming will still have objects, but it will also have threads that are
only initialized once an event has been triggered. For example, in a fire sprinkler system,
let's say there is a sensor for detecting a fire and a sprinkler system used to extinguish the
fire.
If we used only object-oriented, we would create an endless loop that constantly checks
the sensor's status. For example, if it detects a fire, we turn on the sprinkler, and the
program would work, but it would not be much use for any other task. For example, in an
event-driven program, we could set an event that triggers a thread when the fire sensor
activates, and we could create an event handler that would process the thread to tell the
sprinkler system to turn it on. In this fashion, our event program could also have other
functions as it is not stuck in an endless loop.
50 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Activity 3
INPUT vechicel_no
daily_rent_rate Fetch from Database according to vechicel_no
weekly_rent_rate Fetch from Database according to vechicel_no
monthly_rent_rate Fetch from Database according to vechicel_no
INPUT rented_date
INPUT return_date
INPUT with_driver
51 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
total_rent = no_of_months*monthly_rent_rate + no_of_weeks*weekly_rent_rate +
no_of_days* daily_rent_rate
END IF
PRINT total_rent
END.
52 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
3.2 Function 2: Day tour - hire calculation.
PROGRAM Day_tour_hire_Calculation:
total_hire_value = 0
base_hire_charge = 0
waiting_hire_charge = 0
extra_km_charge = 0
no_of_extra_km = 0
no_of_extra_hours = 0
INPUT vehicle_no
INPUT package_type
packge_price = Fetch from Database according to package_type and vehicle_no
max_km_limit = Fetch from Database according to package_type
extra_km_rate = Fetch from Database according to package_type
max_hour_limit = Fetch from Database according to package_type
extra_hourly_rate = Fetch from Database according to package_type
INPUT start_time
INPUT end_time
INPUT start_km_reading
INPUT end_km_reading
no_of_extra_km = (end_km_reading - start_km_reading) - max_km_limit
no_of_extra_hours = (end_time - start_time) - max_hour_limit
54 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
3.3 Function 3: Long tour - hire calculation.
PROGRAM Long_tour_hire_Calculation:
total_hire_value = 0
base_hire_charge = 0
overnight_stay_charge = 0
extra_km_charge = 0
no_of_extra_km = 0
INPUT vehicle_no
INPUT package_type
packge_price = Fetch from Database according to package_type and vehicle_no
max_km_limit = Fetch from Database according to package_type
extra_km_rate = Fetch from Database according to package_type
overnight_driver_rate = Fetch from Database according to vehicle_no
overnight_vehicle_rate = Fetch from Database according to vehicle_no
INPUT start_date
INPUT end_date
INPUT start_km_reading
INPUT end_km_reading
55 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
PRINT base_hire_charge
PRINT overnight_stay_charge
PRINT extra_km_charge
PRINT total_hire_value
END.
3.4 Database structure for the tariffs for vehicle types and different packages,
• hire_package (package_ID, package_name, vehicle_type, package_price,
max_km_limit, max_hour_limit, extra_km_rate, extra_hour_rate,
overnight_vehicle_rate, overnight_driver_rate)
56 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
3.5 Features of an Integrated Development Environment (IDE),
• Include good code editor with color schemes to identify code types. Like variables
in one color methods are represent with another color etc.
• IDE contains all features what want to do development such as compiler,
interpreter, and debuggers.
• Can use for not only for one programming language and frameworks. Ex: Visual
studio can handle C#, C++, VB.Net, java script etc. and .net framework, xmarine
and react.
• Many IDEs have performance managing tools to detect and optimize program
performance.
• In Visual Studio I could design my program interfaces easily using win forms and
their own widgets(controls).
57 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 11 - Tool box of Visual studio 2022
• In the newer version of Visual Studio have Intelligence which helps to do coding
faster, because it auto completes codes, suggest the better code standards etc.
• Visual Studio can work together with one or more languages at the same time in
the same project.
58 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 13 - Visual Studio have Intellisence
• Visual Studio also can use as a database management system for the project
databases.
59 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Without IDE,
• Without using an IDE, I couldn’t detect so many errors and correct them
efficiently.
• Further it is so hard to design interfaces without IDE.
• If I use plan text editor for coding, I can’t go through code segments easily and
manage them.
Activity 4
60 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Code
61 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
4.2 Main Screen
Code
62 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 19 - Main Screen Code 02
63 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
4.3 About Screen
64 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
4.4 Customers Screen
Code
65 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 24 - Customer screen Code 02
66 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 26 - Customer screen Code 04
67 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 28 - Customer screen Code 06
68 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
4.5 Rent Screen
69 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 31 - Rent Screen Code 02
70 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 33 - Rent Screen Code 03
71 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 35 - Rent Screen Code 05
72 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
4.6 Packages Screen
Code
73 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 38 - Package Screen Code 02
74 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 41 - Package Screen Code 05
75 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 43 - Package Screen Code 07
76 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
4.7 Drivers Screen
Code
77 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 46 - Drivers Screen Code 02
78 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 48 - Drivers Screen Code 04
79 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 50 - Drivers Screen Code 06
80 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
4.8 Vehicle Suppliers’ Screen
Code
81 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 54 - Vehicle suppliers’ screen Code 02
82 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 56 - Vehicle suppliers’ screen Code 04
83 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 58 - Vehicle suppliers’ screen Code 06
84 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 60 - Vehicle suppliers’ screen Code 08
85 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
4.9 Vehicles Screen
Code
86 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 63 - Vehicles Screen Code 02
87 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 65 - Vehicles Screen Code 04
88 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 67 - Vehicles Screen Code 06
89 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 69 - Vehicles Screen Code 08
90 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 71 - Vehicles Screen Code 10
91 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
4.10 Bill Screen
Code
92 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 74 - Bill Screen Code 02
93 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 77 - Bill Screen Code 04
94 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 79 - Bill Screen Code 06
95 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 80 - Bill Screen Code 08
96 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 81 - Bill Screen Code 09
97 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Figure 83 - Bill Screen Code 11
98 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
4.11 Database Design
99 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
4.12 What is Debugging?
100 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
• We use above options for debugging in MS Visual Studio.
• Using Error List we can identify where is errors were occurring and goto the code
lines which containing errors quickly.
101 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
4.12.3 Breakpoints
Breakpoints are used to examine code that you want when you know the line of code or
the section in detail at runtime.
102 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
• General Naming guidelines – I have use general naming guidelines with naming
functions and variables. Like I used lower case to variable names and used
underscore instead spaces.
103 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
• Line lengths - I tried to use 80–100-character count in every code line as well as.
• One statement per line - I have only type one statement in one line.
Using coding standers, it is easy to understand, manage and edit to any programmer not
only who started the coding in the project but also another programmer who involved to
the same project. Therefore, using coding standards is very effective and best practice
for every programmer.
104 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
5. References
Quora. 2022. What is a pseudocode for fibonnaic series?. [online] Available at:
<https://www.quora.com/What-is-a-pseudocode-for-fibonnaic-series> [Accessed 27 July
2022].
Dev, A., Prep, A., Learning, D., Mining, D., Learning, M., Experiences, I. and Dev Ruby
React JavaScript, W., 2022. Difference: Procedural & Object-Oriented Programming –
Coding Ninjas Blog. [online] Coding Ninjas Blog. Available at:
<https://www.codingninjas.com/blog/2020/12/18/difference-procedural-object-oriented-
programming/> [Accessed 27 July 2022].
105 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
Docs.microsoft.com. 2022. First look at the debugger - Visual Studio (Windows). [online]
Available at: <https://docs.microsoft.com/en-us/visualstudio/debugger/debugger-feature-
tour?view=vs-2019#advance-the-debugger-out-of-the-current-function> [Accessed 27
July 2022].
Cite this for Me | Free Reference Generator – Harvard, APA, MLA, Chicago...
2022. FREE Harvard Referencing Generator | Cite This For Me. [online] Available at:
<https://www.citethisforme.com/citation-generator/harvard> [Accessed 30 July 2022].
106 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781
• Please download Ayubo Drive Management System Programming
Assignment Project files here.
https://drive.google.com/drive/folders/1jO5BS6FnrrGosMV8yGZUfB02
ewOstmMy?usp=sharing
107 | P a g e
Dishan Sanjaya UNIT 01: Programming
E007781