Programming 1
Programming 1
lOMoARcPSD|41277594
Higher Nationals
Internal verification of assessment decisions – BTEC (RQF)
INTERNAL VERIFICATION – ASSESSMENT DECISIONS
Programme title Higher National Diploma in Computing
Give details:
Internal Verifier
Date
signature
Programme Leader
Date
signature (if required)
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 analysi
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
Activity 01
−have to get the running time using “n” as we did in the class, final big o
value should be O(n) – 26th of December 2022
Fibonacci series activity needs corrections,
−if someone input 5 you need to print first 5 numbers of the fibonacci series− 29th of
December 2022
− based on the user input output should be relevant numbers of the series − 29th of
December 2022
−Do the big o calculation of factorial activity and determine whether both algorithms are
good or bad at the end − 29th of December 2022
−At the end do an evaluation against the developed algorithm and code variant,
Ex: compare Fibonacci algorithm and code variant and do the evaluation − 29th of December
2022
Activity 2:
−In the evaluation between procedural code and the structure, don't mention about oop
concepts. highlight only the procedural characteristics such as functions, sequence,
repetition etc.
−Rest is good
Activity 3:
−when you write 3 functions for developed algorithms,write it as a seperate function outside
the main
Dear azman,
I'm really proud of your finished work on task 1,2 and 3. Hope to see the same level on
task 4 as well.
Activity 4:
The debugging process to develop more secure, robust applications....
Add how you have did this with ayubo system, how you have made it more secure with
debugging process
Action Plan
I have corrected the big value for my Fibonacci and Factorial activities. I conducted thorough
research on various platforms, including Google, to correct my Fibonacci series. I added the
input function to allow the user to input the required values, calculated the Fibonacci series,
and determined the big value for both algorithms. After evaluating both algorithms, I
concluded whether they are good or bad. I also corrected the evaluation for the procedural
code and developed functions for my three algorithms. Finally, I explained my debugging
process for developing more secure and robust applications for the Ayubo system.
lOMoARcPSD|41277594
Summative feedback
Overall, the programming assignment demonstrates a strong understanding of the concepts
and techniques involved in the subject. The required functionalities have been effectively
implemented, showing a solid grasp of programming principles. However, there are some
areas that need improvement, such as missing key elements that are important for ensuring
the integrity and performance of the code. Additionally, the implementation could be more
detailed and accurate. With these corrections made, the final product will be much stronger.
Good work, and continue striving for excellence in future assignments.
I wanted to take a moment to provide feedback on the lecture you recently gave in class.
Overall, I found the lecture to be well−organized and engaging. The materials provided
were clear and easy to understand, and I appreciated the use of real−world examples to
illustrate key concepts. Additionally, I found your teaching style to be interactive and
effective in keeping the class engaged throughout the lecture.
Overall, I believe that this lecture was a valuable learning experience and I appreciate the
time and effort that you put into preparing and delivering it. I look forward to learning more
in the future.
Sincerely,
[Your student, Mohamad Azman]
Assessor Date
signature
E174653@esoft.academy 31/01/2023
Student Date
signature
lOMoARcPSD|41277594
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
lOMoARcPSD|41277594
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.
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.
LO1. Define basic algorithms to carry out an operation and outline the process of
programming an application.
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
Ayubo Drive is the transport arm of Ayubo Leisure (Pvt) Ltd, an emerging travel & tour
lOMoARcPSD|41277594
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
lOMoARcPSD|41277594
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.
lOMoARcPSD|41277594
Acknowledgement
I would like to express my sincere gratitude to my lecturer, Mrs. Irani, for her exceptional
guidance and support during the completion of this programming assignment. Her
expertise and in-depth knowledge of the subject matter greatly enhanced my
understanding and helped me to develop my skills.
I would also like to extend my thanks to my classmates and peers for their valuable
feedback and insights. Their contributions greatly helped me to improve my work and
achieve the best possible outcome.
I am deeply grateful to the ESOFT metro campus for providing me with the resources and
facilities necessary to complete this assignment. The support and assistance of the staff
and faculty have been greatly appreciated.
Finally, I would like to thank my family and friends for their unwavering support and
encouragement throughout this process. Their belief in me and their motivation have been
instrumental in helping me to achieve my goals.
Table of Contents
Activity 1............................................................................................................................20
Definition of algorithms.................................................................................................20
Characteristics of a Good Algorithm.........................................................................20
process of building an application..................................................................................21
Fibonacci Numbers.........................................................................................................22
Fibonacci Numbers – Algorithm/pseudocode............................................................22
Fibonacci Numbers – Algorithm Output Dry run......................................................23
Fibonacci Numbers – Python code and outputs.........................................................23
Factorial Numbers..........................................................................................................24
Factorial Numbers - Algorithm/pseudocode..............................................................24
Factorial Numbers - Algorithm Output Dry run........................................................24
Factorial Numbers – python code and output............................................................25
Algorithm and code variant – Factorial..........................................................................25
Algorithm and code variant – Fibonacci........................................................................26
What is a Big O notation?..............................................................................................28
General rules..............................................................................................................28
Constant time..............................................................................................................29
Big O..........................................................................................................................29
Linear time.................................................................................................................30
Quadratic time............................................................................................................30
In Practice...................................................................................................................31
Big O notation to analyze the efficiency on an algorithm..............................................31
Here's an example of how to use Big O notation to analyze the efficiency of a simple
algorithm:.......................................................................................................................32
Python code for Fibonacci numbers...............................................................................34
When its compare to big O(n) with complexity chart................................................35
Python code for Factorial numbers................................................................................37
Activity 2............................................................................................................................38
2.1....................................................................................................................................... 38
What is a programming paradigm?................................................................................38
Procedural programming paradigm................................................................................39
Characteristics of procedural programming paradigm...............................................40
Examples for procedural languages...........................................................................40
A code snippet and output for procedural programming language............................41
Evaluation between code sample and procedural programming paradigm....................42
Object-oriented programming paradigm........................................................................43
Some advantages of object-oriented programming (OOP) include...........................43
Some potential disadvantages of OOP include:.........................................................44
Characteristics of Object-Oriented programming paradigm......................................46
Some examples of object-oriented programming (OOP) languages include.............48
A code snippet and output for object-oriented programming language.....................48
Output.........................................................................................................................49
lOMoARcPSD|41277594
Vehicle Registration...................................................................................................81
Package Registration..................................................................................................82
Rent Vehicle...............................................................................................................82
Hire Day Tour and Long Tour...................................................................................83
Ayubo Drive Vehicle Hire Amount Calculation, inserting, Updating, Delete, Searching
and Calculate Some Records in Database Management................................................83
Calculating Vehicle rent.................................................................................................85
Calculate Day Tour........................................................................................................85
Calculate Long Tour.......................................................................................................86
4.2....................................................................................................................................... 86
Debugging Process.........................................................................................................87
Features that available in Visual Studio IDE to facilitate debugging............................87
The debugging process to develop more secure, robust application..............................89
Some of the visual Studio IDE features that help me to debugging process to develop
Ayubo System more secure, robust application.............................................................90
Breakpoint...........................................................................................................90
Error list...............................................................................................................91
Immediate Window.............................................................................................92
Quick watch.........................................................................................................93
Try Catch.............................................................................................................94
Debugging Techniques in Visual Studio: An Overview................................................95
4.3....................................................................................................................................... 95
Coding Standard.............................................................................................................95
There are several benefits to using coding standards, including:...................................96
Coding Standards that I Used in Application Development..........................................96
Using Comment...................................................................................................96
Using Meaningful Variable Names.....................................................................97
Using Proper data Type.......................................................................................98
Maintaining Indentation While coding................................................................99
One Statement per line......................................................................................100
General naming Guidelines...............................................................................101
The Importance of Coding Standards in Team and Individual Development..............102
Team..................................................................................................................102
Individual.................................................................................................................102
Conclusion........................................................................................................................103
Gantt Chart.......................................................................................................................103
Self-criticism....................................................................................................................104
References........................................................................................................................104
lOMoARcPSD|41277594
Table of Figures
Activity 1
Definition of algorithms
There six characteristics of algorithms so the first one is it should be clear and
unambiguous the second one is that it has to be well defined inputs and the third one is
that it has to be having well-defined outputs as well the fourth property of an algorithm
is its feasibility followed by that. Finiteness and finally we have language independence.
Defining the problem – the very first step is defining the problem so if we define a
problem then we can get and try to get the solution for that by using the different steps
for example: we can use IPO model (input, process, output).
Planning the solution – planning the solution can be done by using a program design
tool. There are two common ways of planning a solution. we can use a flowchart, it’s a
diagram, can be pictorial representation of a step-by-step solution to a problem. Or we
can use pseudocode it’s an English like nonstandard language.
Coding the program – during this stage translating the logic that the previous express
flowchart / pseudocode in to a programming code.
lOMoARcPSD|41277594
Testing the program – after coding the program we have to test it on a computer. these
steps involve 3 phases. The Desk Checking, Translating, and Debugging.
Documenting the program – the last stage is called document the program. We need to
give various external and internal documentation that helps us understand this program
for future maintenance. Documentation consists of both internal and external. Internal
document is what given inside the program usually we can use comments and meaning
full data names. external document is brief description about the program we can use
(PDF, Doc) files. And data records, description, program listing source codes. Finaly
test data and test results to be add in the external documentation.
Fibonacci Numbers
BEGIN
Define a function called "fibonacci" that takes in an input "n"
Create a variable "a" and initialize it to 0
Create a variable "b" and initialize it to 1
Create a for loop that runs from 0 to "n"
Within the for loop, print the value of "a"
Create a variable "c" that is the sum of "a" and "b"
Set "a" to be the value of "b"
Set "b" to be the value of "c"
End the for loop
End the function
END
lOMoARcPSD|41277594
i a b
0 0 1
1 1 1
2 1 2
3 2 3
4 3 5
5 5 8
6 8 13
7 13 21
8 21 34
9 34 55
10 55 89
11 89 144
12 144 233
Factorial Numbers
lOMoARcPSD|41277594
BEGIN
Take input "n" from user
Create variable "factorial" and initialize it to 1
Check if "n" is greater than 0
If true, start a for loop that runs from 1 to "n+1"
Within the for loop, multiply "factorial" by "i"
End the for loop
Check if "n" is equal to 0
If true, set "factorial" to 1
Print "factorial"
End the program
END
n i Factorial
6 1 1
2 2
3 6
4 24
5 120
6 720
Figure 5 Factorial numbers Algorithm Output
The algorithm/pseudocode and the written code variant match and correctly implement
the steps for finding the factorial of a given number. The algorithm starts by taking input
'n' from the user and creating a variable 'factorial' and initializing it to 1. Then it checks
if 'n' is greater than 0, if it is true, it starts a for loop that runs from 1 to 'n+1' and within
the for loop, it multiplies 'factorial' with 'i'. It ends the for loop, then it checks if 'n' is
equal to 0, if it is true, it sets 'factorial' to 1 and finally, it prints 'factorial'.
The python code also follows the same logic and implements the same steps. It starts by
taking input 'n' from the user and initializing 'factorial' to 1. Then it checks if 'n' is
greater than 0, if it is true, it starts a for loop that runs from 1 to 'n+1' and within the for
lOMoARcPSD|41277594
loop, it multiplies 'factorial' with 'i' by using factorial = factorial*i. It ends the for loop,
then it checks if 'n' is equal to 0, if it is true, it sets 'factorial' to 1 and finally, it prints
'factorial' by using print(factorial).
Overall, the algorithm/pseudocode and the written code variant match and correctly
implement the steps for finding the factorial of a given number. The code is well
organized, easy to understand, and properly indented. It follows the standard
conventions of the programming language, and it should produce the correct output for
any valid input.
The algorithm/pseudocode and the written code variant match and correctly implement
the steps for generating the Fibonacci series of numbers up to a given input 'n'. The
algorithm starts by defining a function called "fibonacci" that takes in an input "n". It
creates two variables 'a' and 'b' and initializes them to 0 and 1 respectively. It then
creates a for loop that runs from 0 to "n". Within the for loop, it prints the value of "a"
and creates a variable 'c' that is the sum of "a" and "b". Then it sets "a" to be the value of
"b" and "b" to be the value of "c" and ends the for loop. Finally, it ends the function.
The python code also follows the same logic and implements the same steps. It starts by
defining a function called "fibonacci" that takes in an input "n". It creates two variables
'a' and 'b' and initializes them to 0 and 1 respectively. It then creates a for loop that runs
from 0 to "n" by using the python keyword range. Within the for loop, it prints the value
of "a" by using print(a) and sets "a" to be the value of "b" and "b" to be the value of "c"
by using a, b = b, a + b. Finally, it takes input n from the user and calls the function
fibonacci(n) and prints the series of fibonacci numbers.
Overall, the algorithm/pseudocode and the written code variant match and
lOMoARcPSD|41277594
correctly implement
the algorithm and code are clear and efficient in generating the Fibonacci sequence up to
the nth term. However, the Big O notation of this function would be O(n) because the
running time increases linearly with the input size.
When we’re talking Big O notation, we typically look at worst case this isn’t to say the
others are unimportant.
General rules
O (1) < O (log n) < O(n) < O (n log n) < O(n2) < O(2n) < O(n!)
we
ignore a drop low order terms when they’re dominated by high order ones.
lOMoARcPSD|41277594
Example
Constant time
X = 5 + (10 * 20);
Following the line of code this basic computer statement computes x and it does not
depend on the input size in any way. This is Big O of one constant time
Big O
We have sequence of statements notice that all these are constant time.
X = 5 + (15 * 20);
Y = 15 – 2;
Print x + y;
We can compute Big O for this block of code we simply ass each of their times and we
get 3 multiplied by Big O of 1 but we drop constants so its still big o of 1
Linear time
the print statement is Big O of 1 this means the block od code is n times Big of 1 in
other words Big O of N
another example:
another sequence the first line we note again is Big O of one and the for loop is Big O of
m the total time is the summation of these two. We drop low order terms when n gets
large the time it takes to compute Y is meaningless as the for loop dominates the run
time.
Quadratic time
Following the block of code. Let’s see the total runtime. we know the runtime for each
of these so the total runtime is simply the max of the three
In Practice
1. Constants matter
2. Cognizant of best-case and average-case
When we coding the algorithms, we need to realize that constants absolutely do matter a
lot of situations have small input sizes so a constant of two or three could have a large
impact lastly for the same reason be cognizant of best and average case depending on
our application this may be more applicable for our algorithm.
Here's an example of how to use Big O notation to analyze the efficiency of a simple
algorithm:
1. Identify the key operations: The key operation in this algorithm is the comparison
array[i] > max.
2. Determine the number of times the key operation is performed: The comparison is
performed once for each element in the array, so it is performed array. Length
times.
3. Express the running time in terms of the input size: The running time is
proportional to the number of elements in the array, so it can be expressed as O
(array. Length).
4. Use the rules of Big O notation to simplify the expression: The input size is
represented by the variable n, so we can rewrite the expression as O(n).
Therefore, the running time of the findMax algorithm is O(n), which means it grows
linearly with the input size.
lOMoARcPSD|41277594
The Fibonacci integer sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, …….
def print_fibonacci_series(n):
a, b = 0, 1 C1 n
print(a) C2 n
for i in range (1, n): C3 (n+1)
print(b) C4 n
a, b = b, a + b C5 n
print_fibonacci_series (13) C6 n
In computational complexity theory, the "big O" notation is used to describe the
complexity or performance of an algorithm, by expressing the number of steps (or
operations) required to solve a problem as a function of the size of the input.
The big O notation is used to describe the upper bound on the number of steps an
algorithm takes, so it provides a worst-case estimate of the complexity.
The big O notation is usually written in the form O(f(n)), where n is the size of the input
and f(n) is a function that describes the number of steps required to solve the problem.
For example, the complexity of an algorithm that takes a linear number of steps to solve
a problem, proportional to the size of the input, is O(n). This means that the algorithm
has a complexity of O(n) because the number of steps required increases linearly with
the size of the input.
Algorithms with a complexity of O(n) are generally considered to be efficient for small
to medium-sized inputs, but may become slow for very large inputs.
However, it is important to note that the big O notation only provides an upper bound on
the complexity of an algorithm, and does not necessarily reflect the actual performance
of the algorithm. The actual performance of an algorithm may be better or worse than
the complexity indicated by the big O notation, depending on the specific inputs and the
hardware on which the algorithm is run.
lOMoARcPSD|41277594
def factorial(n):
result = 1
C1 n
for i in range(1,n+1):
C2 C3 C4 (n+1)
result *= i return result print(factorial(6))
C5 nnn
In computer science, the time complexity of an algorithm is a way to describe how the
running time of the algorithm increases with the size of the input. The Big O notation is a
commonly used way to express time complexity, and it describes the upper bound on the
running time of an algorithm.
According to the (Figure 10): Based on the Big O complexity chart, an algorithm with a
time complexity of O(n) is considered to be a good one as it has a linear time complexity.
This means that the running time of the algorithm increases linearly with the input size.
O(n) is considered good because it's a linear relationship between the input size and the
running time. It is considered to be a good time complexity for algorithms that have to
process a large amount of data, as the running time will increase at a reasonable rate. This
means that the algorithm will complete in a reasonable amount of time even for large
input sizes.
Activity 2
2.1
Output
made up of a series of defined functions that are called in a specific order to perform a
task.
Overall, the code sample provided follows the procedural programming paradigm in its
focus on breaking down a problem into smaller, more manageable steps and using well-
defined procedures to solve these steps. Also, this code sample follows the principles of
procedural programming by dividing the problem into smaller tasks, organizing the code
into functions, and following a linear flow of execution.
Study ()
Float get Total Marks Methods
()
String get Grade ()
Figure 14 OOP example
Modularity: OOP allows for the creation of self-contained objects that can be
easily reused and maintained. This helps to reduce the complexity of large
programs and makes them easier to develop and maintain.
Code reuse: OOP allows for the reuse of code through inheritance, which means
lOMoARcPSD|41277594
that new objects can be created by inheriting characteristics from existing objects.
This can help to reduce the amount of code that needs to be written and makes it
easier to extend and maintain existing code.
Polymorphism: OOP allows for the creation of objects that can take on multiple
forms, through inheritance and the use of interfaces. This can make code more
flexible and modular, and makes it easier to add new functionality.
Encapsulation: OOP allows for the bundling of data and behavior together in an
object, which helps to keep the implementation details of an object hidden from
other parts of the program. This can make code easier to understand and maintain.
Complexity: OOP can be more complex to learn and understand, particularly for
those who are new to programming. This can make it more difficult for beginners
to get started with OOP.
Performance: OOP languages can sometimes be slower than procedural
languages, due to the overhead of creating and managing objects. This can be a
disadvantage for applications that require high performance.
Overhead: OOP requires more memory and processing power to manage the
objects and their interactions, which can add overhead to the program. This can be
a disadvantage for resource-constrained systems.
Overall, OOP has many benefits and is widely used in the development of a wide range
of software applications. However, it is important to consider the trade-offs and choose
the right programming paradigm for the task at hand.
In this example, the class ‘Dog’ has two properties (‘name’ and ‘breed’) and one method
(‘bark’). To create an object instance of the ‘Dog’ class, we would use the following
syntax:
This would create a new object instance of the Dog class, with the name "Buddy" and
breed "Labrador". We could then call the bark method on this object instance using the
following syntax:
Inheritance: This refers to the ability of one object to inherit characteristics from a
parent object. In OOP, objects can be arranged in a hierarchy, with more
specialized objects inheriting characteristics from more general objects. This
allows for code reuse and helps to reduce the complexity of large programs.
OOP, this can be achieved through inheritance, where a child object can override
or extend the behavior of a parent object. Polymorphism allows for greater
flexibility and modularity in code.
Abstraction: This refers to the idea of only exposing the relevant details of an
object to the user, while hiding the implementation details. Abstraction helps to
reduce complexity and make the code easier to understand and maintain.
Overall, the OOP paradigm emphasizes the use of objects and their interactions to solve
problems, rather than the use of procedures and function calls, as in procedural
programming.
These are just a few examples of OOP languages, and there are many others that are
commonly used in the development of a wide range of software applications.
Output
lOMoARcPSD|41277594
Figure 23
output
for
object−or
iented
program
ming
language
lOMoARcPSD|41277594
increases its salary by 5000. This follows the OOP principle of polymorphism,
which allows objects of different classes to be treated the same way and respond
differently to the same method calls (in this case, the ‘raise_salary’ method).
The unique characteristics of OOP are demonstrated in the code through the use of
inheritance, encapsulation, and polymorphism. Inheritance allows for the creation of a
new class that is a modified version of an existing class, while encapsulation refers to
the bundling of data and methods that operate on that data within a single unit (such as a
class). Polymorphism allows for the use of a single interface to perform different tasks,
depending on the context in which it is used.
Overall, the code sample is a good example of OOP in Python and I demonstrate the
structure and unique characteristics of the paradigm.
4. Event listener: An event listener is a function that listens for a specific event and
executes a trigger function in response to that event. Event listeners are often used
in graphical user interfaces (GUIs) to respond to user actions such as clicking a
button or typing in a text field.
5. Parameter passing: Parameter passing is the process of passing arguments to a
function when it is called. In event-driven programming, trigger functions and
event handlers often take parameters that are passed to them by the event loop or
event listener when they are called. These parameters can be used to customize the
behavior of the function or provide it with the necessary information to perform
its task.
Output 1
Output 2
Output 3
In this code, the event-driven programming paradigm I used to create a simple GUI with
a label, an entry field, and a button.
The main window is created using the ‘Tk’ class, and the label, entry field, and button
are created using the ‘Label’, ‘Entry’, and ‘Button’ classes, respectively. These classes
are all part of the ‘tkinter’ library, which provides a set of tools for building graphical
user interfaces in Python.
The ‘say_hello’ function is defined as a global function and is registered as a handler for
the button's "clicked" event using the ‘command’ argument when the button is created.
This function gets the text from the entry field and updates the label with a greeting
message using the ‘text’ attribute.
The ‘pack’ method is used to add the widgets to the main window, and the ‘mainloop’
method is called to enter the event loop. The event loop will listen for events such as
button clicks and call the appropriate handler functions when they occur.
Some unique characteristics of the event-driven programming paradigm in this code
include:
The use of the ‘command’ argument to register a handler function for the button's
"clicked" event.
The use of the ‘mainloop’ method to enter the event loop and listen for events.
The separation of the event handling logic (the ‘say_hello’ function) from the
main program flow.
Overall, this code follows a common structure for event-driven programming, with the
main window and widgets being created and configured, and handler functions being
registered for relevant events. The event loop then listens for events and calls the
appropriate handler functions when they occur.
lOMoARcPSD|41277594
Activity 3
Algorithm:
FUNCTION RENTCAL
INPUT: vehicle_no, rented_date, return_date, with_driver
int NoOfTotalDays, Months, RemainingDays, weeks, Days, TotalAmount
START:
IF vehicle id found
NoOfTotalDays = returnDate - rentedDate
Months = NoOfTotalDays/30
RemainingDays = NoOfTotalDays%30
weeks = RemainingDays/7
Days = RemainingDays%7
IF (withDriver == true)
TotalAmount = month*monthlyRate + weeks * weeklyRate + Days *
DailyRate + driverrate * NoOfTotalDays
ELSE
TotalAmount = month*monthlyRate + weeks * weeklyRate + Days *
DailyRate
lOMoARcPSD|41277594
END IF
DISPLAY TotalAmount
ELSE
DISPLAY vehicle id Not Found
END IF
END FUNCTION RENTCAL
Algorithm:
FUNCTION DAY TOUR-HIRE CAL
INPUT: vehicle_no, package_type, start_time, end_time, start_km_reading,
end_km_reading
Int totalNoOfHours, waitingHours, waitingFee, totalNoOfKM, extraKM, extraKMFee,
TotalAmount
START:
END IF
Algorithm:
FUNCTION LONG_TOUR-HIRECAL
INPUT: vehicle_no, package_type, start_date, end_date, start_km_reading,
end_km_reading
int NoOfTotalDays, noOfKM, maximumNoKM, extraKM, extraKMcharge, baseHire,
noOfnights, overNightStay, TotalAmount
START:
noOfnights = NoOfTotalDays – 1
overNightStay = (parkingRate + driverRate) * noOfnights
DISPLAY TotalAmount
END FUNCTION LONG_TOUR-HIRECAL
lOMoARcPSD|41277594
MS SQL server management studio is a software to create databases with SQL quarries.
Ayubo database it’s created with the MS SQL server management studio.
Interface of MS SQL
Vehicle Table
Package Table
Hire Table
Rent Table
What is an IDE
1. Code Editing: IDEs provide a code editor that is specifically designed for the
programming language we are using. This can include features such as syntax
highlighting, code completion, and refactoring tools, which can make writing and
editing code more efficient.
2. Integrated Debugging: IDEs usually include a built-in debugger, which allows
developers to step through their code line by line, set breakpoints, and inspect
variables. This can make it much easier to find and fix errors in your code.
3. Project Management: IDEs often provide a way to manage all of the files and
resources that make up a project. This can include features such as version control
integration, and the ability to organize and navigate through large codebases.
4. Code Generation: IDEs often include wizards and code generators that can help
we create new classes, methods, or other code elements quickly and easily.
5. Code Profiling: IDEs include tools that can help us optimize our code by
identifying performance bottlenecks.
lOMoARcPSD|41277594
6. Integrated Support: IDEs provide integrated support for a variety of tools, such as
compilers, interpreters, and build tools, which can make the development process
more efficient.
7. Collaboration: Some IDEs include built-in support for team development, which
allows developers to work together on the same codebase, share their work, and
communicate with one another.
8. Community and Support: IDEs usually have a large community and developer
support, which can be helpful when you're trying to learn a new language or solve
a specific problem.
Overall, IDEs are designed to make the process of writing and testing code more efficient,
by providing a unified interface for all of the necessary tools, and automating common
tasks.
feature of an IDE
An Integrated Development Environment (IDE) typically includes a wide range of
features to support software development. Some of the key features that are commonly
found in an IDE include:
Code Editor: An IDE's code editor is the primary tool for writing, editing, and
managing code. It generally includes features such as syntax highlighting, code
completion, and refactoring tools, making it easier to write and edit code.
Debugging: IDEs usually include a built-in debugger, which allows developers to
step through their code line by line, set breakpoints, and inspect variables. This
can make it much easier to find and fix errors in the code.
Project Management: IDEs often provide a way to manage all of the files and
resources that make up a project. This can include features such as version
control integration, and the ability to organize and navigate through large
codebases.
Code Generation: IDEs usually include wizards and code generators that can help
to create new classes, methods, or other code elements quickly and easily.
Code Profiling: IDEs include tools that can help us to optimize our code by
lOMoARcPSD|41277594
Each IDE may vary in terms of the set of features it provides, but the above list gives a
general idea of the typical features found in an IDE.
Code Cleanup: This feature allows developers to automatically reformat and organize
their code according to a set of predefined coding standards. This can help to improve
the readability and maintainability of the code.
Squiggles and Quick Actions: Squiggles are visual cues that indicate potential issues
with the code, such as syntax errors or semantic issues. Quick Actions are suggestions
that can be used to automatically fix or improve the code
These visual hints allow us to fix problems quickly without waiting for an error to be
found during the build or when we run the software. If we are clicking over a squiggle,
we can see additional details about the mistake. A light bulb can also show in the left
margin with actions known as Quick Actions to correct the mistake.
Squiggles and Quick Actions: Squiggles are visual cues that indicate potential issues
with the code, such as syntax errors or semantic issues. Quick Actions are suggestions
that can be used to automatically fix or improve the code.
Refactoring: This feature allows me to easily make changes to the structure of their
code without affecting its functionality. This can include things like renaming variables,
extracting methods, and reorganizing code.
Tool Box: This feature provides a list of pre-built controls and components that can be
added to the user interface. This can save time and effort by eliminating the need to
build these elements from scratch.
We can view or hide an item by selecting or clearing the check box, Sort Items
Alphabetically-Sets items by name. We can scan the Toolbox more to filter the things that
show. We can rearrange objects in the Toolbox tab or add custom tabs and objects using
the below commands in the context menu:
lOMoARcPSD|41277594
Rename Item-Renames the object you selected, List View-Displays the controls in the
vertical list. If not checked, the controls will appear horizontally, Show All-Shows all
relevant controls, Choose Items-Opens the Choose Toolbox Items dialog box so that we
can select the items that will display in the Toolbox. We can view or hide an item by
selecting or clearing the check box, Sort Items Alphabetically-Sets items by name.
Properties Window: This feature allows me to view and edit the properties of the
selected element in the code. This can be used to change the appearance or behavior of
the element.
We can also use the Properties window to edit and display the properties of the file,
project and solution.
lOMoARcPSD|41277594
Error List Window: This feature displays a list of errors and warnings that have been
detected in the code. This can make it easier to find and fix issues.
Server Explorer Window: This feature allows me to view and manage database
connections, servers and services. some other databases that have an ADO.NET provider
built, and some Azure services. It also displays low-level objects such as event logs,
device output counters, and message queues. If the data source does not have an
ADO.NET provider, it will not show here, but we can still access it from Visual Studio by
programmatically connecting.
Solution Explorer Window: This feature provides a tree-view of the solution, projects
and files. This allows me to navigate through the solution and access the required files
quickly.
Diagnostic Window: This feature provides tools for debugging and troubleshooting the
code. This can include call stacks, memory usage, and performance metrics. Tools that
show in the Diagnostics Tools window can only run during a debugging session.
Comparing the Advantages and Disadvantages of Using an IDE vs. Not Using an
IDE for Application Development
IDEs provide a user-friendly interface, built-in debugging and testing tools, code
completion and syntax highlighting, and integrated version control support. However,
they may be resource-intensive and limited to the features provided by the IDE. On the
other hand, not using an IDE gives greater flexibility in choice of tools and workflow,
more control over project setup and configuration, potentially faster development speed,
and more lightweight and minimalistic approach. However, the lack of built-in debugging
and testing tools, less user-friendly interface, lack of integrated version control support,
and limited support for multiple languages can be disadvantages.
lOMoARcPSD|41277594
Activity 4
4.1
Login Page
Home Page
Vehicle Registration
Package Registration
Rent Vehicle
Activity 4
4.2
Introduction to Debugging
Debugging is the process of identifying and resolving errors or bugs in computer
programs. This can include finding and correcting coding errors, as well as identifying
and addressing issues with system configuration or external dependencies. Debugging
tools and techniques are used to help developers locate and fix problems in their code, so
that their programs can function correctly.
lOMoARcPSD|41277594
Debugging Process
1. Identifying the problem: The first step in debugging is to determine what the
problem is. This can involve reviewing error messages, logs, and other diagnostic
information to understand what is causing the program to fail.
2. Reproducing the problem: Once the problem has been identified, the next step is
to reproduce it. This can involve setting up specific test cases or scenarios that
trigger the error, in order to make it easier to diagnose and fix.
3. Locating the source of the problem: After reproducing the problem, the next step
is to locate the source of the problem. This can involve reviewing the code and
using debugging tools, such as breakpoints and inspection tools, to understand the
program's state and how it is executing.
4. Fixing the problem: Once the source of the problem has been located, the next
step is to fix it. This can involve making changes to the code, updating system
configuration, or addressing any other issues that may be causing the problem.
5. Testing the fix: Finally, once the problem has been fixed, the final step is to test
the fix. This can involve running the program with the same test cases used to
reproduce the problem, to ensure that it is now working correctly.
Breakpoints: Breakpoints are a feature in Visual Studio that allow us to pause the
execution of our code at specific points, so that we can examine the state of your
program and see what is happening. we can set breakpoints on specific lines of
code, and then run your program in debug mode. When the program reaches a
breakpoint, it will stop running and allow us to step through the code, line by line.
lOMoARcPSD|41277594
Watch Window: Allows us to view the value of variables and expressions as the
code runs, so that we can see how they change over time.
Immediate Window: The Immediate Window is a feature of Visual Studio that
allows us to enter expressions and see their results immediately, without having to
stop the code execution. It's a great way to check the value of a variable or to
perform simple calculations while debugging. we can also use it to call functions
and methods, change the value of variables, and more.
Call Stack: The call stack is a feature in Visual Studio that allows us to view the
sequence of function calls that led to the current point in the execution of our
code. This can help us understand how the program got to where it is and identify
the source of an error. The call stack is displayed in the Call Stack window, and
we can navigate through it to see the different function calls and their parameters.
Call Hierarchy: Allows us to navigate the call structure of our code and see the
relationship between different functions.
Debugging with Debugger: Allows us to step through our code, line by line, so
that we can see how it is executing and identify any errors.
Threads Window: Allows us to view and manage the threads running in our
program, so that we can understand how they interact and identify any issues
related to concurrency.
Code Analyzer: Allows us to detect and diagnose code issues, such as
performance bottlenecks, security vulnerabilities, and coding standards violations.
Exception Helper: Allows us to catch and diagnose unhandled exceptions and
allows us to set up custom exception settings.
lOMoARcPSD|41277594
Some of the visual Studio IDE features that help me to debugging process to
lOMoARcPSD|41277594
Breakpoint
I can add breakpoints on these lines to check value of In the TotalAmount = baseHire +
overNightStay + extraKM; statement to check if the total amount is being printed
correctly. Breakpoints are used to pause the execution of the program at a specific line of
code. This allows me to inspect the variables, objects and the overall state of the system at
that particular point in time. Breakpoints are particularly useful when debugging complex
systems or when trying to find the cause of an error. In the Ayubo system, breakpoints
were used to inspect the variables and the flow of the code to ensure the accuracy of the
results and identify potential issues.
Error list
lOMoARcPSD|41277594
Error lists are very important because they help to identify and fix errors in the code.
These errors can occur due to a variety of reasons such as syntax errors, semantic errors,
type mismatches, and logical errors. Without error lists, it would be difficult to locate and
fix these errors, which can lead to unexpected behavior in the program. The Error list can
be used to catch any syntax, semantic, type, or logical errors in the code. By checking the
Error list regularly, I can identify the errors early in the development process and fix them
promptly. This helps me to write more secure and robust applications, as I can ensure that
the code is free of errors before deploying it to production. Moreover, the Error list also
gives a clear description of each error, which makes it easier for me to understand the root
cause of the error and resolve it quickly.
Immediate Window
lOMoARcPSD|41277594
In the immediate window, I type the command "fib" and press enter to see the array
containing the Fibonacci numbers.
Also I try different commands like "fib[0]" or "fib[2]" to see the value of specific
elements in the array. The Immediate Window in Visual Studio is a tool that allows
developers to execute code snippets and inspect the values of variables during the
debugging process. By using the Immediate Window, I can quickly test and debug small
parts of the code without having to stop the application and run the entire program again.
This makes the debugging process more efficient and saves time. The ability to see the
value of specific elements in the array, such as "fib[0]" or "fib[2]", helps to ensure that
the program is functioning correctly and that the data structures used in the program are
being populated correctly.
lOMoARcPSD|41277594
Quick watch
there is a for loop with a variable "i" that starts at 2, increments by 1 in each iteration, and
continues as long as "i" is less than "n" (13 in this case). I use QuickWatch on the variable
"i" in this for loop, I will be able to see the current value of "i" at each iteration of the
loop, so values 2. This allows me to keep track of the value of a variable in real-time,
which is useful for debugging purposes, as it enables me to see exactly when and why a
value is changing. Quick Watch can be used to monitor the value of variables in our code,
especially in loops where i want to keep track of their values at different stages of the
iteration. In the scenario described above, I would be able to see how the value of "i"
changes in each iteration of the loop, which can help me to identify any unexpected
behavior in the code.
lOMoARcPSD|41277594
Try Catch
I've added a try-catch block around the main logic of the Calculation method. If the
vehicleNo is null, an exception is thrown with the message "Vehicle ID not found.". Any
exception that is thrown within the try block will be caught by the catch block and the
error message is printed. The try-catch block helps me in handling exceptions and
provides a way to catch and handle any unexpected errors that may occur during the
execution of the program. By using a try-catch block, the program can continue to run
even if an error occurs, and the error message can be displayed, making the application
more robust and user-friendly. The try-catch block also helps me to identify the source of
the error, which can be helpful in fixing the problem and ensuring that the same error
does not occur in the future.
lOMoARcPSD|41277594
As a developer, I found that the debugging features in Visual Studio were essential in
creating my Ayubo drive application without errors. I utilized the Error List feature to
find and fix code errors during my programming process. Additionally, I utilized the
breakpoint method, which allowed me to pinpoint the exact location of an error while the
program was running. This proved to be especially helpful in troubleshooting my
application. I also found the try catch method to be useful in catching and handling any
exceptions that occurred during the execution of my program.
During the development of my application, I faced some errors such as code errors,
database connection errors, and errors related to invalid variable names. These debugging
features helped me to find and solve these errors easily. I did not use some other
debugging methods such as quick watch, add watch, and immediate windows as they
were not necessary for my application. However, these features can be useful for larger
development projects.
Activity 4
4.3
Coding Standard
A coding standard is a set of guidelines and rules for writing and formatting code. These
guidelines can cover various aspects of coding, such as naming conventions for variables
and functions, indentation, commenting, and overall code organization. The purpose of a
coding standard is to make code more readable, maintainable, and consistent across a
team or organization. Adhering to a coding standard can also help ensure that code meets
certain quality or security standards. In brief, coding standards set the rule for how the
code should be written and organized, making it easier to read, understand and maintain.
lOMoARcPSD|41277594
Using Comment
The comments in the C# code are used to provide explanations and context for the code.
They are used to help me to understand the code more easily and to make it easier to
maintain and update in the future.
This specific comment is explaining the function of the code block that follows it. It
states that the code is calculating the total number of hours between the start and end
time, and then checking if that total number exceeds a maximum allowed value. If it
does, the code then calculates the number of waiting hours and the fee associated with
those waiting hours. If the total number of hours does not exceed the maximum allowed
value, the code sets the waiting fee to 0.
Using comments in this way is an example of a coding standard, as it helps me to ensure
that the code is readable, understandable, and maintainable. It's important to understand
the coding standard because it makes the code more efficient, easy to understand and
make changes in the future. It also helps me to ensure that the code follows industry best
practices and that it is consistent with the coding conventions used by other developers
on the project.
In the above C# code, proper data types have been used for the variables. For example,
noOfTotalDays is an integer variable that is used to store the number of days, ‘start_date’
and ‘end_date’ are of the type ‘DateTime’ that are used to store the start and end dates of
the tour, ‘start_km_reading’ and ‘end_km_reading’ are also integers that are used to store
the start and end readings of the vehicle's kilometers. This is an example of using proper
data types as per the coding standard. Using proper data types is important as it ensures
that the variables are used correctly and are compatible with the operations that are
performed on them. This also makes the code more readable and maintainable.
lOMoARcPSD|41277594
Proper indentation is a coding standard that refers to the use of consistent and logical
indentation levels when writing code. This makes the code more readable, organized, and
easy to understand. In the given code, the indentation levels are used to indicate the scope
of the code blocks. For example, the code within the try-catch block is indented at a
higher level than the code outside of it. This helps to clearly indicate which code is
executed within the try-catch block and which code is executed outside of it.
Additionally, the indentation of the code within the if-else block makes it clear that the
code within the if block is executed only if the condition is true, and the code within the
else block is executed only if the condition is false. Overall, proper indentation makes it
easy to understand the flow of the code and helps to prevent errors caused by confusion
about the structure of the code
lOMoARcPSD|41277594
Using one statement per line is a coding standard that helps me to improve the
readability and maintainability of the code. It makes it easier to understand the logic of
the code and identify specific statements that may be causing issues. Additionally, it
also makes it easier to add or remove statements as needed, without affecting the overall
structure of the code. However, it is important to keep in mind that there may be
situations where more than one statement per line might be more appropriate, depending
on the complexity and specific requirements of the code.
lOMoARcPSD|41277594
Team
A coding standard is necessary for a team for several reasons. First, it helps to ensure that
code is written consistently and in a way that is easy to read and understand. This is
important for maintaining code quality and making it easier for team members to work on
the codebase. Second, a coding standard helps to prevent errors and bugs by ensuring that
code follows best practices and is written in a way that is less prone to errors. This helps
to reduce the time and effort required to debug and fix code. Third, a coding standard can
help to improve collaboration and communication within a team by setting clear
guidelines for how code should be written. This can help to reduce misunderstandings and
conflicts between team members, and can make it easier for new team members to
understand and work with the codebase. Finally, a coding standard can help to ensure that
code is maintainable and can be easily updated and modified as needed. This is important
for the long-term sustainability of the codebase and can help to ensure that the code can
be adapted to meet changing requirements over time.
Individual
A coding standard is necessary for individuals for several reasons. First, it helps to ensure
that code is written in a way that is easy to read, understand, and maintain. This is
important for the individual developer, as it can help to reduce the time and effort
required to understand and work with their own code, as well as the code of others.
Second, a coding standard can help to improve the quality of code by ensuring that it
follows best practices and is written in a way that is less prone to errors. This can help to
improve the developer's skills and can lead to fewer bugs and errors in their code. Third,
a coding standard can help to ensure that code is more consistent and easier to work with,
which can make it more likely that others will be able to understand and use the code.
This is important for individuals who may want to share their code with others, such as
open-source developers or those working on a team. Finally, a coding standard can help
to ensure that code is more maintainable and can be easily updated and modified as
needed. This is important for the long-term sustainability of the code and can help to
ensure that the developer's code can be adapted to meet changing requirements over time.
lOMoARcPSD|41277594
Conclusion
Gantt Chart
Weeks 1st 2nd 3rd 4th 1st 2nd 3rd 4th 1st 2nd 3rd 4th 1st 2nd 3rd 4th
Go through
The
assignment
Task 01
Task 02
Task 03
Task 04
lOMoARcPSD|41277594
Self-criticism:
References
Huang, S. (2020). What is Big O Notation Explained: Space and Time Complexity.
[online] freeCodeCamp.org. Available at: https://www.freecodecamp.org/news/big-o-
notation-why-it-matters-and-why-it-doesnt-1674cfa8a23c/.
Amazon Web Services, Inc. (n.d.). What is Debugging? Debugging Explained - AWS.
[online] Available at: https://aws.amazon.com/what-
is/debugging/#:~:text=Debugging%20is%20the%20process%20of.
Grading Rubric