0% found this document useful (0 votes)
5 views51 pages

PROCESS7048 1712772218517 Unit 01 Programming Assignment - 2024

The document is a feedback form for a programming assignment submitted by A.A. Jashab Ahamad, focusing on the development of a Leave Management System for Grifindo Lanka Toys. It outlines the learning outcomes, assessment criteria, and guidelines for submission, including the importance of avoiding plagiarism and adhering to coding standards. Additionally, it provides a detailed assignment brief with specific tasks related to algorithms, programming paradigms, and the implementation of the system using an Integrated Development Environment.

Uploaded by

jazafahd0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views51 pages

PROCESS7048 1712772218517 Unit 01 Programming Assignment - 2024

The document is a feedback form for a programming assignment submitted by A.A. Jashab Ahamad, focusing on the development of a Leave Management System for Grifindo Lanka Toys. It outlines the learning outcomes, assessment criteria, and guidelines for submission, including the importance of avoiding plagiarism and adhering to coding standards. Additionally, it provides a detailed assignment brief with specific tasks related to algorithms, programming paradigms, and the implementation of the system using an Integrated Development Environment.

Uploaded by

jazafahd0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 51

lOMoARcPSD|45372092

Higher Nationals - Summative Assignment Feedback Form


Student Name/ID A.A. JASHAB AHAMAD/E194215
Unit Title Unit 01 – Programming
Assignment Number 1 Assessor MS. VINDYA
Date Received
Submission Date 11/09/2024 1st 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 applicat i

Pass, Merit & Distinction Descripts P1 P2 M1 D1

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

Pass, Merit & Distinction Descripts P3 M2 D2

LO3. Implement basic algorithms in code using an IDE.

Pass, Merit & Distinction Descripts P4 M3 D3

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

Pass, Merit & Distinction Descripts P5 P6 M4 D4

P a g e 1 | 51
A.A.JASHAB AHAMAD /E194215
PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

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

Assessor Feedback:

Grade: Assessor Signature: Date:


Resubmission Feedback:

• Please note resubmission feedback is focussed only on the resubmitted work

Grade: Assessor Signature: Date:


Internal Verifier’s Comments:

Signature & Date:

• Please note that grade decisions are provisional. They are only confirmed once internal and external moderation has
taken place and grades decisions have been agreed at the assessment board.

BTEC HN Summative Assignment Feedback Form


Issue Date: June 2021 Owner: HN QD
DCL1 Public (Unclassified) Version 1.0

P a g e 2 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

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. Avoid using page borders in your assignment body.
3. Carefully check the hand in date and the instructions given in the assignment. Late submissions will not be
accepted.
4. Ensure that you give yourself enough time to complete the assignment by the due date.
5. Excuses of any nature will not be accepted for failure to hand in the work on time.
6. You must take responsibility for managing your own time effectively.
7. 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.
8. Failure to achieve at least PASS criteria will result in a REFERRAL grade.
9. Non-submission of work without valid reasons will lead to an automatic RE FERRAL. You will then be asked to
complete an alternative assignment.
10. 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 intext citation and a reference list.
11. 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
12. Use word processing application spell check and grammar check function to help editing your assignment.
13. 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.

STUDENT ASSESSMENT SUBMISSION AND DECLARATION


When submitting evidence for assessment, each student must sign a declaration confirming that the work is
their own.
Student name: Assessor name:
A.A. JASHAB AHAMAD/E194215 MS.VINDYA
Issue date: Submission date: Submitted on:
05/05/2024 11/09/2024 11/09/2024
Programme: Pearson BTEC HND in Computing

Unit: Unit 01 – Programming


Assignment number and title:
Building a Leave Management System for Grifindo Lanka Toys (Pvt) Ltd.
Plagiarism
Plagiarism is a particular form of cheating. Plagiarism must be avoided at all costs and students who break the
rules, however innocently, may be penalised. It is your responsibility to ensure that you understand correct
referencing practices. As a university level student, you are expected to use appropriate references throughout

P a g e 3 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

and keep carefully detailed notes of all your sources of materials for material you have used in your work,
including any material downloaded from the Internet. Please consult the relevant unit lecturer or your course
tutor if you need any further advice.

Guidelines for incorporating AI-generated content into assignments: The use of AI-
generated tools to enhance intellectual development is permitted; nevertheless, submitted work must
be original. It is not acceptable to pass off AIgenerated work as your own.

Student Declaration
Student declaration

I certify that the assignment submission is entirely my own work and I fully understand the consequences of
plagiarism. I understand that making a false declaration is a form of malpractice.

Student signature: A.A. JASHAB AHAMAD Date: 11/09/2024

Unit 01: PROGRAMMING


Assignment Brief
Student Name/ID A.A. JASHAB AHAMAD/E194215
Number
Unit Number and Title Unit 01 – Programming

Academic Year 2024/2025


Unit Tutor
Assignment Title Building a Leave Management System for Grifindo Lanka Toys
(Pvt) Ltd.
Issue Date 05/05/2024

Submission Date 11/09/2024

Submission Format
The assignment submission is in the form of the following.
• The submission should be in the form of an individual written report written in a
concise, formal technical style using single spacing and font size 12. • Student has to
submit the complete GUI System with the database.

P a g e 4 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

Unit Learning Outcomes


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

LO2. Explain the characteristics of procedural, object-orientated and event-driven


programming.

LO3. Implement basic algorithms in code using an IDE.

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

Transferable skills and competencies developed

P a g e 5 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

Computing-related cognitive skills :


• Demonstrate knowledge and understanding of essential facts, concepts, principles and
theories relating to computing and computer applications
• Use such knowledge and understanding in the modelling and design of computerbased
systems for the purposes of comprehension, communication, prediction and the
understanding of trade-offs
• Recognise and analyse criteria and specifications appropriate to specific problems, and
plan strategies for their solutions
• Critical evaluation and testing: analyse the extent to which a computer-based system
meets the criteria defined for its current use and future development
• Methods and tools: deploy appropriate theory, practices and tools for the design,
implementation and evaluation of computer-based systems.

Computing-related practical skills :


• The ability to specify, design and construct reliable, secure and usable computerbased
systems
• The ability to evaluate systems in terms of quality attributes and possible trade-offs
presented within the given problem
• The ability to deploy effectively the tools used for the construction and documentation
of computer applications, with particular emphasis on understanding the whole process
involved in the effective deployment of computers to solve practical problems
• The ability to critically evaluate and analyse complex problems, including those with
incomplete information, and devise appropriate solutions, within the constraints of a
budget.

Generic skills for employability:


• Intellectual skills: critical thinking; making a case; numeracy and literacy
• Self-management: self-awareness and reflection; goal setting and action planning
• Independence and adaptability; acting on initiative; innovation and creativity

• Contextual awareness, e.g. the ability to understand and meet the needs of individuals,
business and the community, and to understand how workplaces and organisations are governed.

P a g e 6 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

Assignment Brief and Guidance:

P a g e 7 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

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 and carry out an analysis of writing the code phase by discussing the potential
challenges faced.

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.

P a g e 8 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

Activity 2

Compare and discuss 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 ) and 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.

Grifindo Lanka Toys is a small-scale Toy building company which is in Sri Lanka and
currently they have 20 employees working at this company. Grifindo Lanka Toys is the Sri
Lankan branch of Grifindo Toys Company which is in UK and previously they have hired your
freelance company to develop their payroll system and now they are hiring you again to
develop their leave management system for the Sri Lankan branch, Grifindo Lanka Toys
Company.
Specifications for the leave management system as follows,

This leave management system has two user roles, and they are Employee and Admin, and they
are having two separate desktop applications to interact with the centralized database . Developer
can consider the centralized database as a local database for the development purposes.

P a g e 9 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

Functional requirements for the Employee and Admin as follow.

1. Employee Application.

• Employee should be able to login to the system with the employee number and
the given password.

• Employee should be able to apply for a leave through the system.

Note:- Normally an employee has 14 annual leaves, 7 casual leaves for a year and
2 shorts leaves per a month. Employee can apply casual leaves as they want
before their defined roaster starts. Annual leaves can be applied before 7 days
prior to the leave date. Short leave duration is 1 hour and 30 minutes and can be
applied for up coming time slots.

• Employee can view the status of applied leaves (Whether applied leaves are
approved or not).

• Employee can delete applied leaves.

• Employee can view their remaining leaves and history of applied leaves.

2. Admin Application

• Admin should be able to login to the leave management system.

• Admin should be able to register new employees to the system.

• Admin should be able to define the number of annual leaves, casual leaves for a
year and 2 short leaves per every month for every employee. (Newly joined
employees will less number of leaves compared to permanent employees)

• Admin should be able to define the roaster starting time and end time for each
employee.

P a g e 10 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

• Admin should be able to approve or reject applied leaves of each employee.

• Admin should be able to view leave reports of,

▪ Individual employee leave history for a given date range.

▪ All employees leave history for a given date range.

Activity 3

3.1. Write the complete pseudocode for the employee apply leave function of the
above system. Use the visual studio IDE (using C#.net) to implement the above two
applications. Ideally there should be two separate classes for the above two applications and
the developer can decide the methods which need to include in those classes. Design the
suitable database structure for keeping the data of the above system.

3.2. 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 two small GUI systems for the above scenario and those two applications
should be complete functional systems with all the functions which has described in the
above scenario with the database structure which has designed in activity 3.

4.2 Examine 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 Explain and 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.

P a g e 11 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

Reading:
Aho, A. V. et al. (1987) Data Structures and Algorithms. 1st Ed. Addison-Wesley. Hunt, A.
et al. (2000) The Pragmatic Programmer: From Journeyman to Master. 1st Ed.

Addison-Wesley. McConnell, S. (2004) Code Complete: A Practical Handbook of Software


Construction. 2nd Ed. Microsoft Press.

HN Global:
HN Global HN Global (2021) Reading Lists. Available at:
https://hnglobal.highernationals.com/learning-zone/reading-lists

HN Global (2021) Student Resource Library. Available at:


https://hnglobal.highernationals.com/subjects/resource-libraries

HN Global (2021) Textbooks. Available at:


https://hnglobal.highernationals.com/textbooks

P a g e 12 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

P a g e 13 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

P a g e 14 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

Activity-01...............................................................................................................................16

01. Algorithm

1) Characteristics of a good algorithm

2) Algorithm and pseudo code to display the Fibonacci series

3) Algorithm and pseudo code to display the factorial value

4) Steps involved in the process of writing and executing a program

5) Dry run of the above two algorithms

6) Big o Notation

7) Python code for Fibonacci series and factorial value

8) Efficiency of the algorithms


Activity 02...............................................................................................................................26

1) Programming Paradigm

2) Main characteristics of Procedural, object oriented, event driven paradigms

3) Relationships among the above paradigms

4) Example code snippets for above paradigms

P a g e 15 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

5) Structure and Characteristic evaluation of above code snippets.

Activity 03...............................................................................................................................32

01. Algorithms for Grifindo Lanka Toys leave management system

02. Functions by using Visual studio IDE to implement the above algorithms

03. Database structures for above functions


04. Features of an IDE and application Development

5)Uses of Visual studio IDE for my application development contrasted with not using an

05. IDE

P a g e 16 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

Activity 01

1. Algorithm

The definition of an algorithm is, a step-by-step process involved by successfully completing a task. It is
possible to write algorithms in many ways and languages like English, Japanese, etc. Algorithms have
been specified precisely using an appropriate math formalism. (Anon., n.d.)

1.1.1. Characteristics of a good algorithm

The characteristics of a good algorithm are,

• Input: Algorithms take input data, which can be in various formats, such as numbers, text, or
images.
• Output: The result you get after computation of the input is an output. An algorithm should
have one more well- defined outputs, also they should match with the expected output. To get
precise outputs, we should know the kind of output, how much of it and the form of output, or
if there should be an output.
• Definiteness: A good algorithm should have detailed steps and the order in which the steps
should be must be taken in the process should be specified. Specifying the sequence of
operations involved in turning input to output is called Definiteness.
• Effectiveness: Algorithms are effective when all the step involved in gaining the output are
feasible with the available resources.
• Finiteness: A good algorithm should always have an end point (either the desired output or the
required response). It should not have infinite steps.
• Independent — A good algorithm has step-by-step directions which are independent
From our program code. It should run on any programming language.

P a g e 17 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

1.1.2 Algorithms to display the Fibonacci series and the factorial value for a given number using
Pseudo code.

1.1.2.1 Algorithms to display the Fibonacci series for a given number using Pseudocode.

Try 1:

Start

Step 01 — define function named Fibonacci (n)

Step 02 — inside step 01 do the following if statement

Step 03 — start if statement where n == 0, return the value 0

Step 04 — in elif n == 1, return the value 1

Step 05 — in elif n == 2, return the value 1

Step 06 — if it not in the above, put else statement to return (Fibonacci (n -1) + (n - 2)) Step 07 —
End if
Step 08 — declare variable x

Step 09 — ask user to input a value for x

Step 10 — assign the value of x to n in Fibonacci(n) and print it (eg: print (Fibonacci (x)))
End

Note: this does not generate all the Fibonacci series numbers until user input number (x), but gives
the output for xt" number in the Fibonacci series.
Try2:

Start

Step 01 - ask user to input a value for i

Step 02 - declare variables x = 0, y = 1, z = 0, c = 0.

P a g e 18 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

Step 03 - check if input is valid (positive) (i +=0)

Step 04 - if input (i) is equal to zero

Step 05 - print (“answer =”, i)

Step 06 - else if input is equal to 1

Step 07 - print (“Fibonacci series =”, x, y)

Step 08 - else if the input is equal to 2

Step 09 - print (“Fibonacci series =”, x, y, y)

Step 10 - else

Step 11 - print (“Fibonacci series ”)

Step 12 - open while loop condition c is greater than or equal to i (c >= i)

Step 13 - print(x)

Step 14 - z = x + y

Step 15 - change values of variables x = y, y = z


Step 16 - increase count (c += 1)
End

1.1.2.2 Algorithms to display the factorial value for a given number using Pseudocode

Start

Step 01 — define a function named facto (n)

Step 02 — start if function

Step 03 — if the value of n == 0, then return 0

Step 04 - if the value of n == 1, then return 1

P a g e 19 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

Step 05 — in else statement, return facto (n - 1) * n

Step 06 — end if

Step 07 — declare variable x, and ask user to input an int value for x

Step 08 — assign the value of x to the function above and print the answer (eg:

print(facto(x)))

1.2 Steps involved in the process of writing and executing program

To develop a program, the following stages must be followed.

1. Analysing the Problem


2. Algorithm design / Pseudo Code
3. Flowchart
4. Coding
5. Debugging
6. Testing
7. Final output
8. Documentation

1. Analysing the Problem:

This is indeed the first Step to creating a program. And it involves getting information about the program you are
about to create. It is in this stage that you determine what you want to achieve with your program, how you want
to achieve it, etc.

This information is very important for the programmer because it provides him the basis for planning about the
program and to control the possible difficulties that may arise.

P a g e 20 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

2. Algorithm Design.

In this stage all the instructions which are to be performed at different stages in the program are listed in simple
English language. We may call it as a strategy.

Let's takes a simple calculator program as an example. The algorithm will be.

 Receive user input.


 Perform calculation on input (addition, subtraction etc.).
 Print out result.
4. Coding:

Figure 1

In this stage the programmer writes the instructions in a language understood by the computer to solve the
problem(s) drafted out in the previous stages. It's obvious how, many programmers jump the initial stages and
start writing bunch of codes. Because all the processes of Coding depend upon the information we obtained in the
previous stages.

NOTE: Choice of language depends entirely upon the requirements and facilities available with a language in
contrast with what you want to achieve.

P a g e 21 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

5. Debugging:

Figure 2

In this stage we correct all the errors in the program, because there is a great probability of mistakes occurring
when coding.

Here the program is executed manually, called DRY RUN. This is done several times until all the errors are
removed from the program and the system become error free.

6. Testing:

This stage is similar to debugging except that In this stage we test the program by entering dummy datas (includes
usual, unusual and invalid data) to check how the behaviour of the program when given such datas.

7. Final Output:

After going through all the above stages, the program is given the TRUE DATA. Here the programmer expects
the positive results of the program and expects full efficiency of the program.

8. Documentation

Majority of programmers neglect this stage by giving many reasons, but this is very significant, because it will
encourage the programmer to find solutions to the problems that may occur in the program.

Types of documentation:

There are two types of documentations namely.

 User Manual.
 Technical Manual.

P a g e 22 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

The User Manual provides the user with the complete information on how to operate the program, and what needs
to be done when the user encounters a problem while using the program.

The Technical Manual contains the technical information about the program. This is necessary to provide users
technical details of the program, and what to do when the system is not working as supposed or requires
modifications.

1.3 Taking a sample number to dry run the above two algorithms

Fibonacci series Algorithm (pseudo code)

 ALGORITHM Fibonacci(n)

1. Initialize:

F0 = 0

F1 = 1

2. IF n = THEN

Return F0

3. ELSE IF n = 1 THEN

Return

4. ELSE

FOR I = 2 TO n DO

Fn = n-1 + F n-2

ENDFOR

5. Return Fn

P a g e 23 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

 Factorial Algorithm (pseudo code)

ALGORITHM Factorial(n)
1. Initialize result = 1
2. IF n = 0 THEN
Return 1
3. ELSE
FOR i = 1 TO n DO
result = result * i
ENDFOR

4.Return result

 Dry Run

Fibonacci Dry Run (for n=5):

```

F0 = 0, F1 = 1

i=2: F2 = F1 + F0 = 1 + 0 = 1

i=3: F3 = F2 + F1 = 1 + 1 = 2

i=4: F4 = F3 + F2 = 2 + 1 = 3

i=5: F5 = F4 + F3 = 3 + 2 = 5

‘’’

Final Output: 5

Factorial Dry Run (for n=4):

P a g e 24 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

```

n=4

Iteration 1: result = 1 * 1 = 1

Iteration 2: result = 1 * 2 = 2

Iteration 3: result = 2 * 3 = 6

Iteration 4: result = 6 * 4 = 24

```

Final Output: 24

1.4 Examining what Big -O notation is and explaining its role in evaluating efficiencies of algorithms

1.4.1 Examining what Big-O notation is

Imagine you’ve written a program, and it’s working fine, but you start to notice it’s running slower with more
data. This is where Big O Notation comes into play. It’s like a mathematical microscope that lets us peek into our
algorithms and see how they perform as the size of input data grows.

Big O Notation is a way to express the worst-case scenario of an algorithm’s running time or space used, in terms
of the size of the input data. It’s like measuring the thirstiness of a car based on how much gas it guzzles as the
journey gets longer.

• Linear search: this is the simplest method to search a data set.

Example: Linear Search in an Unsorted List

Why? In the worst case, you might have to look through each element in the list to find what you’re searching for.
So, if your list has ’n’ elements, in the worst case, you’ll make ’n’ comparisons.

• Bubble sort: this is simpler than linear search and binary search. It orders the numbers in
ascending order. For example, if we have a set of numbers that are not ordered, bubble sort

P a g e 25 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
lOMoARcPSD|45372092

compares the first two numbers and if the first number is greater than the second, then it swaps
positions where the smaller number comes to the first position. Then it moves to the second
position a compares it with the third number, if it is larger than the third it swaps place where
the second
becomes smaller than the third. This process keeps on happening till there is

nothing to compare and all the numbers are in ascending order. (Anon., n.d.)

 Binary search: Example: Binary Search in a Sorted Array

Why? Each step in binary search halves the number of elements to check. So instead of looking through ’n’ items,
you’re only looking through log₂(n) items. This makes the search extremely efficient as the size of the dataset
grows.

 Fibonacci Sequence (Recursive)

Example: Recursive Calculation of Fibonacci Numbers

Why? Each Fibonacci number is the sum of the two preceding ones. With a naive recursive approach, the
number of operations doubles for each additional element. This exponential growth makes it impractical for
large ‘n’.

P a g e 26 | 51 A.A. JASHAB AHAMAD/E194215


PROGRAMMING UNIT - 01
1.4.2 Python program code for the above two algorithms

1. Python program code Fibonacci series Try 1)

def. Fibonacci (n):


if n == 0: return 0
elif n == 1: return 1
elif n == 2: return 1
else:
i = int (input ("Number: ")) #User input

#declaring variables x = 0 y = 1 c = 0 z = 0

#checking validity if i < 0:

Print ("Invalid input") #Fibonacci 0 = 0 elif i == 0:

Print ("answer =", i) #Fibonacci 1 = 1 elif i == 1:

Print ("Fibonacci series = ", x, y)


#Fibonacci 2 = 1 elif i== 2: print ("Fibonacci series = ", x, y, y)
#Fibonacci series from 3 onwards else:
print("Fibonacci series ") while c <= i: print(x)z=x+yx=yy=z

P a g e 27 | 51
A.A.JASHAB AHAMAD
/E194215
PROGRAMMING UNIT - 01
2. Python program code factorial value
def factorial(n):
result = 1
for i in range (1, n+1):
result *= i
return result

# Testing the functions


Print (Fibonacci (5)) # Output: 5
print (factorial (4)) # Output: 24
```

pg. 28 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
Activity 02

2.1.1 Programming Paradigm

1) Programming paradigm

Programming paradigm is a style of programming which has characteristic features. These


are the foundations on which programming languages are designed and implemented. Some
languages can be classified into multiple paradigms. Some paradigms are concerned mainly
based on execution model of the language. Other paradigms are concerned mainly with the
way that code is organized. Others are concerned mainly with the style of syntax and
grammar.

2) Main characteristics of

 Procedural paradigm – Fortran, Algol, Pascal, Basic,C


 Synonym - Structured programming, imperative
programming  It is closely connected to von Neumann
architecture.
• Computer uses reusable memory.
• Executes instructions one after the other. Uses sequence, Selection, Repetition. (Control
Flow)
• Programs run by changing the state of the machine via Assignment.

• Can be translated to machine language successfully and quickly.

• Data is passive, Procedures are active.

pg. 29 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
• Structured programming has two added features. No GOTOs, Variables have lexical
scope due to modules.
Advantages of procedural paradigm

• Coding is easy and simple.


• The same codes can be reused in different parts of the program.

• Programming paradigm take less memory on the computer

• Tracking the flow of codes is easy.

• The programming paradigm is best for to learning and implementing general


programming.

Disadvantages of procedural paradigm

• It is focused on functions and not data.

• It is hard to find what belongs to global data in a large program.

• When maintaining and enhancing, the use of global data is an obstacle.

• To modify global data, functions used by it also have to be modified.

As functions are action oriented, the procedural programming paradigm does not model
real-world problems well.

 Object Oriented paradigm – Python, Java, C++, C#


 Each object has their own attribute and their own
behavior.
• Programs are represented as a group of objects.

• Classes are the collection of Objects and these classes are arranged in Hierarchy.

• Sub classes inherits features from Super classes.

pg. 30 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
• Data is combined with procedures to give objects.

 Event driven paradigm – C#

 The flow within the program is driven by events such as user actions, mouse clicks, key
presses, messages from other programs, or hardware inputs.

3) Relationships among Procedural, Object Oriented and Event driven paradigm

These three paradigms are not related hierarchically, but in common usage they are mostly
nested within one another. Procedural programming can be used to create an event-driven
system. Also, Object oriented programming can be used to create an event-driven system.

Because procedural programming isn't a great fit for data-sensitive projects, some
professionals choose to use object-oriented programming instead. Object-oriented
programming functions with the idea that each sequence within a code should be self-
sustainable. Because of this, object-oriented programming can offer a code that operates
similarly to procedural programming but features steps that are each self-sustained,
working both independently and in conjunction with other tasks. In order to choose
whether to use procedural programming or object-oriented programming, you may want to
consider these differences: Data: Object-oriented programming uses mutable data, while
procedural programming uses immutable data. This means that when using object-oriented
programming, professionals can modify data after its creation within the code.

Parallel programming: Parallel programming describes a process in which the code completes
different tasks simultaneously. Object-oriented programming isn't suitable for parallel
programming, which procedural programming can support.

Flow control: In procedural programming, function calls control the flow of the code. In
object-oriented programming, conditional statements and loops control the flow.

Execution order: In procedural programming, the order in which the tasks finish isn't
important. Inversely, object-oriented programming prioritizes execution order.

pg. 31 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
Creation: Object-oriented programming can take longer to complete, as each task within
object-oriented programming is self-sufficient. Because procedural programming is much
simpler, professionals can complete projects faster. (Indeed, 2022)

4) Example code snippets


 Procedural paradigm

Factorial value of any number by using c++ language:

Using namespace std;

Int main()

int I, fact = 1, num; cout <<


“Enter any number :”; cin >>
num;
for (i = 1; i <= num; i++)
{ fact = fact * i;
}

cout << “Factorial value of” << num << “is:” << fact << endl;
return 0;

figure 3 (procedural
programming for
factorial value of any
number )

pg. 32 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
 Object Oriented paradigm - Python
class Plants: varCount = 0
shop = “Green Gardens”

def __init__ (self, name, Height, number):

self.name = name
self.Height = Height
self.number = number
plants.varCount += 1

def dispPlants(self):

print (“Company:”, Plants. Shop)


print (“List of available Plant:”)
print (“Name:”, self.name)
print (“Height:”, self. Height, “cm”)
print (“Number of”, self.name, “Plant:”, self. number)
var1 = Plants (“Anturium”, 45, 12) var2 = Plants
(“Snake”, 35, 23) var3 = Plants (“Cactus”, 17, 25)
var1.dispPlants() var2.dispPlants() var3.dispPlants()
print (“Total varieties =”, Plants. varCount)

Figure 4 (Example code of Object Figure 5 (OOP function output)

pg. 33 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
Oriented programming)

 Event Driven programming – C# private void


ClickmeBtnClick (object sender, EventArgs e)
{

MessageBox.Show (“Welcome to Esoft !”, “Welcome”,

MessageBoxButtons.OK, MessageBoxIcon.Information);

Figure 6 (Example code of Event driven Figure 7 (Input and


Output of Event Driven
programming) programming)

pg. 34 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
Activity 3
Grifindo Lanka Toys LEAVE MANAGEMENT SYSTERM WELCOME FORM

Figure 8

Manage leave form

Figure 9

pg. 35 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
Manage Categories form

Figure 10

Database SQL Server connect

Figure 11

User Design in sql

pg. 36 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
Figure 12

Leave Management Employees Table

Figure 13

Leave management table

pg. 37 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
Figure 14

Login form & Code for login Button

Figure 15

pg. 38 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
Debugging Features available in Visual Studio IDE Debugging
process:
debugging is a method used by computer programmers to test their code and find out that
they have solved the problem or not. If something wrong, they can use debugging to find
where it's going wrong so they can fix their code.

Integrated Development Environment (IDE)

An integrated development environment (IDE) is a software suite that consolidates basic


tools required to write and test software.

Developers use numerous tools throughout software code creation, building and testing.
Development tools often include text editors, code libraries, compilers and test platforms.
Without an IDE, a developer must select, deploy, integrate and manage all of these tools
separately. An IDE brings many of those development-related tools together as a single
framework, application or service. The integrated toolset is designed to simplify software
development and can identify and minimize coding mistakes and typos.
Some IDEs are open source, while others are commercial offerings. An IDE can be a
standalone application or it can be part of a larger package.

Benefits Of Visual Studio IDE

Squiggles and Quick Actions

Squiggles are wavy underlines that alert you to errors or potential problems in your code
as you type. These visual clues help you fix problems immediately, without waiting to
discover errors during build or runtime. If you hover over a squiggle, you see more
information about the error. A lightbulb might also appear in the left margin showing
Quick Actions you can take to fix the error.

Code Clean-up

With the click of a button, you can format your code and apply any code fixes suggested
by your code style settings. editorconfig conventions, and Roslyn analysers. Code Clean-

pg. 39 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
up, currently available for C# code only, helps you resolve issues in your code before it
goes to code review.

Refactoring

Refactoring includes operations such as intelligent renaming of variables, extracting one


or more lines of code into a new method, and changing the order of method parameters.

IntelliSense

IntelliSense is a set of features that display information about your code directly in the
editor and, in some cases, write small bits of code for you. It's like having basic
documentation inline in the editor, so you don't have to look up type information
elsewhere.

Visual Studio search

Visual Studio menus, options, and properties can seem overwhelming at times. Visual

Studio search, or Ctrl+Q, is a great way to rapidly find IDE features and code in one
place.

Live Share

Collaboratively edit and debug with others in real time, regardless of your app type or
programming language. You can instantly and securely share your project. You can also
share debugging sessions, terminal instances, localhost web apps, voice calls, and more.)

Call Hierarchy

The Call Hierarchy window shows the methods that call a selected method. This
information can be useful when you're thinking about changing or removing the method,
or when you're trying to track down a bug.

pg. 40 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
CodeLens

CodeLens helps you find code references, code changes, linked bugs, work items, code
reviews, and unit tests, without leaving the editor.

Go To Definition

The Go To Definition feature takes you directly to the location of a function or type
definition.

Peek Definition

The Peek Definition window shows a method or type definition without opening a
separate file.
Visual programming

Visual programming can be a usage scenario that generally requires a dedicated IDE.
Visual Basic enables users to create new applications by moving programming, building
blocks, or nodes of code to create flowcharts or structure diagrams that are squared and
then compiled or applied. Square Measure supported the uniform modelling language.
This interface has become popular with Lego Mind's Storm system and is actively
pursued by a variety of companies who wish to take full advantage of custom browser
features such as those offered by Mozilla. KTechlab supports flow code and can be a
modern open-source IDE and package development machine for microcontrollers. Visual
programming is also responsible for the simplicity of distributed programming (see
LabVIEW and EICASLAB software). One of the earliest visual programming systems,
Max, was statuesque when it comes to the analog synthesizer style and has been used to
create vintage music performance packages since the 1980s. The first example was
Paragraph, a stream-based system originally developed for the Macintosh. The graphic
programming environment "Grape" is used to program fix gear units. This approach is
also used in specialized packages like Open Lab, where suggestion users want the
flexibility of a full artificial language, but not the normal learning curve that comes with
it.

pg. 41 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
Activity 04

Login Form

Figure 16

Login page coding.

pg. 42 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
Login Successful leave management form.

Figure 17

Leave management system cording.

pg. 43 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
.

Figure 18

Leave categories

Figure 19

Show leaves coding.

pg. 44 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
Figure 20

Delete button cording

pg. 45 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
Figure 21

Successful delete button work

Figure 22

Edit button coding.

pg. 46 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
Figure 23

Save button coding.

Figure 24

pg. 47 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
Successful save button

Figure 25

pg. 48 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
Leave lists

Figure 26

Exit button coding.

pg. 49 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
Figure 27

Coding Standard

Coding Standards I have used in my application development:

• Coding standards provide guidelines for programmers regarding naming, file


organization, statements and declarations and layout comments.
• General rules I have followed in my application development are:

i. Explicit is better than implicit

ii. Simplicity is always better than functionality

iii. Beautiful is better than ugly iv. Readability counts


v. Make sure anybody can fix anything.

• For naming I have followed the General naming guidelines. Example: for variables,
methods, packages – lower case with underscores.
• To build a good code I have avoided one letter names, redundant labelling, getter and
setter methods.
• One statement per line

• Parentheses for line continuations.

• Above Figure 21, 22, 23

Why coding standards is necessary for the team as well as for the individual:

Building the code quality standards reduces many problems and the risk of project failures.

pg. 50 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01
Typical_ real world projects are developed and maintained by teams of developers.
Particularly in the context of open - source projects, code is shared, updated, and merged by
many individuals across organizations and geographies. Naming conventions are therefore
important. If everyone does everything the same way then everything is more predictable and
organized. Therefore, coding standards is necessary for the team as well as for the individual.

pg. 51 A.A.JASHAB AHAMAD /E194215


PROGRAMMING UNIT - 01

You might also like