Unit-01 Programming Assignment - CRDS - Final
Unit-01 Programming Assignment - CRDS - Final
Give details:
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.
LO2. Explain the characteristics of procedural, object-orientated and event-driven programming, conduct
LO4. Determine the debugging process and explain the importance of a coding standard.
Pass, Merit & Distinction Descripts P4 P5 M4 D4
* Please note that grade decisions are provisional. They are only confirmed once internal and external moderation has taken place and
grades decisions have been agreed at the assessment board.
Assignment Feedback
Formative Feedback: Assessor to Student
Action Plan
Summative feedback
Assessor Date
signature
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.
1. The font size should be 12 point, and should be in the style of Time New Roman.
2. Use 1.5 line spacing. Left justify all paragraphs.
3. Ensure that all the headings are consistent in terms of the font size and font style.
4. Use footer function in the word processor to insert Your Name, Subject, Assignment No,
and Page Number on each page. This is useful if individual sheets become detached for any
reason.
5. Use word processing application spell check and grammar check function to help editing
your assignment.
Important Points:
1. It is strictly prohibited to use textboxes to add texts in the assignments, except for the
compulsory information. eg: Figures, tables of comparison etc. Adding text boxes in the body
except for the before mentioned compulsory information will result in rejection of your
work.
2. Carefully check the hand in date and the instructions given in the assignment. Late
submissions will not be accepted.
3. Ensure that you give yourself enough time to complete the assignment by the due date.
4. Excuses of any nature will not be accepted for failure to hand in the work on time.
5. You must take responsibility for managing your own time effectively.
6. If you are unable to hand in your assignment on time and have valid reasons such as illness,
you may apply (in writing) for an extension.
7. Failure to achieve at least PASS criteria will result in a REFERRAL grade .
8. Non-submission of work without valid reasons will lead to an automatic RE FERRAL. You will
then be asked to complete an alternative assignment.
9. If you use other people’s work or ideas in your assignment, reference them properly using
HARVARD referencing system to avoid plagiarism. You have to provide both in-text citation
and a reference list.
10. If you are proven to be guilty of plagiarism or any academic misconduct, your grade could be
reduced to A REFERRAL or at worst you could be expelled from the course.
Student Declaration
I hereby, declare that I know what plagiarism entails, namely to use another’s work and to present
it as my own without attributing the sources in the correct way. I further understand what it means
to copy another’s work.
Unit Tutor
Submission Format
1. Written Report
This submission is in the form of an individual written report. This should be written in a concise,
formal business style using single spacing and font size 12. You are required to make use of
headings, paragraphs and subsections as appropriate, and all work must be supported with
research and referenced using the Harvard referencing system. Please also provide a bibliography
using the Harvard referencing system. (The recommended word count is 1,500–2,000 words for
the report excluding annexures)
3. Presentation
With the submitted system 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.
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, ……..
Fn = F n-1 + F n-2
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.
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,
No-pay-value = (Total_Salary/salary_cycle_date_range)
*No_of_absent_days
Base Pay need to calculate according to the below mentioned formula
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
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 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.
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.
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.
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).
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.
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:
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:
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
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
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).
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.
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
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
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:
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
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.1. Definition
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.
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
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:
24 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
13 Code Example (in Python): Object-Oriented Programming
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.
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.
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.
32 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
3. Activity 03
33 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
}
}
}
34 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
this.overtimeRate = overtimeRate
this.numOvertimeHours = numOvertimeHours
}
}
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
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.
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.
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
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.
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.
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.
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.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()).
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.
51 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01
5. References
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.
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).
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).
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).
53 | P a g e
Chamara Rasanjana De Silva | 00209338 Programming Unit 01