Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
14 views

Programming 1

programming

Uploaded by

shenifdo099
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Programming 1

programming

Uploaded by

shenifdo099
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 112

lOMoARcPSD|41277594

lOMoARcPSD|41277594

Higher Nationals
Internal verification of assessment decisions – BTEC (RQF)
INTERNAL VERIFICATION – ASSESSMENT DECISIONS
Programme title Higher National Diploma in Computing

Assessor Internal Verifier


Unit 01: Programming
Unit(s)
Design & Implement a GUI based system using a suitable Integrated Development
Assignment title
Environment
Student’s name
List which assessment criteria Pass Merit Distinction
the Assessor has awarded.

INTERNAL VERIFIER CHECKLIST

Do the assessment criteria awarded match


those shown in the assignment brief? Y/N

Is the Pass/Merit/Distinction grade awarded


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

Assessor signature Date

Internal Verifier signature Date


Programme Leader signature (if required)
Date
lOMoARcPSD|41277594

Confirm action completed


Remedial action taken

Give details:

Assessor signature Date

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

Higher Nationals − Summative Assignment Feedback Form


lOMoARcPSD|41277594

Student Name/ID Mansoor Mohamad Azman / KAN00147072


Unit Title Unit_01: Programming
Assignment Number 1 Assessor Irani Vishvani
31/01/2023 Date Received 1st
Submission Date
submission
Date Received 2nd
Re-submission Date
submission
Assessor Feedback:

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

Pass, Merit & Distinction Descripts P1 M1 D1

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

Pass, Merit & Distinction Descripts P2 M2 D2

LO3. Implement basic algorithms in code using an IDE.

Pass, Merit & Distinction Descripts P3 M3 D3

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

Grade: Assessor Signature: Date:


Resubmission Feedback:

Grade: Assessor Signature: Date:


Internal Verifier’s Comments:

Signature & Date:


lOMoARcPSD|41277594

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

Feedback: Student to Assessor


Dear Irani Mam,

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

Pearson Higher Nationals in


Computing
Unit 01: Programming
Assignment 01
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.

Word Processing Rules

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.

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


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

Student’s Signature: E174653@esoft.academy Date: 31/01/2023


(Provide E-mail ID) (Provide Submission Date)
lOMoARcPSD|41277594

Higher National Diploma in Computing


programming, conduct an analysis of a suitable Integrated Development
Assignment Brief
Environment (IDE).
Student Name /ID Number Mohamad Azman / KAN00147072
LO3. Implement basic algorithms in code using an IDE.
Unit Number and Title Unit 01: Programming

Academic Year LO4. Determine the2021/22


debugging process and explain the importance of a coding
standard
Unit Tutor Irani Vishvani

Assignment Title Design &Implement a GUI based system using a suitable


Integrated Development Environment

Issue Date 18/09/2022

Submission Date 31/01/2023

IV Name & Date

Submission Format

This submission will have 3 components

1. Written Report

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

2. Implemented System (Software)


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

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

Unit Learning Outcomes:

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


lOMoARcPSD|41277594
lOMoARcPSD|41277594

Assignment Brief and Guidance:

Activity 1

A. The Fibonacci numbers are the numbers in the following integer sequence.
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ……..
In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence
relation.
Fn = F n-1 + F n-2

B. Factorial of a non-negative integer, is multiplication of all integers smaller than or equal


to n. For example, factorial of 6 is 6*5*4*3*2*1 which is 720.
n! = n * (n - 1) *............1

Define what an algorithm is and outline the characteristics of a good algorithm. Write the
algorithms to display the Fibonacci series and the factorial value for a given number using
Pseudo code. Determine the steps involved in the process of writing and executing a
program.

Take a sample number and dry run the above two algorithms. Show the outputs at the end
of each iteration and the final output. Examine what Big−O notation is and explain its role
in evaluating efficiencies of algorithms. Write the Python program code for the above two
algorithms and critically evaluate their efficiencies using Big−O notation.

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

Vehicle rent and hire options are described below.

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

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

2. Hire (with driver only) – These are based on packages such as airport drop, airport pickup,
100km per day package, 200km per day package etc. Standard rates are defined for a
package type of a vehicle 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

Function 1: Rent calculation.


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

Function 2: Day tour - hire calculation.


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

Function 3: Long tour - hire calculation.


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

Write suable algorithms for vehicle tariff calculation for rents and hires. Ideally 3
functions should be developed for this purpose as above. Use the visual studio IDE
(using C#.net) to Implement the above algorithms and design the suitable database
structure for keeping the tariffs for vehicle types and different packages which must be
lOMoARcPSD|41277594

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

Thank you all for your support and guidance.


Sincerely,
Mohamad Azman
lOMoARcPSD|41277594

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

Evaluation between code sample and object-oriented programming paradigm............49


Event-driven programming paradigm............................................................................50
Characteristics of event driven programming paradigm............................................51
Event Driven Programming – Features......................................................................51
Some examples of Event-driven programming (OOP) languages include................52
A code snippet and output for Event-driven programming language........................53
Evaluation between code sample and Event-driven programming paradigm............54
Relationship between procedural, object oriented and event-driven (compare and
contrast)..........................................................................................................................55
comparison between these 3 paradigms using source codes..........................................56
Procedural Programming Paradigm...........................................................................56
Object-Oriented Programming Paradigm.......................................................................57
Event-Driven Programming Paradigm...........................................................................57
Activity 3............................................................................................................................59
The three algorithms used by Ayubo Drive (Pvt) Ltd....................................................59
Function 1: Rent calculation.......................................................................................59
Function 2: Day tour - hire calculation......................................................................60
Function 3: Long tour - hire calculation.....................................................................61
Developing Functions using Visual Studio IDE............................................................62
Function 1: Rent calculation.......................................................................................62
Function 2: Day tour - hire calculation......................................................................63
Function 3: Long tour - hire calculation.....................................................................64
Development of Suitable Database Structure for Ayubo Drive.....................................65
MS SQL server management studio...............................................................................65
Interface of MS SQL..................................................................................................65
Database of ayubo Drive............................................................................................65
Vehicle Table.............................................................................................................66
Package Table.............................................................................................................66
Hire Table...................................................................................................................67
Rent Table..................................................................................................................67
What is an IDE...............................................................................................................68
There are many benefits to using an IDE, including:.................................................68
Visual Studio IDE..........................................................................................................69
Interface of Visual Studio IDE...................................................................................70
feature of an IDE............................................................................................................70
Some of the Features that help me to develop the Application:.....................................71
Comparing the Advantages and Disadvantages of Using an IDE vs. Not Using an IDE
for Application Development.........................................................................................78
Activity 4............................................................................................................................79
4.1....................................................................................................................................... 79
Ayubo Drive Vehicle Hire System Development and Implementation Interface Input
and Output......................................................................................................................79
Login Page..................................................................................................................79
Home Page.................................................................................................................81
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

Figure 1 Characteristics of good algorithms.......................................................................20


Figure 2 process of building an application........................................................................21
Figure 3 Fibonacci numbers Dry run Table........................................................................23
Figure 4 python code and output for Fibonacci numbers.................................................23
Figure 5 Factorial numbers Algorithm Output...................................................................24
Figure 6 Factorial python code and ouput.........................................................................25
Figure 7 Big o complexity chart..........................................................................................29
Figure 8 python code for big o notation to analyze efficiency algorithm..........................32
Figure 9 python code for fibonacci numbers.....................................................................34
Figure 10 Big O complexity Chart.......................................................................................35
Figure 11 Factorial python code for BIg O.........................................................................37
Figure 12 code snippet for procedural programming language........................................41
Figure 13 code snippet output for procedural programming language............................41
Figure 14 OOP example......................................................................................................43
Figure 15 example of class definition.................................................................................45
Figure 16 example of Dog class..........................................................................................45
Figure 17 OOP example calling the bark method..............................................................45
Figure 18 example for Encapsulation.................................................................................46
Figure 19 example for inheritance.....................................................................................46
Figure 20 example for Polymorphism................................................................................47
Figure 21 example for Abstraction.....................................................................................47
Figure 22 code snippet for object−oriented programming language................................48
Figure 23 output for object−oriented programming language..........................................49
Figure 24 code snippet for Event−driven programming language....................................53
Figure 25 output 1 for Event−driven..................................................................................53
Figure 26 output 2 for Event−driven..................................................................................53
Figure 27 output 3 for Event−driven..................................................................................54
Figure 28 Relationship between procedural, object oriented and event−driven..............55
Figure 29 example Procedural Programming.....................................................................56
Figure 30 example Object−Oriented Programming...........................................................57
Figure 31 example Event−Driven Programming................................................................58
Figure 32 Rent calculation C# code....................................................................................62
Figure 33 Day tour − hire calculation C# code...................................................................63
Figure 34 Long tour − hire calculation C# code..................................................................64
Figure 35 interface of MS SQL............................................................................................65
Figure 36 Database of ayubo drive....................................................................................65
lOMoARcPSD|41277594

Figure 37 vehicle table screenshot.....................................................................................66


Figure 38 Package table screenshot...................................................................................66
Figure 39 Hire table screenshot.........................................................................................67
Figure 40 rent table screenshot.........................................................................................67
Figure 41 example of IDE environment..............................................................................68
Figure 42 Full visual studio open view...............................................................................70
Figure 43 screenshot of Code cleanup...............................................................................71
Figure 44 screenshot Squiggles and quick actions.............................................................72
Figure 45 screenshot of refactoring...................................................................................72
Figure 46 screenshot of IntelliSense..................................................................................73
Figure 47 screenshot of Toolbox........................................................................................73
Figure 48 screenshot of Properties....................................................................................74
Figure 49 screenshots of Error List Window......................................................................75
Figure 50 screenshot of Server Explorer............................................................................75
Figure 51 screenshot of Solution explorer.........................................................................76
Figure 52 screenshot of Diagnostic window......................................................................77
Figure 53 Advantage & disadvantages of using and not using IDE....................................78
Figure 54 Login Page..........................................................................................................79
Figure 55 Login Deatils incorrect........................................................................................80
Figure 56 Login Successful..................................................................................................80
Figure 57 Home Page.........................................................................................................81
Figure 58 vehicle Register Page..........................................................................................81
Figure 59 Package Registration Page.................................................................................82
Figure 60 Rent Page............................................................................................................82
Figure 61 Hire Page............................................................................................................83
Figure 62 inserted Vehicle Details Successfully.................................................................83
Figure 63 Successfully Updated Packages..........................................................................84
Figure 64 Deleted Successfully...........................................................................................84
Figure 65 Calculated vehicle rent Successful.....................................................................85
Figure 66 Calculated Day tour hire.....................................................................................85
Figure 67 Calculated long Tour Hire...................................................................................86
Figure 68 Screenshot of Breakpoint...................................................................................90
Figure 69 Screenshot of Error list.......................................................................................91
Figure 70 screenshot of immediate window......................................................................92
Figure 71 screenshot of Quick watch.................................................................................93
Figure 72 screenshot of try catch.......................................................................................94
Figure 73 screenshot of comments inside the program....................................................96
Figure 74 screenshot of meaningful variable name...........................................................97
Figure 75 screenshot of using proper data type................................................................98
Figure 76 screenshot of using indentation.........................................................................99
Figure 77 screenshot of C# coding One Statement per line............................................100
Figure 78 General naming Guidelines in C# code...........................................................101
lOMoARcPSD|41277594

Activity 1

Definition of algorithms

A method or set of rules that must be followed when performing problem-solving


operation. As result, in computer science, an algorithm is a set of instructions for solving
some problem, step-by-step to achieve the desired results to accomplish a task. We first
provide some input and then follow a sequence of steps to acquire the required outcome
of the input so that is the fundamental definition of an algorithm.

Characteristics of a Good Algorithm

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.

Figure 1 Characteristics of good algorithms


Clear and Unambiguous – so this statement is the one which states that the algorithm
should be straightforward simple and easily readable. Each one of its steps should be
distinct in every way and lead it to a single conclusion.
Well-Defined Inputs – so this mean an algorithm should indicate what output can be
expected as well as the input should be properly well-defined.
lOMoARcPSD|41277594
lOMoARcPSD|41277594

Well-defined Outputs – so the well-defined output characteristics of an algorithm


means that the algorithm must Cleary indicate what output can be expected as well as
the output should also be well defined by the third characteristic.
Finiteness – the algorithm must be finite and it must not result in infinite loops or
similar situations.
Feasible – feasibility of an algorithm states that the algorithm must be realy simple
generic and practical it must be able to be executed with resources available.
Language Independent – it means that the algorithm should be defined in such a way
that it is completely independent of the language it must be simple instructions that can
be implemented using any programming language so this the six major characteristics of
algorithm.

process of building an application

programming process can be broken down into five steps.


Defining the problem

Planning the solution

Coding the program

Testing the program

Documenting the program

Figure 2 process of building an application

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

The Fibonacci numbers, commonly denoted F n form a sequence, the Fibonacci


sequence, in which each number is the sum of the two preceding ones. The sequence
commonly starts from 0 and 1.
F n = F n-1 + F n-2
Source: wikipedia.org

Fibonacci Numbers – Algorithm/pseudocode

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

Fibonacci Numbers – Algorithm Output Dry run

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

Figure 3 Fibonacci numbers Dry run Table

Fibonacci Numbers – Python code and outputs

Figure 4 python code and output for Fibonacci numbers

Factorial Numbers
lOMoARcPSD|41277594

Factorial of a non-negative integer, is multiplication of all integers less than or equal


to n.
n! = n * (n - 1) *.............1

Factorial Numbers - Algorithm/pseudocode

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

Factorial Numbers - Algorithm Output Dry run

n i Factorial
6 1 1
2 2
3 6
4 24
5 120
6 720
Figure 5 Factorial numbers Algorithm Output

Factorial Numbers – python code and output


lOMoARcPSD|41277594

Figure 6 Factorial python code and ouput

Algorithm and code variant – Factorial

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.

Algorithm and code variant – Fibonacci

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.

Generally algorithmic descriptions are written in some type of Pseudocode.


It uses the structural conventions of a normal programming language, but is intended for
human reading rather than machine reading. Pseudocode typically omits details that are
essential for machine understanding of the algorithm, such as variable declarations,
system-specific code and some subroutines. The programming language is augmented
with natural language description details, were convenient, or with compact
mathematical notation. The purpose of using pseudocode is that it is easier for people to
understand than conventional programming language code, and that it is an efficient and
environment-independent description of the key principles of an algorithm. No standard
for pseudocode syntax exists, as a program in pseudocode is not an executable program.
So, the main difference is that the code is a real executable program written with the
need to be executable on a real machine rather than just a mechanism for
communicating with a human.

What is a Big O notation?


lOMoARcPSD|41277594

Big O notation is simplified analysis of an algorithm’s efficiency.


 Big O gives us an algorithms complexity in terms of the input size N. it gives us a
way to abstract the efficiency of our algorithms or code from the machines they
run on we don’t care about the stats of the machines rather (machine-
independent). We examine the basic computer steps of the code we can use Big O
to analyze the both time and space.

There are couple ways to look at an algorithms efficiency we can examine


 Worst-case
 Best-case
 Average-case

When we’re talking Big O notation, we typically look at worst case this isn’t to say the
others are unimportant.

General rules

1. Ignore constants – Big O notation ignores constants for example if we have a


function that is a running time of 5n we say that it runs on the order of Big O of n
this is because as n gets large the 5 no longer matters in the same way as n grows.

2. certain terms that dominate others here’s a list

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

Figure 7 Big o complexity chart

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

O (1) “big oh of one”

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

Total time = O (1) + O (1) + O (1) = O (1)


lOMoARcPSD|41277594

Linear time

We have the Following for loop that prints the number 0 to n.


For x in range (O, n):
Print x; // O (1)

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.

Y = 5 + (15 * 20); O(1)


For X in range (O, n):
Print x: O(N)
Total time = O(1) + O (N) = O(N)

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

X = 5 + (15 * 20); O(1)


For x in range (O, n):
Print x; O (N)
For x in range (O, n):
For y in range (O, n):
O(N2)
Print x * y;
lOMoARcPSD|41277594

The nested for loop dominates. So, we get Big O of N squared.

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.

Big O notation to analyze the efficiency on an algorithm


Big O notation is a way to express the worst-case time complexity of an algorithm,
which gives us an idea of how the algorithm's running time increases as the input size
grows. It allows us to compare the efficiency of different algorithms and to choose the
most suitable one for a particular task.
To use Big O notation to analyze the efficiency of an algorithm, we need to do the
following:
1. Identify the key operations in the algorithm: These are the operations that
contribute the most to the running time of the algorithm.
2. Determine the number of times each key operation is performed: This is typically
done by examining the loop structures in the algorithm and counting the number
of iterations.
3. Express the running time in terms of the input size: The input size is typically
represented by the variable n, which represents the number of elements in the
input.
4. Use the rules of Big O notation to simplify the running time expression: The goal
is to express the running time using the "simplest" function that accurately
describes the growth rate of the running time.
lOMoARcPSD|41277594

Here's an example of how to use Big O notation to analyze the efficiency of a simple
algorithm:

Big O notation is a way to measure the efficiency or complexity of an algorithm. It


describes the upper bound on the running time of an algorithm, and specifically, it
describes how the running time of an algorithm increases as the input size increases.
When using Big O notation, we typically want to find the function that describes the
worst-case scenario for the running time of an algorithm. This function is called the
"asymptotic upper bound" of the running time.
For example, if an algorithm takes 1 second to run with an input size of 10, and 2
seconds to run with an input size of 100, we can say that the running time of the
algorithm is "O(n)" where n is the size of the input. This means that the running time
increases linearly with the input size.
Another example, if an algorithm takes 1 second to run with an input size of 10, and 30
seconds to run with an input size of 100, we can say that the running time of the
algorithm is "O(n^2)" where n is the size of the input. This means that the running time
increases quadratically with the input size.

Therefore, Big O notation allows us to compare the relative efficiencies of different


algorithms, and to make informed decisions about which algorithm to use for a given
problem.

Figure 8 python code for big o notation to analyze efficiency algorithm


lOMoARcPSD|41277594

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

Python code for Fibonacci numbers

The Fibonacci integer sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, …….

Figure 9 python code for fibonacci numbers


lOMoARcPSD|41277594

Code Cost running time

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

Total Cost= C1 * n + C2 * n + C3 * (n+1) + C4 * n + C5 * n + C6 * n


C1n + C2n + C4n + C5n + C6n + C3 * (n+1) C1n + C2n + C4n + C5n + C6n + C3n + C3 n(C1+C2+C3
Big O value is = O (n)

When its compare to big O(n) with complexity chart:

Figure 10 Big O complexity Chart


lOMoARcPSD|41277594

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

Python code for Factorial numbers

For example, factorial of 6 is 6*5*4*3*2*1 which is 720.

Figure 11 Factorial python code for BIg O

Code Cost running time

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

Total Cost= C1 * n + C2 * (n+1) + C3 * n + C4 * n + C5 * n


C1n + C3n + C4n + C5n + C2 * (n+1) C1n + C3n + C4n + C5n + C2n + C2 n(C1+C2+C3+C4+C5+)
Big O value is = O (n)
lOMoARcPSD|41277594

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

What is a programming paradigm?

A programming paradigm is a style or approach to programming that defines how a


programmer writes, organizes, and thinks about code. There have been tons of
programming languages that are established, but all of them need to follow some
approach when they are applied and this metrology / approach is paradigms. There are
several programming paradigms that have been developed over the years, including:
 Procedural programming paradigm
 Object-oriented programming paradigm
 Event-driven programming paradigm

Procedural programming paradigm


lOMoARcPSD|41277594

Procedural programming is a programming paradigm that is based on the concept of


procedures, or routines, which are used to perform specific tasks in a program. In
procedural programming, the focus is on writing functions or procedures that perform
specific tasks, and the program is organized around these procedures. The procedural
code is the one that directly instructs a computer how to complete a task in logical steps.
This paradigm employs a hierarchical top-down approach which considers data and
process as 2 different entities. In procedural programming, the programmer specifies a
series of steps to be followed in order to solve a problem. These steps are then organized
into functions or procedures, which can be called upon by the main program or by other
functions as needed. The main advantage of procedural programming is that it allows
the programmer to break a complex problem down into smaller, more manageable
pieces, which can then be tackled individually. This makes it easier to understand and
debug the code, as well as to reuse it in other programs.
Procedural programming languages are designed to be modular, meaning that they allow
the programmer to break the code down into smaller, self-contained units that can be
easily tested and debugged. This makes it easier to write and maintain large programs.
Examples of procedural programming languages include C, Pascal, and FORTRAN.

Procedural programming has several advantages, including:


 It is simple and easy to learn
 It is well-suited for small programs or tasks
 It allows the programmer to control the flow of the program
 It is efficient and fast

However, procedural programming also has some disadvantages, including:


 It can be difficult to scale up to large programs
 It can be hard to maintain and modify large programs
 It is not as flexible as other programming paradigms
 It can be harder to reuse code compared to other paradigms such as object-
oriented programming.
lOMoARcPSD|41277594

Characteristics of procedural programming paradigm.

 Emphasis on procedures: Procedural programming is based on the idea of


breaking a problem down into smaller, more manageable pieces, which are then
organized into procedures or functions. These procedures can be called upon by
the main program or by other procedures as needed.
 Use of control structures: Procedural languages use control structures, such as
loops and conditional statements, to control the flow of the program. This allows
the programmer to specify the steps to be taken in specific circumstances, such as
when a particular condition is met or when a loop has completed a certain number
of iterations.
 Modularity: Modularity is when two dissimilar systems have two different tasks at
hand but are grouped together to conclude a larger task first. Every group of
systems then would have its own tasks finished one after the other until all tasks
are completed.

 Various functions can exchange information via global variables


 High efficiency

Examples for procedural languages

 C: C is a popular procedural programming language that is widely used for a


variety of applications, including operating systems, compilers, and embedded
systems.
 Pascal: Pascal is a procedural programming language that was developed in the
1970s. It is known for its simplicity and structured approach, and it is often used
for teaching programming concepts.
 FORTRAN: FORTRAN (Formula Translation) is a procedural programming
language that was developed in the 1950s for scientific and engineering
applications. It is known for its efficiency and its ability to handle large amounts
of data.
 COBOL: COBOL (Common Business Oriented Language) is a procedural
programming language that was developed in the 1950s for business applications.
It is known for its verbose syntax and its support for data manipulation and file
processing.

 BASIC: BASIC (Beginner's All-Purpose Symbolic Instruction Code) is a


lOMoARcPSD|41277594

procedural programming language that was developed in the 1960s as a simple


language for beginners. It is known for its simplicity and ease of use, and it is
often used to teach programming concepts.

A code snippet and output for procedural programming language

Figure 12 code snippet for procedural programming language

Output

Figure 13 code snippet output for procedural programming language

Evaluation between code sample and procedural programming paradigm


lOMoARcPSD|41277594

The code sample provided is an example of procedural programming in Python.


In procedural programming, the focus is on writing code as a series of steps that are
executed in a specific order. The code is organized into functions, with each function
performing a specific task. The program follows a linear flow, with the functions being
called in a specific order to accomplish a larger goal
This program prompts the user to enter a shape and its dimensions, then calculates and
prints the area of the shape. The program follows a procedural approach, with the main
function containing a series of steps that are executed in a specific order. The program
begins by reading in the shape and dimensions from the user, then calls the appropriate
function to calculate the area based on the shape. Finally, it prints the result to the
screen.
1. The code begins by defining three functions: ‘triangle_area’, ‘rectangle_area’, and
‘circle_are’a. Each of these functions takes in specific arguments and returns the
area of a particular shape. These functions follow the procedural paradigm by
breaking down the task of calculating the area of a shape into smaller, more
manageable steps.
2. The ‘calculate_area’ function is defined next. This function takes in a ‘shape’
argument and a variable number of ‘dimensions’ arguments. It then uses an if-elif-
else statement to determine which of the three previously defined functions to call
based on the value of the ‘shape’ argument. This function follows the procedural
paradigm by using well-defined procedures (the three previously defined
functions) to solve a specific problem.
3. The ‘main’ function is defined next. It begins by reading in the ‘shape’ and
‘dimensions’ from the user, and then calls the ‘calculate_area’ function with these
values as arguments. The result of this function call is then printed to the console.
The ‘main’ function follows the procedural paradigm by defining a specific
sequence of steps to solve a problem (reading in the shape and dimensions,
calculating the area, and printing the result).

The code sample I provided follows the procedural programming paradigm, as it is


lOMoARcPSD|41277594

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.

Object-oriented programming paradigm

Object-oriented programming (OOP) is a programming paradigm that is based on the


concept of "objects", which can contain both data and behavior. In OOP, objects are
used to represent real-world entities and the interactions between them. Object-oriented
paradigm that organizes software design around classes and objects.

Student Class Name


Id: Properties
Name: (or)
Marks: Data Members
Int get No Hours

Study ()
Float get Total Marks Methods
()
String get Grade ()
Figure 14 OOP example

Some advantages of object-oriented programming (OOP) include:

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

Some potential disadvantages of OOP include:

 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 object-oriented programming (OOP),


 class is a template or blueprint that defines the characteristics and behavior of a
particular type of object. A class is made up of data (also known as "properties")
and methods (also known as "functions").

 An object is an instance of a class, and is created using the class as a template. An


object contains its own unique data and behavior, and is often referred to as an
lOMoARcPSD|41277594

"object instance" or simply an "instance".


 Methods are functions that are defined within a class and are used to perform
actions or operations on the data contained within an object. Methods can be
called on an object instance to perform a specific task or operation.

Here is an example of a simple class definition in Python:

Figure 15 example of class definition

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:

Figure 16 example of Dog class

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:

Figure 17 OOP example calling the bark method


This would print the string "Woof!" to the console.
lOMoARcPSD|41277594

Characteristics of Object-Oriented programming paradigm.

The main characteristics of object-oriented programming (OOP) paradigm are:


 Encapsulation: This refers to the idea of bundling data and behavior together in an
object. In OOP, data is often referred to as "properties", and behavior is often
referred to as "methods". Encapsulation helps to keep the implementation details
of an object hidden from other parts of the program, allowing for more modular
and reusable code.

Figure 18 example for Encapsulation

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

Figure 19 example for inheritance

 Polymorphism: This refers to the ability of objects to take on multiple forms. In


lOMoARcPSD|41277594

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.

Figure 20 example for Polymorphism

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

Figure 21 example for Abstraction

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.

Some examples of object-oriented programming (OOP) languages include:


lOMoARcPSD|41277594

 Java: Java is a popular, high-level programming language that is widely used in


enterprise software development. It is known for its simplicity, portability, and
robustness.
 C++: C++ is a high-performance programming language that is commonly used
for systems programming, as well as in the development of desktop and mobile
applications.
 Python: Python is a high-level, interpreted programming language that is widely
used in web development, scientific computing, and data analysis. It is known for
its simplicity and readability, and has a large and active community of developers.
 C#: C# is a modern, object-oriented programming language that is widely used in
the development of Windows applications, as well as in game development and
mobile app development.
 Ruby: Ruby is a high-level, interpreted programming language that is known for
its simplicity and flexibility. It is widely used in web development and is the basis
for the popular Ruby on Rails framework.

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.

A code snippet and output for object-oriented programming language

Figure 22 code snippet for object−oriented programming language

Output
lOMoARcPSD|41277594

Figure 23
output
for
object−or
iented
program
ming
language
lOMoARcPSD|41277594

Evaluation between code sample and object-oriented programming paradigm

The code sample I provided is an example of object-oriented programming (OOP) in


Python. It follows the structure and conventions of OOP, including the use of a class to
define a template for creating objects, the use of instance variables to store data unique
to each object, and the use of methods to define behavior for objects.
In this code, the ‘Employee’ class is defined with an ‘ init ’ method that is used to
initialize an instance of the class with a name and salary. The class also includes a
‘raise_salary’ method that allows an employee's salary to be increased by a given
amount.
In this example, I define a class called ‘Employee’ with two properties (‘name’ and
‘salary’) and one method (‘raise_salary’). I then create three objects of the ‘Employee’
class (‘employee1’, ‘employee2’, and ‘employee3’), and set their ‘name’ and ‘salary’
properties. Finally, I call the ‘raise_salary’ method on the ‘employee1’ object, which
increases its salary by the specified amount. I then print the updated salary of the
‘employee1’ object to the console.
1. The code defines a class called ‘Employee’ with a ‘ init ’ method and a
‘raise_salary’ method. This follows the OOP principle of encapsulation, which
involves bundling data and the methods that operate on that data within a single
unit (in this case, the ‘Employee’ class).
2. The ‘ init ’ method is a special method in Python that is called when an object
of the class is created. It initializes the object with the provided name and salary.
This follows the OOP principle of abstraction, which involves exposing only
relevant data and hiding unnecessary details from the user.
3. The ‘raise_salary’ method increases the salary of an ‘Employee’ object by a given
amount. This follows the OOP principle of modularity, which involves breaking a
complex problem down into smaller, self-contained units (in this case, the
‘raise_salary’ method).

4. The code creates three ‘Employee’ objects: ‘employee1’, ‘employee2’, and


‘employee3’. This follows the OOP principle of inheritance, which involves
creating new classes that are derived from existing classes and inherit their
attributes and behaviors.
5. The code calls the ‘raise_salary’ method on the ‘employee1’ object, which
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.

Event-driven programming paradigm

Event-driven programming is a programming paradigm in which the flow of the


program is determined by events such as user actions (e.g., mouse clicks, key presses),
sensor outputs, or messages from other programs or threads.
In event-driven programming, a program typically consists of a loop that waits for
events to occur and then triggers a callback function or handler to process the event. The
callback function typically performs some action in response to the event and may also
trigger additional events.
One of the main benefits of event-driven programming is that it allows for a program to
be designed in a modular and reusable way, with each event handler responsible for a
specific task. This can make it easier to maintain and debug the program, as well as to
add new features.
lOMoARcPSD|41277594

Event-driven programming is commonly used in graphical user interface (GUI)


programming, where user actions such as mouse clicks and key presses need to be
detected and processed. It is also commonly used in network programming, where
events such as incoming network connections or data packets need to be handled.

Characteristics of event driven programming paradigm.

1. Asynchronous execution: In event-driven programming, events can occur at any


time, and the program responds to these events as they occur, rather than
executing a predetermined sequence of instructions.
2. Event-driven architecture: Event-driven programming typically involves an event-
driven architecture, in which a central event loop listens for events and dispatches
them to the appropriate event handlers.
3. Reactive programming: Event-driven programming often involves reactive
programming, in which the program reacts to changes in the environment by
executing a specific set of instructions in response to an event.
4. Loosely coupled: Event-driven programming often involves loosely coupled
components that communicate with each other through events, rather than directly
calling each other's functions. This allows components to be developed and tested
independently and makes it easier to add new features or modify existing ones.
5. Event-driven UI: Event-driven programming is often used in graphical user
interfaces (GUIs), in which user actions such as clicking a button or typing in a
text field trigger specific events that the program responds to.

Event Driven Programming – Features


1. Event loop: An event loop is a central component of an event-driven architecture.
It is responsible for listening for events and dispatching them to the appropriate
event handlers. The event loop runs continuously, checking for new events and
processing them as they occur.
2. Trigger function: A trigger function is a function that is executed in response to an
event. It is called by the event loop when an event occurs, and is responsible for
performing the necessary actions in response to the event.
3. Pre-defined function: A pre-defined function is a function that is defined in
advance and is available for use in the program. In event-driven programming,
pre-defined functions are often used as event handlers or trigger functions.
lOMoARcPSD|41277594

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.

Some examples of Event-driven programming (OOP) languages include:

1. JavaScript: JavaScript is a popular event-driven programming language that is


often used in web development to create interactive websites. It has a built-in
event loop and supports event-driven UI development through its Document
Object Model (DOM) API.
2. Python: Python is a general-purpose programming language that supports event-
driven programming through libraries such as Pygame and Tkinter. These libraries
provide APIs for creating event-driven UI elements and listening for events such
as button clicks or key presses.
3. Java: Java is a popular programming language that supports event-driven
programming through its Abstract Window Toolkit (AWT) and Swing libraries.
These libraries provide APIs for creating event-driven UI elements and listening
for events.
4. C#: C# is a programming language that is used to develop applications for the
Microsoft .NET framework. It supports event-driven programming through its
Windows Forms library, which provides APIs for creating event-driven UI
elements and listening for events.
5. Swift: Swift is a programming language that is used to develop iOS, macOS,
watchOS, and tvOS applications. It supports event-driven programming through
its UIKit framework, which provides APIs for creating event-driven UI elements
and listening for events such as button clicks or screen touches.
lOMoARcPSD|41277594

A code snippet and output for Event-driven programming language

Figure 24 code snippet for Event−driven programming language

Output 1

Figure 25 output 1 for Event−driven

Output 2

Figure 26 output 2 for Event−driven


lOMoARcPSD|41277594

Output 3

Figure 27 output 3 for Event−driven

Evaluation between code sample and Event-driven programming paradigm

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

Relationship between procedural, object oriented and event-driven (compare and


contrast)

Procedural Object-Oriented Event-Driven


Definition A programming A programming A programming
paradigm that paradigm that paradigm that
focuses on writing focuses on focuses on reacting
code as a series of organizing code into to and handling
step-by-step reusable objects that events such as user
instructions. represent real-world input, network
concepts. requests, or file
changes.
Key Procedures, Classes, objects, Events, event
Concepts functions, and inheritance, and handlers, and the
control structures encapsulation event loop
Code Code is organized Code is organized Code is organized
Structure as a series of steps, into classes and into event handlers
with each step objects, with each that are called in
performing a class representing a response to specific
specific task. real-world concept events.
and each object
representing an
instance of that
concept.
Example C, FORTRAN, Java, C++, Python JavaScript, Python,
Languages BASIC Java
General Code execution Code is organized Code execution is
characteristic follows a into reusable objects driven by events and
s predetermined that can interact with the corresponding
sequence of steps. each other through event handlers are
method calls. called in response to
those events.

Figure 28 Relationship between procedural, object oriented and


event−driven
lOMoARcPSD|41277594

comparison between these 3 paradigms using source codes

Procedural Programming Paradigm:


In a procedural approach, we could create a set of functions to perform various
calculations related to triangles. For example, we could create a function to calculate the
area of a triangle given the lengths of its sides, and another function to calculate the
perimeter. Here is an example of how this could look in Python:

Figure 29 example Procedural Programming


lOMoARcPSD|41277594

Object-Oriented Programming Paradigm:


In an object-oriented approach, we could create a ‘Triangle’ class that contains data
about the triangle (such as the lengths of its sides) and methods for performing
calculations on that data (such as calculating the area or perimeter). Here is an example
of how this could look in Python:

Figure 30 example Object−Oriented Programming

Event-Driven Programming Paradigm:

In an event-driven approach, we could create a graphical user interface (GUI) that


allows the user to input the lengths of the sides of a triangle and then displays the area
and perimeter when a "Calculate" button is clicked. Here is an example of how this
could look in Python using the Tkinter library
lOMoARcPSD|41277594

Figure 31 example Event−Driven Programming


lOMoARcPSD|41277594

Activity 3

The three algorithms used by Ayubo Drive (Pvt) Ltd

Function 1: Rent calculation.

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

Function 2: Day tour - hire calculation.

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:

IF vehicle no, package type found


totalNoOfHours = end_time – start_time
IF (totalNOHourse > maximumHours)
waitingHours = totalNoOfHours – maximumHours
waitingFee = waitingHours * extraHourRate
ELSE
waitingFee = 0
END IF

totalNoOfKM = end_km_reading - start_km_reading


IF (totalNoOfKM > maximumNoKM)
extraKM = totalNoOfKM – maximumNoKM
extraKMFee = extraKM * KMrate
ELSE
extraKMFee = 0
lOMoARcPSD|41277594

END IF

TotalAmount = basehirecharge + waitingFee + extraKMFee


ELSE
DISPLAY vehicle, package Not Found
END FUNCTION DAY TOUR-HIRE CAL

Function 3: Long tour - hire calculation.

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:

noOfTotalDays = returnDate – rentedDate


noOfKM = endKM – startKM
maximumNoKM = NoOfTotalDays * noOfKM

IF (maximumNoKM > noOfKM)


extraKM = noOfKM – maximumNoKM
extraKMcharge = extraKM * extraKMrate
ELSE
extraKMcharge = 0

baseHire = packageRate * NoOfTotalDays

noOfnights = NoOfTotalDays – 1
overNightStay = (parkingRate + driverRate) * noOfnights

TotalAmount = baseHire + overNightStay + extraKM


lOMoARcPSD|41277594

DISPLAY TotalAmount
END FUNCTION LONG_TOUR-HIRECAL
lOMoARcPSD|41277594

Developing Functions using Visual Studio IDE

Function 1: Rent calculation.

Figure 32 Rent calculation C# code


lOMoARcPSD|41277594

Function 2: Day tour - hire calculation.

Figure 33 Day tour − hire calculation C# code


lOMoARcPSD|41277594

Function 3: Long tour - hire calculation.

Figure 34 Long tour − hire calculation C# code


lOMoARcPSD|41277594

Development of Suitable Database Structure for Ayubo Drive

MS SQL server management studio

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

Figure 35 interface of MS SQL

Database of ayubo Drive

Figure 36 Database of ayubo drive


lOMoARcPSD|41277594

Vehicle Table

Figure 37 vehicle table screenshot

Package Table

Figure 38 Package table screenshot


lOMoARcPSD|41277594

Hire Table

Figure 39 Hire table screenshot

Rent Table

Figure 40 rent table screenshot


lOMoARcPSD|41277594

What is an IDE

An IDE, or Integrated Development Environment, is a software application that provides


a comprehensive set of tools for software development. These tools may include a code
editor, a compiler or interpreter, and a debugger, among other features. 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. Some popular
examples of IDEs include Visual Studio, Eclipse, and Xcode.

Figure 41 example of IDE environment

There are many benefits to using an IDE, including:

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.

Visual Studio IDE

Visual Studio is a powerful integrated development environment (IDE) developed by


Microsoft. It is primarily used for developing Windows applications, but can also be used
to develop web, mobile, and gaming applications. It supports a wide variety of
programming languages including C++, C#, Visual Basic, F#, Python, and more.
The IDE provides a variety of features such as a code editor, a visual designer, a
debugger, and a profiler to make the development process more efficient. It also has built-
in support for version control systems such as Git and TFS. Additionally, it has a large
library of pre-built templates, libraries and tools that can be used to speed up the
development process. It also offers a powerful set of debugging and profiling tools that
can help developers quickly identify and fix issues in their code.
Visual Studio also supports collaboration and team development through its Team
Explorer feature, which allows developers to work on the same codebase, share their
work and communicate with one another.
It's available in Community, Professional and Enterprise edition, each with different
features and target audience. Community edition is free and open-source and Professional
and Enterprise edition are paid and offer more features and support.
lOMoARcPSD|41277594

Interface of Visual Studio IDE

Figure 42 Full visual studio open view

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

identifying performance bottlenecks.


 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.
 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.
 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.
 Additional features: Some IDEs include features like integrated testing tools, code
analysis and linting, package management, deployment, and more.

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.

Some of the Features that help me to develop the Application:

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.

Figure 43 screenshot of Code cleanup


lOMoARcPSD|41277594

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

Figure 44 screenshot Squiggles and quick actions

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.

Figure 45 screenshot of refactoring


lOMoARcPSD|41277594

IntelliSense: This feature provides context-aware code completion and suggestions as


developers type. This can save time and reduce the likelihood of errors. The following
example shows how IntelliSense displays a list of Time Unit

Figure 46 screenshot of IntelliSense

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.

Figure 47 screenshot of Toolbox

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.

Figure 48 screenshot of Properties

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.

Figure 49 screenshots of Error List Window

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.

Figure 50 screenshot of Server Explorer


lOMoARcPSD|41277594

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.

Figure 51 screenshot of Solution explorer


lOMoARcPSD|41277594

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.

Figure 52 screenshot of Diagnostic window


lOMoARcPSD|41277594

Comparing the Advantages and Disadvantages of Using an IDE vs. Not Using an
IDE for Application Development

Using an IDE Not using an IDE


Advantages Advantages
- Intuitive and user-friendly interface - Greater flexibility in choice of tools and workflow
- Built-in debugging and testing tools - More control over project setup and configuration
- Code completion and syntax - Potentially faster development speed
highlighting
- Integrated version control support - More lightweight and minimalistic approach
- Built-in support for multiple languages - Familiarity with command-line interface
Disadvantages Disadvantages
- May be resource-intensive - Lack of built-in debugging and testing tools
- Limited to the features provided by the - Less user-friendly interface
IDE
- Dependence on the IDE for certain - Lack of integrated version control support
tasks
- May be more difficult to configure for - Limited support for multiple languages
specific needs

Figure 53 Advantage & disadvantages of using and not using IDE

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

Ayubo Drive Vehicle Hire System Development and Implementation Interface


Input and Output

Login Page

The Login Page for the System


-The Username & password for Authorized users would be “admin” & admin123.
-Once the correct logins are entered it will direct to the Main menu page.
-If Incorrect login details are entered error message will be displayed.

Figure 54 Login Page


lOMoARcPSD|41277594

Figure 55 Login Deatils incorrect

Figure 56 Login Successful


lOMoARcPSD|41277594

Home Page

Figure 57 Home Page

Vehicle Registration

Figure 58 vehicle Register Page


lOMoARcPSD|41277594

Package Registration

Figure 59 Package Registration Page

Rent Vehicle

Figure 60 Rent Page


lOMoARcPSD|41277594

Hire Day Tour and Long Tour

Figure 61 Hire Page

Ayubo Drive Vehicle Hire Amount Calculation, inserting, Updating, Delete,


Searching and Calculate Some Records in Database Management

Figure 62 inserted Vehicle Details Successfully


lOMoARcPSD|41277594

Figure 63 Successfully Updated Packages

Figure 64 Deleted Successfully


lOMoARcPSD|41277594

Calculating Vehicle rent

Figure 65 Calculated vehicle rent Successful

Calculate Day Tour

Figure 66 Calculated Day tour hire


lOMoARcPSD|41277594

Calculate Long Tour

Figure 67 Calculated long Tour Hire

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

The debugging process typically involves the following steps:

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.

Features that available in Visual Studio IDE to facilitate debugging

Visual Studio is a popular integrated development environment (IDE) that provides a


wide range of features to help with debugging. Some of the most notable features include:

 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

The debugging process to develop more secure, robust application

 Debugging is an essential part of the software development process and can be


used to develop more secure and robust applications. One of the key ways
debugging can be used to improve the security of an application is by identifying
and fixing vulnerabilities before they can be exploited by attackers.
 For example, when developing a web application, it's important to ensure that all
user input is properly validated and sanitized to prevent SQL injection attacks.
By using breakpoints and the Immediate Window to examine the values of user
input, I can ensure that any potentially malicious input is properly handled and
rejected.
 Another way to use debugging to improve the robustness of an application is by
identifying and resolving performance bottlenecks. For example, when
developing a large-scale data processing application, I would use the Code
Analyzer and the Performance Profiler to identify any areas of the code that are
causing poor performance and then use breakpoints and the Immediate Window
to see the variables and expressions values.
 Additionally, debugging can be used to identify and resolve concurrency issues
that could cause the application to crash or behave unexpectedly. For example,
when developing a multi-threaded application, I would use the Threads Window
to monitor the state of the threads and identify any issues related to race
conditions, deadlocks, or other concurrency problems.

Some of the visual Studio IDE features that help me to debugging process to
lOMoARcPSD|41277594

develop Ayubo System more secure, robust application

 Breakpoint

Figure 68 Screenshot of 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

Figure 69 Screenshot of Error list

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

Figure 70 screenshot of immediate window

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

Figure 71 screenshot of 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

Figure 72 screenshot of 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

Debugging Techniques in Visual Studio: An Overview

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

There are several benefits to using coding standards, including:

 Improved readability: A consistent coding style makes it easier for developers to


read and understand code, which can improve productivity and reduce the
likelihood of bugs.
 Enhanced maintainability: Code that follows a consistent standard is easier to
update and maintain over time.
 Increased collaboration: When multiple developers are working on the same
codebase, coding standards can help ensure that everyone is on the same page
and working together effectively.
 Better quality: Coding standards can help to ensure that code meets certain quality
standards, such as performance, security, and accessibility.
 Better scalability: Code which follows coding standards is more scalable and
robust, and it's easier to extend and adapt to new requirements.
 Compliance: It may be necessary to comply with certain industry or regulatory
standards, and a coding standard can help to ensure that code meets these
requirements.

Coding Standards that I Used in Application Development

 Using Comment

Figure 73 screenshot of comments inside the program


lOMoARcPSD|41277594

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.

 Using Meaningful Variable Names

Figure 74 screenshot of meaningful variable name


lOMoARcPSD|41277594

In this C# code, I use of meaningful variable names is an example of a coding standard.


Using meaningful variable names makes the code more readable and understandable,
and it helps me to ensure that the code is maintainable. It also makes it clear what the
variable represents and its purpose in the code. The variable names used in this code
block, such as "totalNoOfKM" and "extraKMFee", are clear and descriptive, making it
easy to understand what the variables represent. This is in contrast to using variable
names like "x" or "y", which would not provide any context or information about the
variable's purpose. Using meaningful variable names is an important aspect of coding
standards as it makes the code more understandable and easier to maintain. This is
especially important in large and complex projects where many developers may be
working on the same codebase. Using consistent and descriptive variable names helps
me to ensure that the code is easy to understand and modify, and it also helps me to
reduce the likelihood of errors and bugs.

 Using Proper data Type

Figure 75 screenshot of using proper data type

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

 Maintaining Indentation While coding

Figure 76 screenshot of using indentation

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

 One Statement per line

Figure 77 screenshot of C# coding One Statement per line

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

 General naming Guidelines

Figure 78 General naming Guidelines in C# code

In this C# code, the general naming guidelines followed include:

1. Using camelCase for variable names (e.g. totalNoOfHours, maximumHours,


waitingHours)
2. Using UPPER_CASE for constants (e.g. maximumNoKM, KMrate)
3. Using meaningful and descriptive names for variables and constants (e.g.
totalNoOfKM, extraKMFee, waitingFee)
These naming conventions help me to make the code more readable and maintainable.
They also make it easier to understand the purpose of each variable and constant. The
code is more readable because of this. It's also more maintainable because it's easier to
know what a variable is used for.
lOMoARcPSD|41277594

The Importance of Coding Standards in Team and Individual Development

 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

Overall, I found this programming assignment to be a challenging but rewarding


experience. I encountered various challenges such as configuring the software,
troubleshooting implementation issues, and ensuring my code met the specific
requirements. To overcome these challenges, I employed various methods such as
researching best practices, consulting with colleagues and experts, and conducting
thorough testing and verification. Upon completion, I am proud and satisfied with my
work and believe that the code I produced is well-designed and optimized. I know that the
methods and experience I gained from this assignment will be valuable in future
programming projects.

Gantt Chart

PROGRAMMING ASSIGNMENT GANTT CHART


Months October November December January

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:

While working on the assignment, I identified both strengths and weaknesses in my


approach and performance. I was able to critically analyze the task at hand and come up
with effective solutions to meet the distinction criteria. However, I struggled with time
management, which made it difficult to complete the assignment to the best of my
abilities. Additionally, I had trouble staying focused and motivated, which led to
feelings of disappointment and frustration. Despite these challenges, I was able to stay
determined and ultimately complete the assignment successfully.

References

Tutorialspoint (2019). Data Structures - Algorithms Basics. [online] Tutorialspoint.com.


Available at:
https://www.tutorialspoint.com/data_structures_algorithms/algorithms_basics.htm.

Process of building an application - got from our lecture Mrs.Irani

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

GeeksForGeeks (2018). Introduction of Programming Paradigms - GeeksforGeeks.


[online] GeeksforGeeks. Available at: https://www.geeksforgeeks.org/introduction-of-
programming-paradigms/.

Cocca, G. (2022). Programming Paradigms – Paradigm Examples for Beginners. [online]


freeCodeCamp.org. Available at: https://www.freecodecamp.org/news/an-introduction-
to-programming-paradigms/.
lOMoARcPSD|41277594

TerryGLee (n.d.). Overview of Visual Studio. [online] learn.microsoft.com. Available at:


https://learn.microsoft.com/en-us/visualstudio/get-started/visual-studio-ide?view=vs-
2022.

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.

Sayantini (2019). What is Debugging? Different Stages of Debugging. [online] Edureka.


Available at: https://www.edureka.co/blog/what-is-debugging/.

Codin standard - got from our lecture Mrs.Irani


lOMoARcPSD|41277594

Grading Rubric

Grading Criteria Achieved Feedback

LO1 Define basic algorithms to carry out an operation


and outline the process of programming an
application.

P1Provide a definition of what an algorithm is and outline


the process in building an application.

M1Determine the steps taken from writing code to


execution.

D1 Evaluate the implementation of an algorithm in a suitable


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

LO2 Explain the characteristics of procedural,


objectorientated and event-driven programming,
conduct an analysis of a suitable Integrated
Development Environment (IDE)
lOMoARcPSD|41277594

P2Give explanations of what procedural, objectorientated,


and eventdriven paradigms are; their characteristics and the
relationship between them.

M2 Compare and contrast the procedural, object


orientated and event driven paradigms used in given
source code of an application

D2Critically evaluate the source code of an application which


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

LO3Implement basic algorithms in code using an IDE.

P3Write a program that implements an algorithm using an


IDE.

M3Use the IDE to manage the development process of the


program.

D3Evaluate the use of an IDE for development of


applications contrasted with not using an IDE.
lOMoARcPSD|41277594

LO4 Determine the debugging process and explain


the importance of a coding standard

P4Explain the debugging process and explain the debugging


facilities available in the IDE.

P5Outline the coding standard you have used in your code.

M4Evaluate how the debugging process can be used to


help develop more secure, robust applications.

D4 Critically evaluate why a coding standard is necessary in


a team as well as for the individual.

You might also like