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

Unit-01 Programming Assignment - CRDS - Final

Uploaded by

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

Unit-01 Programming Assignment - CRDS - Final

Uploaded by

ChampR De Silva
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 72

Higher Nationals

Internal verification of assessment decisions – BTEC (RQF)


INTERNAL VERIFICATION – ASSESSMENT DECISIONS
Programme title Higher National Diploma in Computing
Mr. Lasitha Ranawaka
Assessor Internal
Verifier
01
Unit(s)
Design & Implement a GUI based system using a suitable IDE
Assignment title
M S Chamara Rasanjana De Silva
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
accurately? Y/N

Is the feedback to the student:


Give details:
• Constructive?
• Linked to relevant assessment criteria?
Y/N
• Identifying opportunities for
Y/N
improved performance?
Y/N
• Agreeing actions?
Y/N
Does the assessment decision need
amending? Y/N

Assessor signature Date

Internal Verifier signature Date


Programme Leader signature (if required)
Date
Confirm action completed
Remedial action taken

Give details:

Assessor signature Date


Internal Verifier
signature Date

Programme Leader
signature (if required) Date
Higher Nationals - Summative Assignment Feedback Form
Student Name/ID M S Chamara Rasanjana De Silva / 00209338
Unit Title UNIT_01 - Programming
Assignment Number 01 Assessor Mr. Lasitha Ranawaka
20 Jan 2024 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 analysis of a suitable 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:

* Please note that grade decisions are provisional. They are only confirmed once internal and external moderation has taken place and
grades decisions have been agreed at the assessment board.
Assignment Feedback
Formative Feedback: Assessor to Student

Action Plan

Summative feedback

Feedback: Student to Assessor

Assessor Date
signature
Chamara.rasanjana@hotmail.c
Student om Date
signature

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.
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: Chamara.rasanjana@hotmail.com Date: 20 Jan 2024


(Provide E-mail ID) (Provide Submission Date)
Higher National Diploma in Computing
Assignment Brief
Student Name /ID Number M S Chamara Rasanjana De Silva / 00209338

Unit Number and Title Unit 01: Programming

Academic Year 2021/22

Unit Tutor

Assignment Title Design &Implement a GUI based system using a


suitable Integrated Development Environment

Issue Date 04 Nov 2023

Submission Date 20 Jan 2024

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

LO3. Implement basic algorithms in code using an IDE.

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


coding standard
Assignment Brief and Guidance:

Activity 1

A. The Fibonacci numbers are the numbers in the following integer sequence.
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ……..

In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence


relation.

Fn = F n-1 + F n-2

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

2.1 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 Toys is a small-scale Toy building company which is located in United Kingdom
(UK) and currently they have 50 employees working at their headquarters. They are looking
for a simple payroll system to calculate the salaries of their employees and you are hired as a
freelance software developer to build their payroll system.
Specifications for the payroll system as follows,

Grifindo Toys Payroll System mainly contains five components and the specifications for the
components are follows,
1. Employee Component.
 Admin should be able to register employee details to the system (including
monthly salary, overtime rates-hourly, allowances).
 Admin should be able to update all employee details in the system (Update and
Delete including monthly salary, overtime rates-hourly, allowances).
 Admin should be able to view individual employee details, view all employees
details, search employees.
2. Salary Component

Admin should be able to input the date range to calculate the salary. Salary cycle
begin date and the end date should be given to calculate the monthly salary.
Salary cycle begin date and end date will be defined in the settings component
and if the user enters something else the system should display an error message.

The admin should be able to enter the no of leaves an employee has taken with
number of absent days, no of holidays for the given date range. If an employee
has worked any overtime hours the admin should be able to enter that also when
calculating the Base pay value.
Base Pay need to calculate based on the following points,

Base Pay (Monthly Salary: salary_cycle_date_range, eg: 30 days): Each


employee will be paid monthly
If any employee couldn’t cover salary_cycle_date_range (eg:-30 days) attendance
the system should calculate the no-pay value according to the below mention
formula,

No-pay-value = (Total_Salary/salary_cycle_date_range)
*No_of_absent_days
Base Pay need to calculate according to the below mentioned formula

Base Pay value = Monthly_Salary + Allowances +


(Over_time_rate*no_of_overtime_hours)
Gross Pay need to calculate according to the below mentioned formula

Gross Pay = Base_Pay_value – (No_pay_value +


Base_Pay_value*government_tax_rate)

All the calculated No-pay-value, Base-pay-value and Gross pay value should
record in the database under each employee for each month. This component
should generate reports such as monthly salary report for an employee, overall
salary summary for couple of months for an employee, No-pay-value, base-pay-
value, and gross pay value of all the employees for a given month range.

3. Settings Component
This component should allow the admin to change parameter values such as
i. Date Range for a salary cycle. Eg:- 30 days
ii. Salary cycle begin date
iii. Salary cycle end date
iv. No of leaves for an employee for a year.
Activity 3

Write the complete pseudocode for the salary component of the above system (report
generation is not needed). Use the visual studio IDE (using C#.net) to implement the
above three components. Ideally there should be three separate classes for the above
three components 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.
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
2.1 Design and build a small GUI system for the above scenario and it should be a complete
functional system with all the functions which has described in the above scenario with the
database structure which has designed in activity 3.
2.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.

2.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.
Grading Rubric

Grading Criteria Achieved Feedback

LO1 Define basic algorithms to carry out an operation


and outline the process of programming an
application.

P1 Define an algorithm and outline the process in building an


application

P2 Determine the steps taken from writing code to


execution.

M1 Analyse the process of writing code, including the


potential challenges faced.
D1 Evaluate the implementation of an algorithm in a suitable
language and the relationship between the written algorithm
and the code variant

LO2 Explain the characteristics of procedural, object


orientated and event-driven programming

P3 Discuss what procedural, object orientated and event


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

M2 Compare the procedural, object-orientated and event


driven paradigms used in given source code of an application

D2 Critically evaluate the source code of an application that


implements the procedural, object-orientated and event-
driven paradigms, in terms of the code structure and
characteristics.
LO3 Implement basic algorithms in code using an IDE.

P4 Write a program that implements an algorithm using an


IDE.

M3 Enhance the algorithm written, using the features of


the IDE to manage the development process.

D3 Evaluate the use of an IDE for development of


applications contrasted with not using an IDE.

LO4 Determine the debugging process and explain


the importance of a coding standard
P5 Explain the debugging process and explain the
debugging facilities available in the IDE.

P6 Explain the coding standard you have used in your code.

M4 Examine how the debugging process can be used to


help develop more secure, robust applications.

D4 Evaluate the role and purpose of a coding standard and


why it is necessary in a team as well as for the individual.
Pearson Higher Nationals in
Computing
Unit 01: Programming
Assignment 01

0|Page
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
Contents
1. Activity 1.................................................................................................................7
1.1. Algorithm: Definition, How Does It Work, Types, Characteristics.......................7
1.1.1. Definition of Algorithm...............................................................................7
1.1.2. How do algorithms work?...........................................................................7
1.1.3. Types of Algorithms..................................................................................10
1.1.4. key Characteristics of Algorithms.............................................................10
1.2. Fibonacci Sequence: Definition, What is it?, How it Works, and How to Use It.
12
Definition:..................................................................................................................12
1.2.1. What is it?.................................................................................................12
1.2.2. Pseudocode for Fibonacci Series up to (n) numbers:................................14
1.2.3. Python Code for Fibonacci series and the result.......................................15
1.2.4. Fibonacci Dry Run:....................................................................................16
1.3. What is a Factorial?..........................................................................................16
1.3.1. Pseudocode for Factorial of a number:.....................................................17
1.3.2. Python Program to Find the Factorial of a Number..................................18
1.3.3. Factorial Dry Run:.....................................................................................19
1.4. Big-O Notation (how code slows as data grows):.............................................19
1.4.1. Common Big-O Notations:........................................................................20
1.4.2. Python program to calculate the 5th Fibonacci number using recursion: 21
1.4.3. Python program to calculate the factorial of a number recursive method:
22
2. Activity 2...............................................................................................................23
2.1. Programming Paradigms..................................................................................23
2.1.1. Definition..................................................................................................23
2.1.2. Procedural Programming (PP)..................................................................24
2.1.3. Object-Oriented Programming (OOP).......................................................26

1|Page
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
2.1.4. Event-Driven Programming......................................................................28
The relationships among procedural, object-oriented, and event-driven paradigms
.................................................................................................................................. 31
3. Activity 03.............................................................................................................35
3.1. Pseudocode for the salary component.............................................................35
3.2. Database structure...........................................................................................38
3.3. Analysis of IDE features and Evaluation of Visual Studio IDE............................41
4. Activity 04.............................................................................................................43
4.1. Design and build a small GUI system for the above scenario and it should be a
complete functional system with all the functions which has described in the above
scenario with the database structure which has designed in activity 3........................43
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.............................................51
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...............................................................................................53
5. References............................................................................................................56

2|Page
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
1 what is an algorithm..........................................................................................................7
2 Here is a simple Python implementation of the described algorithm:..............................8
3 Fibonacci Sequence.........................................................................................................12
4 Diagram showing the first 10 Fibonacci numbers:.........................................................13
5 Pseudocode for Fibonacci Series.....................................................................................14
6 Python Code for Fibonacci series....................................................................................15
7 First few factorial values.................................................................................................17
8 Pseudocode for Factorial.................................................................................................17
9 Python Program to Find the Factorial of a Number........................................................18
10 Big O notation examples(complexity)..........................................................................21
11 Programming Paradigms...............................................................................................23
12 Code Example (in Python): Procedural Programming..................................................25
13 Code Example (in Python): Object-Oriented Programming.........................................27
14 Code Example (in Python): Event-Driven Example.....................................................29

15 Database Diagram.........................................................................................................39
16 Login Page.....................................................................................................................44
17 Component....................................................................................................................44
18 Employee Salary............................................................................................................45
19 Add Salary.....................................................................................................................46
20 Delete code....................................................................................................................47
21 Saman’s Salaray Issue...................................................................................................48

3|Page
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
Acknowledgement

During the assignment, I deeply appreciate the help and guidance from various
individuals.

I'd like to thank our Module lecturer at ESOFT Metro Campus for their continuous
support and guidance. Their unwavering assistance and numerous discussions
significantly improved the quality and direction of this assignment. I also want to
acknowledge the contributions of all those who, whether directly or indirectly, offered
their guidance and support during the writing process. Their combined influence played
a vital role in completing this work.

A special mention goes to Mr. Lasitha Ranawaka, whose mentorship and insights were
exceptionally valuable in enhancing the content and quality of this assignment. I'm
grateful for the support I received for this assignment, and I want to thank everyone who
contributed to its successful completion.

4|Page
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
1. Activity 1
1.1. Algorithm: Definition, How Does It Work, Types, Characteristics

1.1.1. Definition of Algorithm

The word Algorithm means “A set of finite rules or instructions to be followed in


calculations or other problem-solving operations.”
Or
“A procedure for solving a mathematical problem in a finite number of steps
that frequently involves recursive operations”.

Simply put, an algorithm is a step-by-step solution to a particular problem.

1.1.2. How do algorithms work?

Algorithms leverage an initial set of data or input, navigate through a sequence of


logical steps or rules, and generate the output, representing the outcome, decision, or
result.

1 what is an algorithm.

Imagine you're writing a shopping list. The items you want to buy (input) are listed, and
you follow a set of steps (process) to pick them up at the store. The result is your
completed shopping, similar to the output of an algorithm.

5|Page
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
Algorithms are eventually stated in a programming language that a computer can
process. However, when an algorithm is being Invented, it will be people, not a
computer, who will need to understand it. For this reason, as a first step, algorithms are
written as plain instructions.

Example of an algorithm:
Let’s consider for example an algorithm that calculates the square of a given number.

 Input: the input data is a single-digit number (e.g., 10).


 Processing: the algorithm takes the input (number 10) and performs the specific
operation (i.e., multiplies the number by itself).
 Output: the answer of the calculation is the square of the input number, in this case,
would be 100 (since 10 * 10 = 100).
2 Here is a simple Python implementation of the described algorithm:

When you run this code, it will output:

We could express this as an algorithm in the following way:

6|Page
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
Algorithm: Calculate the square of a number
1. Start.
2. Input the number (N) whose square you want to find.
3. Multiply the number (N) by itself.
4. Store the result of the multiplication in a variable (result).
5. Output the value of the variable (result), which represents the
square of the input number.
6. End.

An algorithm shows how to solve a problem in a clear and precise way, focusing on the
process, not the answer.
It is important to keep in mind that an algorithm is not the same as a program or code. It
is the logic or plan for solving a problem represented as a simple step-by-step
description. Code is the implementation of the algorithm in a specific programming
language (like C++, C# or Python), while a program is an implementation of code that
instructs a computer on how to execute an algorithm and perform a task.

Instead of telling a computer exactly what to do, some algorithms allow computers to
learn on their own and improve their performance on a specific task. These machine
learning algorithms use data to identify patterns and make predictions or conduct data
mining to uncover hidden insights in data that can inform business decisions.

Broadly speaking, there are three different types of algorithms:

7|Page
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
1.1.3. Types of Algorithms

 Linear sequence algorithms follow a specific set or steps, one after the other. Just like
following a recipe, each step depends on the success of the previous one.

 Conditional algorithms decide between two actions. Instead of executing all steps
sequentially, a conditional algorithm involves making choices based on specific
scenarios or input data. It uses “if/then” statements to determine what to do.

For example, in the context of a cake recipe, you would include the step “If the dough is
too sticky, you might need to add more butter.”

 Looping algorithms repeat a specific set of instructions of multiple types until either a
certain condition is met, or a predefined number of repetitions has been completed.
The purpose of looping algorithms is to efficiently perform repetitive tasks without
the need to write the same instructions multiple times.

For example, a looping algorithm could be used to handle the process of making
multiple cakes from a single batch of mixture. The algorithm would repeat a specific set
of instructions to form and bake cakes until all the mixture has been used.

1.1.4. key Characteristics of Algorithms

8|Page
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
A good algorithm should possess several key characteristics, including correctness (it
produces the expected output for all possible inputs), efficiency (it solves the problem in a
timely and resource-optimal manner), clarity (easy for developers to understand and
implement), and generality (adaptable to different problem instances or scenarios).

Here are some key characteristics of algorithms:


 Efficiency: A good algorithm should perform its task quickly and use minimal
resources.
 Correctness: It must produce the correct and accurate output for all valid inputs.
 Clarity: The algorithm should be easy to understand and comprehend, making it
maintainable and modifiable.
 Scalability: It should handle larger data sets and problem sizes without a significant
decrease in performance.
 Reliability: The algorithm should consistently deliver correct results under different
conditions and environments.
 Optimality: Striving for the most efficient solution within the given problem
constraints.
 Robustness: Capable of handling unexpected inputs or errors gracefully without
crashing.
 Adaptability: Ideally, it can be applied to a range of related problems with minimal
adjustments.
 Simplicity: Keeping the algorithm as simple as possible while meeting its
requirements, avoiding unnecessary complexity.

9|Page
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
1.2. Fibonacci Sequence: Definition, What is it?, How it Works, and How to Use
It.

Definition: In mathematics, the Fibonacci


sequence is a sequence in which each
number is the sum of the two preceding
ones. Numbers that are part of the
Fibonacci sequence are known as
Fibonacci numbers, commonly denoted
Fn . The sequence commonly starts from 0
and 1, although some authors start the 3 Fibonacci Sequence
sequence from 1 and 1 or sometimes (as did Fibonacci) from 1 and 2. Starting from 0 and
1, the first few values in the sequence are.

1.2.1. What is it?

The Fibonacci Sequence is a sequence of numbers in which a given number is the result
of adding the 2 numbers that come before it. Adding the previous 2 numbers some
number of times forms a series that we call the Fibonacci Series.

The Fibonacci sequence starts with two numbers, that is 0 and 1. Then every following
number is made up of adding the previous two numbers together.

For example, take 0 and 1. They're the first two numbers in the sequence. If you add them
together, you get 1. So, the sequence starts 0, 1, 1, ...

Then, to find the next number, you add the last number you have and the number before
it. So, 1+1 = 2. So, the sequence so far is 0, 1, 1, 2, ... Make sense?
10 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
We can represent this more mathematically like 0, 1, (1) - [0 + 1]. Similarly, the next
Fibonacci number is - 0, 1, 1, (2) - [1 + 1]. And so on. Here's a diagram showing the first
10 Fibonacci numbers:

4 Diagram showing the first 10 Fibonacci numbers:

This is an example of a Fibonacci series – 0, 1, 1, 2, 3, 5, 8, 13, 21, 34. Within this


continuous sequence, every individual number is a Fibonacci number.

Mathematically, the Fibonacci Sequence is represented by this formula:

F(n) = F(n-1) + F(n-2), where n > 1.


We can use this sequence to find any nth Fibonacci number.

The Fibonacci numbers were first described in Indian mathematics, as early as 200 BC in
a work by Pingala on enumerating possible patterns of Sanskrit poetry formed from
syllables of two lengths. They are named after the Italian mathematician Leonardo of
Pisa, also known as Fibonacci.

11 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
1.2.2. Pseudocode for Fibonacci Series up to (n) numbers:

5 Pseudocode for Fibonacci Series

If a user enters the value 5, it assigns this value to 'n.' Two variables, 'a' and 'b,' are
initialized to 0 and 1, respectively. In the initial step (Step 5), the program prints the
values of 'a' and 'b,' resulting in the following output up to this point: 0 1

In Step 6, 'i' is set to 2 because the first two numbers (0 and 1) have already been
printed. In each iteration of 'i,' the program calculates the sum of 'a' and 'b' and assigns it
to 'c.' This value of 'c' is then printed, extending the output as follows: 0 1 1

In Step 6.3, we move the 2nd last value (which is stored in variable "b") to the variable
"a" and the last value (which is stored in variable "c") to b. So Now: a=1, b=1

In Step 6.4, 'i' is incremented by 1 (i.e., 'i' is updated as 'i=i+1'), and the iteration
continues until 'i' is less than the user-entered number 'n.'

For 'i=3,' following the same steps 6.1 to 6.4, the output becomes 0 1 1 2

For i=4, Again following steps 6.1 to 6.4, the Output will be: 0 1 1 2 3
12 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
So, for i=5, Again following steps 6.1 to 6.4, Output will be: 0 1 1 2 3 5

For i=6, condition i less than n becomes false as (6<=5) is false. Hence the Final Output
will be: 0 1 1 2 3 5

1.2.3. Python Code for Fibonacci series and the result

6 Python Code for Fibonacci series

13 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
1.2.4. Fibonacci Dry Run:
n=5
Iteration 1: a = 0, b = 1, next = 1
Iteration 2: a = 1, b = 1, next = 2
Iteration 3: a = 1, b = 2, next = 3
Iteration 4: a = 2, b = 3, next = 5
Iteration 5: a = 3, b = 5, next = 8
Final output: Fibonacci (5) = 5

1.3. What is a Factorial?

The factorial of a number is the multiplication of all the numbers between 1 and the
number itself. It is written like this: n!. Well, the factorial of 2 is 2! (= 1 × 2).

To calculate a factorial, you need to know two things:

0! = 1
n! = (n - 1)! × n

The factorial of 0 has value of 1, and the factorial of a number n is equal to the
multiplication between the number n and the factorial of n-1.

For example, 5! is equal to 4! × 5.

Here the first few factorial values to give you an idea of how this works:

14 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
7 First few factorial values

1.3.1. Pseudocode for Factorial of a number:

8 Pseudocode for Factorial

Declare two integer variables, N and F: These variables will be used to store the input
number and the factorial result, respectively.
Initialize F to 1: At the start, set the factorial variable F to 1. This will serve as the
initial value.
Prompt for user input: Request the user to input a value for N, the number for which
you want to compute the factorial.
Check if N is greater than 0: Verify whether the value of N is greater than zero. If it's
not, proceed with setting F to 1, as the factorial of non-positive numbers is 1.
15 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
If N is greater than 0, calculate the factorial: When N is indeed greater than zero,
enter a loop where you repeatedly multiply the current F by N and decrement N by 1.
Repeat the multiplication and decrement until N reaches 0: Continue performing the
multiplication and decrementing N by 1 until N becomes zero. This loop ensures the
accumulation of the factorial value.
Display the calculated factorial value, F: After the loop concludes, you will have
successfully calculated the factorial of the input number N. Display the value of F,
which represents the factorial of the given number.
1.3.2. Python Program to Find the Factorial of a Number

9 Python Program to Find the Factorial of a Number

1.3.3. Factorial Dry Run:


n=5
Iteration 1: result = 1
16 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
Iteration 2: result = 1 * 1 = 1
Iteration 3: result = 1 * 2 = 2
Iteration 4: result = 2 * 3 = 6
Iteration 5: result = 6 * 4 = 24
Final output: Factorial (5) = 120

1.4. Big-O Notation (how code slows as data grows):

Big-O notation is a mathematical way to assess and compare the efficiency of


algorithms. It helps us understand how the time or space requirements of an algorithm
change as the size of the input data increases.

In Big-O notation, we primarily focus on the worst-case scenario, which means we're
interested in how an algorithm performs when dealing with the largest possible input. It
provides an upper limit on the resource (time or space) consumption, enabling us to
make informed decisions about which algorithm to use.

For instance, if an algorithm has a time complexity of O(n), it means that as the input
size (denoted as 'n') grows, the time required to execute the algorithm increases linearly.
If an algorithm has a time complexity of O(n^2), the time required grows quadratically
with the input size.

Big-O notation plays a vital role because it allows us to compare different algorithms
and choose the most efficient one for a specific problem. It aids in making trade-offs
between time and space efficiency. By analyzing Big-O notations, we can determine
which algorithm will perform better for larger datasets and optimize our code
accordingly.
1.4.1.Common Big-O Notations:

17 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
Here are some common Big-O notations and a brief explanation of their meanings:

O(1): Constant time complexity. The algorithm's runtime is not dependent on the input
size, making it very efficient.
O(log n): Logarithmic time complexity. The algorithm's runtime grows slowly as the
input size increases.
O(n): Linear time complexity. The algorithm's runtime grows linearly with the input
size.
O(n log n): Linearithmic time complexity. The algorithm's runtime is slightly better
than linear but still grows relatively slowly with increasing input size.
O(n^2): Quadratic time complexity. The algorithm's runtime grows quadratically with
the input size, which can be inefficient for large inputs.
O(2^n): Exponential time complexity. The algorithm's runtime grows very quickly with
the input size and is highly inefficient for large inputs.
O(n!): Factorial time complexity. The algorithm's runtime grows at an extremely rapid
rate and is generally considered highly inefficient for practical use.

By understanding and using Big-O notation, developers and computer scientists can make
informed choices about which algorithms to use, anticipate potential performance
bottlenecks, and work towards more efficient solutions for a wide range of computational
problems.

18 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
If we plot the most common Big O notation examples, we will have a graph like this:

10 Big O notation examples(complexity)

1.4.2. Python program to calculate the 5th Fibonacci number using


recursion:

Efficiency Analysis:
Time Complexity: (Big-O): O(n)
Space Complexity: O(n) due to the memoization dictionary

19 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
1.4.3. Python program to calculate the factorial of a number recursive
method:

Efficiency Analysis:
Time Complexity (Big-O): O(n)
Space Complexity: O(n) due to the recursive call stack

Efficiency Analysis Summary:

 For the Fibonacci sequence, the recursive approach with memorization has a time
complexity of O(n) and a space complexity of O(n).
 For the factorial calculation, the recursive approaches have a time complexity of O(n).
However, the iterative approach has a constant space complexity of O(1), while the
recursive approach has a space complexity of O(n) due to the recursive call stack.

In summary, both the Fibonacci and factorial algorithms are quite efficient for small
inputs. However, the recursive approach for Fibonacci may face issues with stack depth
for very large values of n.

20 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
2. Activity 2

2.1. Programming Paradigms

2.1.1. Definition

A programming paradigm is a style, or “way,” of programming.

Programming paradigms help classify


programming languages based on their
unique features. This classification
allows languages to belong to multiple
paradigms.

Some paradigms focus on how a


language's code is executed, including
considerations like allowing side
effects or defining the order of 11 Programming Paradigms
operations. Others emphasize how code is structured, such as organizing code into units
that interact with program state. Some paradigms prioritize the style of a language's
syntax and grammar.

Here are some common programming paradigms:

Procedural: Imperative programming with procedure calls.


Object-Oriented: Programming by defining objects that send messages to each other.
Objects have their own internal (encapsulated) state and public interfaces. Object
orientation can be:
 Class-based: Objects get state and behaviour based on membership in a class.
 Prototype-based: Objects get behaviour from a prototype object.

Event-Driven: Programming with emitters and listeners of asynchronous actions.


Imperative: Programming with an explicit sequence of commands that update state.

21 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
Declarative: Programming by specifying the result you want, not how to get it.
Structured: Structured programming uses structured control flow constructs to improve
Logic (Rule-based): Programming by specifying a set of facts and rules. An engine infers
the answers to questions.
Constraint: Programming by specifying a set of constraints. An engine finds the values
that meet the constraints.
Aspect-Oriented: Programming cross-cutting concerns applied transparently.
Functional (Applicative): Programming with function calls that avoid any global state.
Reflective: Programming by manipulating the program elements themselves.

you're not limited to using only one programming paradigm exclusively within a single
program. It acknowledges that different parts of a program or different aspects of
solving a problem may be best suited to different paradigms.

We’ll focus on three main paradigms: Procedural, Object-Oriented, and Event-Driven and
discuss their characteristics and relationships.

2.1.2. Procedural Programming (PP)

It’s one of the foundational programming paradigms. Basically, procedural programming


revolves around a sequence of instructions given to the computer. These sequences of
instructions are known as procedures.

Characteristics:

 Emphasis on procedures/functions.
 Global variables are commonly used.
 Code is structured around functions that take input and return output.
 Modularity and reusability are key concepts.

22 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
12 Code Example (in Python): Procedural Programming

 Benefits of Procedural Programming:


 Simplicity: Procedural programming is easy to understand and code due to its
simple structure.
 Reusable Code: Functions can be reused within the program again and again.
This makes coding easier. It also reduces the length of the code and the time
needed to write the entire program.
 Easy Testability: The simplicity of procedural programming makes the code
easy to test and debug. The shorter program length and the use of reusable
code are great for quickly identifying sources of errors.
 General Programming: The procedural paradigm is great for general use and
for smaller projects.

 Limitations of Procedural Programming:


23 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
 Focused on Operations: Procedural programming focuses on functions and
procedures more than data. This method is unsuitable for projects where data
is important.
 No Data Security: Data is exposed and accessible to multiple procedures in
procedural programming. Thus, it is unsuitable for projects where we must
protect data.
 No Movability: With procedural programming, code can be reused within a
single project. However, they cannot be exported to other projects. So, we
need to rewrite a lot of code when working on other projects.

2.1.3. Object-Oriented Programming (OOP)

OOP is a computer programming model that organizes software design around data, or
objects, rather than functions and logic. An object can be described as a data field that
has unique attributes and behaviours.

An object is any entity that has attributes and behaviours. For example, a smartphone is
an object. It has:
 Attributes - brand, model, storage capacity, etc.
 Behaviours - making calls, sending messages, taking pictures etc.

Characteristics:

 Focus on classes and objects.


 Encapsulation, inheritance, and polymorphism are core principles.
 Code is organized around objects, promoting modularity and reusability.
 Data and behaviour are bundled within objects.

24 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
13 Code Example (in Python): Object-Oriented Programming

 Benefits of Object-Oriented Programming Programming:


 Modularity: Encapsulation enables objects to be self-contained, making
troubleshooting and collaborative development easier.
 Reusability: Code can be reused through inheritance, meaning a team does not
have to write the same code multiple times.
 Productivity: Programmers can construct new programs quicker using multiple
libraries and reusable code.
 Easily upgradable and scalable: Programmers can implement system
functionalities independently.
 Flexibility. Polymorphism enables a single function to adapt to the class it is
placed in. Different objects can also pass through the same interface.

25 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
 Limitations of Procedural Programming:
 Data Focus: It prioritizes operations over data, making it less suitable for data-
centric projects.
 Data Security: Data is exposed to multiple procedures, which can be
problematic for projects requiring data protection.
 Limited Code Mobility: Code reuse is confined to a single project,
necessitating code rewriting for other projects.

2.1.4. Event-Driven Programming

Event-driven programming is a programming paradigm where the flow of a program is


determined by events that occur during its execution. Instead of following a linear
sequence of operations, an event-driven program waits for specific events to occur and
then triggers corresponding event handlers or callbacks to respond to those events.

In event-driven programming, events can be various types of signals, actions, or


occurrences, such as user interactions (e.g., button clicks, mouse movements, key
presses), system events (e.g., timers, file input/output, network communication), or
custom events generated within the program.

Characteristics:

 Event Handling: Software responds to events like user input (e.g., mouse
clicks or keyboard presses), sensor data, and network communication.
 Time Driven: Time-driven means that the system is sensitive to time. This is
easiest to comprehend with an example: perhaps an alarm clock.

26 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
 Trigger Function: Trigger functions in event-driven programming are a
function that decide what code to run when there are a specific event occurs,
which are used to select which event handler to use for the event when there is
specific event occurred.
 Callback Functions: Event handlers are callback functions registered to listen
for specific events.
 Event Loop: An event loop manages and dispatches events. The event loop
continuously checks for incoming events and calls the corresponding event
handlers when events occur.
 Non-Blocking Behavior: Programs remain non-blocking for a smooth user
experience.

14 Code Example (in Python): Event-Driven Example

 Benefits of event driven programming:


27 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
 Simplicity:
 Easier to use compared to other programming languages.
 Hassle-free development when addressing business obligations.
 Convenience:
 Predictive coding, facilitated by languages like the Visual Basic.
 Provides relevant suggestions as developers type code.
 Flexibility:
 No specific start-to-finish order, making code implementation easy.
 Allows for easy adjustment of code to address conditions or fix errors.
 GUI Support:
 Comes with a pre-programmed Graphical User Interface (GUI) toolbar.
 Allows the creation of more interactive programs with included tools like
radio buttons.
 Power Consumption:
 Implementation relies on hardware interrupts.
 Results in considerably less power consumption compared to other
programming approaches.

 Limitations of Procedural Programming:


 Speed:
 Reduced performance in programs based on GUIs, especially with insufficient
installed memory.
 Complexity:
 Complexity arises, particularly in tiny programs.
 Program flow and stack management influence to the overall complexity.

28 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
 Regard of alternatives, such as batch programming, may be sensible for
simpler tasks.
 Resource Utilization:
 Event-driven programming uses a main loop that can drain system resources.
 The main loop constantly functions in the background, impacting resource
productivity.
 GUI usage in EDP requires specific specifications for interface design.

 Language Translation:
 Programs written in EDP languages may not easily translate to other
languages.
 Certain functionalities, like buttons, are tailored for event-driven
programming, limiting language flexibility.
 Platform Support:
 Event-driven programming is platform-dependent.
 Programs utilizing EDP may not function on different platforms due to
dependencies on certain libraries.
 For example, Visual Basic relies on Windows library files, making it
conflicting with other operating systems.

The relationships among procedural, object-oriented, and event-driven paradigms


can be understood in terms of their strengths, common use cases, and how they can
complement each other in different aspects of software development. Let's explore these
relationships:

1. Procedural vs. Object-Oriented:


o Relationship: Complementary and Evolutionary
o Explanation:
29 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
 Object-oriented programming (OOP) is often considered an
evolution of procedural programming.
 In procedural programming, code is organized around procedures
or functions. In contrast, OOP organizes code around objects,
which encapsulate both data and behaviour.
 OOP introduces concepts like classes, inheritance, polymorphism,
and encapsulation, which enhance code modularity, reusability, and
maintainability.
 While OOP provides these advantages, procedural programming
can still be useful for certain tasks or in legacy systems.
2. Object-Oriented vs. Event-Driven:
o Relationship: Synergistic in User Interfaces and Interactive Systems
o Explanation:
 Object-oriented programming and event-driven programming are
often used together in graphical user interface (GUI) development
and interactive systems.
 OOP is employed to model the application's underlying structure
using classes and objects.
 Event-driven programming handles user interactions and external
events, responding to events with appropriate methods or functions.
 GUI frameworks often use both paradigms, where objects represent
UI elements, and events trigger specific behaviours.

3. Procedural vs. Event-Driven:


30 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
o Relationship: Complementary in Asynchronous Environments
o Explanation:
 Procedural programming is more synchronous and linear, whereas
event-driven programming is asynchronous and reactive.
 In scenarios where asynchronous behaviour is crucial (e.g.,
handling user input or network events), event-driven programming
can complement procedural code.
 Procedural code may handle initialization and setup, while event-
driven code reacts to user interactions or external events.
4. Hybrid Approaches:
o Relationship: Coexistence and Integration
o Explanation:
 In real-world projects, it's common to see a hybrid approach that
incorporates elements of multiple paradigms.
 Modern programming languages often support multiple paradigms,
allowing developers to seamlessly switch between procedural,
object-oriented, and event-driven styles.
 The choice of paradigm depends on the specific requirements of
different parts of the system.
5. Use Case Dependencies:
o Relationship: Paradigm Selection Based on Use Case
o Explanation:
 The choice between procedural, object-oriented, or event-driven
paradigms often depends on the nature of the problem being
solved.
 Procedural programming might be suitable for tasks where a linear
sequence of steps is sufficient.
31 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
 Object-oriented programming excels in modelling complex
systems and promoting code reuse.
 Event-driven programming is well-suited for systems requiring
responsiveness to external stimuli or user interactions.
6. Language Support:
o Relationship: Implementation Flexibility
o Explanation:
 Many programming languages support multiple paradigms,
providing flexibility in choosing the most appropriate approach for
a given task.
 For example, languages like Python and JavaScript allow
developers to write procedural, object-oriented, and event-driven
code within the same program.

In summary, the relationships among procedural, object-oriented, and event-driven


paradigms are not equally exclusive. They can complement each other, and the choice
often varies on the specific necessities of different parts of a software system. Modern
programming practices inspire developers to leverage the strengths of each paradigm as
needed, leading to more flexible and efficient software development.

32 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
3. Activity 03

Grifindo Toys is a UK-based toy manufacturing firm operating on a modest scale,


employing a workforce of 50 individuals. Grifindo Toys has employed me as a freelance
software developer to construct a payroll system. The payroll system will streamline the
computation of employee compensation according to designated elements and criteria.

3.1. Pseudocode for the salary component

// Define a Salary class to handle salary calculations


class Salary {
// Method to calculate the base pay value
method calculateBasePay(employee: Employee): decimal {
// Calculate base pay
basePay = employee.monthlySalary + employee.allowances +
(employee.overtimeRate * employee.numOvertimeHours)
return basePay
}

// Method to calculate the no-pay value


method calculateNoPay(employee: Employee, salaryCycleDays: int,
numAbsentDays: int): decimal {
// Calculate no-pay value
noPayValue = (employee.monthlySalary / salaryCycleDays) *
numAbsentDays
return noPayValue
}

// Method to calculate the gross pay value


method calculateGrossPay(basePay: decimal, noPayValue: decimal,
governmentTaxRate: decimal): decimal {
// Calculate gross pay

grossPay = basePay - (noPayValue + (basePay * governmentTaxRate))


return grossPay

33 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
}

// Method to generate salary report for an employee


method generateSalaryReport(employee: Employee): void {

// Method to generate overall salary summary for a couple of months


for an employee
method generateOverallSalarySummary(employee: Employee,
startMonth: int, endMonth: int): void {

// Method to generate salary summary for all employees for a given


month range
method generateSalarySummaryForMonthRange(employees:
List<Employee>, startMonth: int, endMonth: int): void {

}
}

// Define an Employee class to store employee details


class Employee {
properties:
- employeeId: int
- name: string
- monthlySalary: decimal
- allowances: decimal
- overtimeRate: decimal
- numOvertimeHours: int

// Constructor to initialize employee details


constructor(employeeId: int, name: string, monthlySalary: decimal,
allowances: decimal, overtimeRate: decimal, numOvertimeHours: int) {
this.employeeId = employeeId
this.name = name
this.monthlySalary = monthlySalary
this.allowances = allowances

34 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
this.overtimeRate = overtimeRate
this.numOvertimeHours = numOvertimeHours
}
}

// Define a Settings class to handle system settings


class Settings {
properties:
- salaryCycleDays: int
- salaryCycleBeginDate: date
- salaryCycleEndDate: date
- numLeavesPerYear: int

// Constructor to initialize system settings


constructor(salaryCycleDays: int, salaryCycleBeginDate: date,
salaryCycleEndDate: date, numLeavesPerYear: int) {
this.salaryCycleDays = salaryCycleDays
this.salaryCycleBeginDate = salaryCycleBeginDate
this.salaryCycleEndDate = salaryCycleEndDate
this.numLeavesPerYear = numLeavesPerYear
}
}

// Define a Database class to handle data storage


class Database {

// Instantiate objects and perform operations


salary = new Salary()
employee = new Employee(1, "John Doe", 5000, 200, 10, 5)
basePay = salary.calculateBasePay(employee)
noPayValue = salary.calculateNoPay(employee,
settings.salaryCycleDays, 2)
grossPay = salary.calculateGrossPay(basePay, noPayValue, 0.2)
salary.generateSalaryReport(employee)
salary.generateOverallSalarySummary(employee, 1, 3)
salary.generateSalarySummaryForMonthRange(employees, 1, 6)

35 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
3.2. Database structure

1. Employee table:
 employeeId (primary key)
 name
 monthlySalary
 allowances
 overtimeRate
 numOvertimeHours
2. Salary table:
 salaryId (primary key)
 employeeId (foreign key referencing Employee table)
 basePay
 noPayValue
 grossPay
 salaryMonth
 salaryYear
3. Settings table:
 settingsId (primary key)
 salaryCycleDays
 salaryCycleBeginDate
 salaryCycleEndDate
 numLeavesPerYear

36 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
The Employee table contains comprehensive information about each employee,
encompassing their monthly income, allowances, overtime rate, and the number of hours
worked outside regular working hours.
The compensation table contains the computed values for each employee's compensation,
including base pay, no-pay value, and gross pay, as well as the month and year of the
salary computation.
The Settings table contains the system's configuration, which includes the duration of the
salary cycle (measured in days), the start and finish dates of the salary cycle, and the
maximum number of leaves permitted annually.
Foreign keys can be used to construct associations between tables, ensuring both data
integrity and efficient retrieval.

37 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
Figure 1:Database Diagram

38 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
3.3. Analysis of IDE features and Evaluation of Visual Studio IDE

An Integrated Development Environment (IDE) offers numerous features that greatly


assist in application development.

The Visual Studio IDE, specifically designed for C#.NET development, provides a
comprehensive set of features aligned with the requirements of the Grifindo Toys payroll
system. It encompasses a robust code editor, powerful debugging tools, integration with
version control systems like Git, and efficient build and compilation tools. The IDE also
offers extensive documentation and code completion capabilities, streamlining the coding
process for developers. Additionally, Visual Studio boasts a user-friendly interface and a
variety of project management features, including project templates, solution explorer,
and the NuGet package manager.

Using Visual Studio IDE for developing the Grifindo Toys payroll system yields several
advantages:

1. Improved Productivity: The Visual Studio IDE enhances productivity through features
like code generation, automatic error checking, and IntelliSense. These tools contribute to
the development of efficient and accurate code, accelerating the development process and
minimizing the need for manual effort.

2. Comprehensive Debuggin: Visual Studio provides a thorough debugging environment


with watch windows, breakpoints, and step-by-step execution. This ensures smooth and
uninterrupted debugging, allowing programmers to quickly identify and resolve issues,
thus enhancing the reliability and stability of the payroll system.

39 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
3. Integrated Testing: Developers can generate and execute tests directly within Visual
Studio, utilizing its integrated unit testing capabilities. This simplifies the verification of
the accuracy and resilience of each individual component of the payroll system.

4. Efficient Version Control: Visual Studio seamlessly integrates with Git and other
version control systems, enabling efficient code management and collaboration. This
integration facilitates tracking changes, switching between branches, and resolving
conflicts directly within the IDE, ensuring the integrity of the code and fostering efficient
cooperation.

Visual Studio incorporates tools for code analysis, facilitating the identification of
potential issues and providing recommendations for improvements. Additionally, it offers
refactoring utilities to enhance the readability, maintainability, and quality of the code,
ensuring the codebase remains optimized and organized.

Developers can leverage Visual Studio's database integration feature to conveniently


develop and manage the database schema within the IDE. This ensures smooth
integration between the database and the payroll system, optimizing database-related
procedures.

The development of the payroll system for Gryffindor Toys would be significantly more
challenging and time-intensive in the absence of an Integrated Development Environment
(IDE). Without an IDE, developers would lack the opportunity to utilize the advanced
functionalities and automated processes that IDEs provide, being compelled to rely on
basic text editors and command-line utilities. Manual execution of tasks such as code
completion, error checking, and debugging would impede development progress and
increase the likelihood of errors.
40 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
4. Activity 04

4.1. Design and build a small GUI system for the above scenario and it should be a
complete functional system with all the functions which has described in the above
scenario with the database structure which has designed in activity 3.

41 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
42 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
Figure 2login

Figure 3 component

43 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
Figure 4 Emp salary

Figure 5 add sallary

44 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
Figure 6 delete code

Figure 7 saman

45 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
46 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
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.

Debugging is a crucial step in the software development process that aids in finding and
resolving mistakes, bugs, and problems in the code. Robust debugging options are
available in the Visual Studio IDE, which improves process effectiveness. These are
some of the main debugging features of Visual Studio.
1. Breakpoints: With breakpoints, you can halt the execution of your code at a
designated line to examine variable values, examine the program's flow, and spot
problems. Breakpoints can be made using keyboard keys or by clicking on the
code editor's left margin.

2. Step-by-Step Execution: You can step through your code line by line in Visual
Studio using a variety of step-by-step execution choices, like stepping over (F10),

47 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
stepping inside (F11), and stepping out (Shift+F11). These settings assist you in
tracking the execution path and comprehending the behaviour of your code.

3. Watch Window: Runtime monitoring of variables, expression, and object values


is possible with the Watch Window. In the Watch Window, you can add variables
and track changes to them as you go through the code. This function aids in the
analysis of your program's current state and helps you spot weird or inaccurate
numbers.

4. Locals Window: Within the current scope, the variables and their values are
shown in the Locals Window. During debugging, it offers a simple method to
examine local variables and their modifications. This is especially helpful if you
wish to look up the values of the variables in a certain function or block.

5. Call Stack Window: The series of method calls that got your code to this point is
displayed in the Call Stack Window. It assists you in tracking the path using
various techniques and comprehending the execution flow. You can examine the
variables and values at each level by navigating through the call stack.

6. Exception Handling: Visual Studio has powerful exception handling features.


When an exception occurs, you can study the stack trace and exception details, set
breakpoints on specific exceptions, and control how exceptions are handled during
debugging. This facilitates the graceful handling of errors and the identification
and resolution of exceptions.

Your application will be more reliable and secure if you make use of Visual Studio's
debugging tools. These are some instances of how debugging helps to create better
applications,
1. Identifying Logic Errors: Through code stepping, you may debug and see how
variables and expressions behave. This aids in spotting erroneous computations,

48 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
unexpected behavior, and flaws in reasoning. Your application can become more
dependable and safer by resolving these problems.

2. Handling Exceptions: Runtime exceptions can be better understood by


debugging. You may determine the reason behind the issue and take the proper
action by looking at the call stack, exception details, and variable values. This
keeps your programme from crashing and makes it more stable.

3. Validating Inputs: Validating user inputs, API answers, and database queries can
all be done during debugging. You may make sure that the inputs are processed
correctly, and steer clear of possible security flaws like SQL injection or buffer
overflows by looking at the values and doing sanity checks.

4. Testing Edge Cases: By changing the program flow or manually manipulating


variable values, debugging enables you to examine edge cases. This is useful for
identifying problems that might arise situations or uncommon circumstances. You
may improve your application's resilience and reliability by taking care of these
edge case problems.

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.

Coding standards are a collection of principles and directives that specify the format,
style, and organization of code within software development projects. The codebase's
consistency, readability, and maintainability are guaranteed by these requirements. This
is a synopsis and description of the coding standards I have applied when developing

49 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
applications, along with a critical assessment of their significance for the team and the
person,
1. Naming Conventions: Variables, functions, classes, and other code elements are
given names that are consistent and informative. As an illustration, utilise Pascal
case for class names (e.g., Employee, PayrollSystem) and camel case for variables
and functions (e.g., myVariable, calculateSalary()).

2. Indentation and Formatting: To improve code readability, consistent


indentation (such as the use of spaces or tabs) and code formatting are used. Using
appropriate line breaks, spacing, and alignment, for instance.

3. Comments and Documentation: The goal, reasoning, and any intricate


algorithms or business rules of the code are all explained in meaningful comments
and documentation. They aid in the comprehension of the code and its operation
by other developers as well as the developer themselves.

4. Error Handling and Exception Management: To properly manage exceptions,


errors, and edge cases, appropriate error handling techniques are created. Try-
catch blocks, error logging, and illuminating error messages are a few examples of
this.

5. Modularity and Code Reusability: Code is arranged into classes, functions, and
modular parts to facilitate maintainability and reusability. This calls for adhering
to ideas like concern separation, encapsulation, and single responsibility.

6. Code Reviews and Peer Collaboration: To make sure that coding standards are
followed, team members collaborate and perform routine code reviews. This
promotes information sharing among team members, enhances code quality, and
helps find and repair problems.

A coding standard is necessary for both the team and the individual for several reasons,
50 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
1. Consistency: Coding standards create a uniform structure and style for the whole
codebase. All team members can collaborate and comprehend the code more
easily and effectively as a result of this consistency, which makes it possible for
them to work together more successfully.

2. Readability and Maintainability: Code that is well-formatted and easy to read is


easier to comprehend and alter. This benefits the team as a whole as well as the
individual developer by cutting down on the amount of time needed for
maintenance, enhancements, and bug fixes.

3. Code Quality and Reliability: Using best practices is encouraged by adhering to


coding standards, and this results in more dependable and high-quality code.
Common coding errors are prevented, code maintainability is enhanced, and the
chance of introducing defects is decreased.

4. Scalability and Collaboration: Scalability is made possible by coding standards,


which make it easy for new team members to comprehend and contribute to the
codebase. By offering a common platform for conversations, code reviews, and
knowledge exchange, it encourages teamwork.

5. Code Documentation: Coding standards frequently contain documentation


guidelines for codes. Well-documented code benefits the team by facilitating
efficient knowledge transfer and lowering dependency on individual developers,
as well as the individual developer by offering self-explanatory code.

51 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
5. References

What is an algorithm? | TechTarget (no date) WhatIs.com. Available at:


https://www.techtarget.com/whatis/definition/algorithm (Accessed: 13 November 2023).

What is an algorithm? (no date). Available at:


https://www.cs.utexas.edu/users/mitra/csSpring2017/cs303/lectures/algo.html (Accessed:
13 November 2023).

Chen, X., & Liu, X. (2020). Query understanding techniques for modern search engines:
A survey. Information Processing & Management, 57(6), 102221.
Sedgewick, R., & Wayne, K. (2021). Algorithms, Part I. Addison-Wesley Professional.
Szeliski, R. (2010). Computer vision: Algorithms and applications. Springer Science &
Business Media.

Big O Notation in Data Structure: An Introduction | Simplilearn (2022) Simplilearn.com.


Available at: https://www.simplilearn.com/big-o-notation-in-data-structure-article
(Accessed: 13 November 2023).

Brooks, R. (2022) How do algorithms work?, University of York. Available at:


https://online.york.ac.uk/how-do-algorithms-work/ (Accessed: 13 November 2023).

Cory Mitchell (2023) Fibonacci Sequence: Definition, How it Works, and How to Use It,
Investopedia. Available at: https://www.investopedia.com/terms/f/fibonaccilines.asp
(Accessed: 13 November 2023).

Event-Driven Programming Features (2021). Available at:


https://www.ukessays.com/essays/computer-science/eventdriven-programming-features-
6167.php (Accessed: 14 November 2023).

‘Fibonacci sequence’ (2023) Wikipedia. Available at:


https://en.wikipedia.org/w/index.php?title=Fibonacci_sequence&oldid=1184748925
(Accessed: 13 November 2023).

Ilenia Magoni (2022) What is a Factorial? How to Calculate Factorials with Examples,
freeCodeCamp.org. Available at: https://www.freecodecamp.org/news/what-is-a-
factorial/ (Accessed: 13 November 2023).

52 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
Mejia, A. (2020) How to find time complexity of an algorithm?, Adrian Mejia Blog.
Available at: https://adrianmejia.com/how-to-find-time-complexity-of-an-algorithm-
code-big-o-notation/ (Accessed: 13 November 2023).

Mishal Roomi (2022) 5 Advantages and Disadvantages of Event Driven Programming |


Limitations & Benefits of Event Driven Programming. Available at:
https://www.hitechwhizz.com/2022/11/5-advantages-and-disadvantages-limitations-
benefits-of-event-driven-programming.html (Accessed: 14 November 2023).

Programming Paradigms (no date). Available at:


https://cs.lmu.edu/~ray/notes/paradigms/ (Accessed: 13 November 2023).
‘Python Program for n-th Fibonacci number’ (2011) GeeksforGeeks, 6 March. Available
at: https://www.geeksforgeeks.org/python-program-for-n-th-fibonacci-number/
(Accessed: 13 November 2023).

RishabhPrabhu (2019) ‘What is Algorithm | Introduction to Algorithms’, GeeksforGeeks,


28 March. Available at: https://www.geeksforgeeks.org/introduction-to-algorithms/
(Accessed: 13 November 2023).

Robert Sheldon (2022) What is the Fibonacci sequence and how does it work?,
WhatIs.com. Available at: https://www.techtarget.com/whatis/definition/Fibonacci-
sequence (Accessed: 13 November 2023).
Shadab (2022) Algorithm and Flowchart to Calculate Fibonacci series up to n,
Atechdaily. Available at: https://www.atechdaily.com/posts/algorithm-for-fibonacci-
series (Accessed: 13 November 2023).

Sonia Jessica (2022) Python Program to Print the Fibonacci Sequence,


freeCodeCamp.org. Available at: https://www.freecodecamp.org/news/python-program-
to-print-the-fibonacci-sequence/ (Accessed: 13 November 2023).

Varikuti, M. (2022) Big O Notation: What Is It?, Medium. Available at:


https://pub.towardsai.net/big-o-notation-what-is-it-69cfd9d5f6b8 (Accessed: 13
November 2023).

53 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01

You might also like