Grifindo Toys Document
Grifindo Toys Document
Grifindo Toys Document
Unit(s)
Unit-01 Programming Assignment
Assignment title
Student’s name
List which assessment criteria Pass Merit Distinction
the Assessor has awarded.
1
Confirm action completed
Remedial action taken
Give details:
Internal Verifier
Date
signature
Programme Leader
Date
signature (if required)
2
Higher Nationals - Summative Assignment Feedback Form
Student Name/ID
Unit Title
Assignment Number Assessor
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 an analysis of a suita
Integrated Development Environment (IDE).
LO4. Determine the debugging process and explain the importance of a coding standard.
Pass, Merit & Distinction Descripts P4 P5 M4 D4
* Please note that grade decisions are provisional. They are only confirmed once internal and external moderation has taken place and
grades decisions have been agreed at the assessment board.
Assignment Feedback
3
Formative Feedback: Assessor to Student
Action Plan
Summative feedback
Assessor Date
signature
Student Date
signature
4
Pearson Higher Nationals in
Computing
Unit 01: Programming
Assignment 01
5
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.
6
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.
7
8
Higher National Diploma in Computing
Assignment Brief
Student Name /ID Number
Academic Year
Unit Tutor
Issue Date
Submission Date
Submission Format
1. Written Report
This submission is in the form of an individual written report. This should be written in a concise, formal
business style using single spacing and font size 12. You are required to make use of headings, paragraphs
and subsections as appropriate, and all work must be supported with research and referenced using the
Harvard referencing system. Please also provide a bibliography using the Harvard referencing system. (The
recommended word count is 1,500–2,000 words for the report excluding annexures)
3. Presentation
With the submitted system student should do a presentation to demonstrate the system that was
developed. Time allocated is 10 to 15 min. Student may use 5 to 10 PowerPoint slides while doing the
presentation, but live demonstration of the system is required. Evaluator will also check the ability to modify
and debug the system using the IDE.
9
Unit Learning Outcomes:
LO1. Define basic algorithms to carry out an operation and outline the process of
programming an application.
LO4. Determine the debugging process and explain the importance of a coding
standard
10
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, ……..
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.
11
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).
12
• 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
13
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
14
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
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.
4.2 Examine debugging process and the features available in Visual studio IDE for debugging
your code more easily. Evaluate how you used the debugging process to develop more
secure, robust application with examples.
4.3 Explain and outline the coding standards you have used in your application development.
Critically evaluate why a coding standard is necessary for the team as well as for the
individual.
15
16
Grading Rubric
17
D1 Evaluate the implementation of an algorithm in a suitable
language and the relationship between the written algorithm
and the code variant
19
P5 Explain the debugging process and explain the
debugging facilities available in the IDE.
20
Table of Contents
ACTIVITY 1 ............................................................................................................................ 22
PART A................................................................................................................................ 22
PART B ................................................................................................................................ 23
ACTIVITY 2 ............................................................................................................................ 30
PART 2.1 ............................................................................................................................. 30
ACTIVITY 3 ............................................................................................................................ 34
ACTIVITY 4 ............................................................................................................................ 37
PART 4.1 ............................................................................................................................. 37
PART 4.2 ............................................................................................................................. 42
Part 4.3 ................................................................................................................................. 44
21
ACTIVITY 1
PART A
Starting with 0 and 1, the Fibonacci numbers are a series of integers where each number is
the sum of the two numbers before it. Each succeeding number in the series is the sum of the
two numbers before it. The first two numbers in the sequence are 0 and 1. The sequence is
often denoted as Fn, where n represents the position of the number in the sequence.
The recurrence relation that defines the Fibonacci sequence is:
The sequence can be computed iteratively by starting with F0 = 0 and F1 = 1, and then
applying the recurrence relation to compute each subsequent term. For example, we can
compute the first few terms of the sequence as follows:
The Fibonacci sequence has many interesting properties and applications in mathematics,
science, and computer science. For example, it appears in nature in the branching of trees, the
arrangement of leaves on a stem, and the spirals of shells and galaxies. In computer science,
the sequence is used in algorithms for searching and sorting, and in cryptography.
22
PART B
Definition of an Algorithm:
An algorithm is a set of clear instructions that accomplishes a task or solves a problem. It is a
step-by-step process created to achieve a particular aim or target. Algorithms are used in many
areas of science, engineering, and computer science to perform complex computations and
automate tasks.
Characteristics of a Good Algorithm:
1. Well-defined:
The steps of an algorithm should be clearly defined and unambiguous. A good algorithm
provides a clear and precise set of instructions that can be followed to solve a specific
problem or perform a particular task. It should leave no room for interpretation or
confusion.
2. Precise:
Precision is a crucial characteristic of a good algorithm. It means that the algorithm's
instructions should be accurate and well-defined. Each step should be formulated
precisely, without any ambiguity or vagueness. This ensures that the algorithm can be
implemented correctly and consistently.
3. Effective:
An algorithm should be effective in solving the problem or performing the task it is
designed for. It should use appropriate strategies and techniques to achieve the desired
outcome efficiently. Efficiency can be measured in terms of time complexity (how long
it takes to execute) and space complexity (how much memory it requires).
23
4. Finiteness:
A good algorithm should have a finite number of steps. It means that the algorithm should
eventually terminate after a finite number of instructions. This ensures that the algorithm
will not run indefinitely and guarantees its practicality and usefulness.
5. Input/Output:
An algorithm should interact with the user by taking input and providing output. It should
be able to receive input data from the user or another program, process it according to its
instructions, and produce meaningful output. Input and output mechanisms make the
algorithm usable and allow it to solve real-world problems.
6. Uniqueness:
The output produced by an algorithm should be consistent and independent of the user. It
means that the algorithm should always produce the same output for the same input,
regardless of who is using it. This characteristic ensures that the algorithm's behavior is
predictable and reliable, making it easier to test, verify, and compare with other
algorithms.
By adhering to these characteristics, a good algorithm can be designed to efficiently solve
problems and perform tasks in a reliable and predictable manner.
24
Pseudo code for displaying the Fibonacci series:
25
2. Algorithm design:
Once the problem is identified, the next step is to design an algorithm that outlines the
step-by-step process to solve the problem. This involves breaking down the problem into
smaller, manageable tasks and determining the logic and flow of the program.
3. Coding:
After the algorithm is designed, it is translated into a specific programming language. This
step involves writing the actual code that implements the algorithm. The code should be
written in accordance with the syntax and rules of the chosen programming language.
4. Testing:
Once the code is written, it needs to be tested to ensure that it works correctly and produces
the expected results. Testing involves running the program with different inputs and
verifying that the outputs are accurate and meet the specified requirements.
5. Debugging:
During the testing phase, issues or errors may be discovered in the code. Debugging is the
process of identifying and fixing these errors. It involves analyzing the code, tracing the
execution flow, and correcting any syntax errors, logical errors, or runtime errors.
6. Documentation:
It is essential to document the program and its features for future reference.
Documentation provides a clear explanation of the program's purpose, functionality,
inputs, outputs, and any other relevant information. It helps other developers understand
and maintain the code in the future.
7. Maintenance:
After the program is developed and deployed, it may require updates or modifications to
adapt to changing requirements or to fix issues that arise over time. Maintenance involves
making necessary changes, improving performance, and ensuring the program remains
functional and up to date.
26
Potential Challenges Faced in Writing Code:
1. Syntax errors:
Syntax errors occur when the code violates the rules and structure of the programming
language. They can occur due to missing or misplaced punctuation, incorrect variable
declarations, or improper usage of language-specific keywords. These errors are usually
caught by the compiler or interpreter.
2. Logical errors:
Logical errors occur when the code does not produce the expected output or result, even
though it may be free of syntax errors. These errors are often caused by incorrect
algorithms, flawed logic, or incorrect understanding of the problem. Debugging
techniques such as code review, stepping through the code, and using debugging tools are
used to identify and fix logical errors.
3. Runtime errors:
Runtime errors occur during the execution of a program. They can be caused by various
factors such as invalid input, division by zero, memory allocation issues, or external
dependencies. Runtime errors often lead to program crashes or unexpected behavior.
Debugging techniques and error handling mechanisms are used to address these issues
and make the program more robust.
27
Sample Run of Fibonacci and Factorial Algorithms:
For the Fibonacci algorithm, let's take n = 6.
Big-O Notation:
Big-O notation is a mathematical representation that is utilized to characterize the time
complexity or efficiency of an algorithm. Its purpose is to indicate how the running time of
an algorithm scales in relation to the size of the input. Essentially, it provides insight into the
rate at which the algorithm's performance grows as the input size increases. When employing
Big-O notation, the focus is solely on the highest order term within the equation that describes
the algorithm's running time. In simpler terms, if the running time can be represented by a
polynomial equation, only the term with the greatest degree is considered.
To illustrate this concept, let's consider the Fibonacci algorithm. It possesses a time
complexity denoted as O(2^n) because it necessitates the computation of the sum of the
previous two numbers for each number in the sequence. Consequently, as the value of n
increases, the number of computations required grows exponentially. The factorial algorithm
exhibits a time complexity of O(n) since it involves performing n multiplications, directly
proportional to the input size.
28
Python Code for Fibonacci and Factorial Algorithms:
Fibonacci Algorithm:
29
ACTIVITY 2
PART 2.1
Programming Paradigm:
A programming paradigm refers to a foundational style or methodology in programming that
governs the structure and execution of programs. It encompasses a collection of principles,
techniques, and concepts that establish a framework for constructing programs. There exist
various programming paradigms, each possessing its own distinct characteristics and
advantages. Among the most prevalent paradigms are procedural, object-oriented, and event
driven.
Procedural Programming:
Procedural programming is a programming paradigm that concentrates on functions or
procedures responsible for performing operations on data. This paradigm follows a top-down
approach, where the main function serves as the entry point and calls other functions as
necessary. In procedural programming, data is typically stored in global variables that can be
accessed by any function. Popular programming languages such as C, Fortran, and Pascal
adhere to this paradigm.
30
Here's an example of a procedural code snippet in C:
The main characteristic of the procedural paradigm is that the program is organized around
functions that perform specific tasks. The above code snippet shows how functions can be
used to perform tasks, and how the program follows a top-down approach.
Object-Oriented Programming:
Object-oriented programming (OOP) is a programming paradigm that focuses on the use of
objects to represent data and behavior. An object is an instance of a class, which encapsulates
data and the operations that can be performed on that data. The program follows a bottom-up
approach, with objects communicating with each other to perform tasks. Java, Python, and
C++ are some of the popular languages that follow this paradigm.
31
Here's an example of an object-oriented code snippet in Python:
The organization of the program around objects that contain data and behavior is the primary
feature of the object-oriented paradigm. The above code snippet shows how objects can be
used to encapsulate data and behavior, and how the program follows a bottom-up approach.
Event-Driven Programming:
Event-driven programming is a programming paradigm that focuses on the use of events to
trigger actions. An event is an occurrence that can be detected by the program, such as a
mouse click or a keyboard press. The program is structured around events and how it responds
to them. JavaScript and Python are some of the popular languages that follow this paradigm.
Here's an example of an event-driven code snippet in Python:
32
The main characteristic of the event-driven paradigm is that the program is structured around
events and how it responds to them. The above code snippet shows how events can be used
to trigger actions, and how the program responds to events.
33
The event-driven code snippet shows how events can be used to trigger actions, and how the
program responds to events. This paradigm is often used in graphical user interface (GUI)
programming and can make it easier to handle user input and respond to changes in the
program's environment. However, it can also lead to complex and difficult-to-manage code
if not designed properly.
ACTIVITY 3
34
Database Structure:
The database should have a table for Employee details, a table for Salary details, and a table
for Settings details.
Employee Table:
• Employee ID
• Employee Name
• Monthly Salary
• Overtime Rate (hourly)
• Allowances
Salary Table:
• Employee ID (foreign key)
• Month
• Year
• No. of Absent Days
• No. of Leaves
• No. of Holidays
• No. of Overtime Hours
• No-pay value
• Base Pay value
• Gross Pay value
35
Settings Table:
• Date Range for a salary cycle
• Salary cycle begin date
• Salary cycle end date
• No. of Leaves per year
36
and prone to errors. Therefore, using an IDE like Visual Studio is a more efficient and
effective way of developing software applications.
ACTIVITY 4
PART 4.1
Employee Component
37
Salary Component
Settings Component
38
Database Connection
Table Creations
39
Data Insertions
40
UI Designs
41
PART 4.2
Debugging is an essential part of the software development process as it helps developers to
identify and fix errors, bugs, and other issues in the code. Visual Studio IDE provides various
debugging features that help developers to debug their code more easily and efficiently. Some
of the key features available in Visual Studio IDE for debugging are:
1. Breakpoints:
With the aid of breakpoints, programmers can stop their code's execution at a particular
line and check the status of the variables and objects in the current context. This feature
helps developers to identify the cause of errors and bugs more easily.
42
2. Watch window:
The watch window allows developers to track the value of variables and expressions during
the execution of the code. Developers can add any variable or expression to the watch
window, and Visual Studio IDE will show the value of the variable or expression in real-
time.
3. Call stack:
The method calls that led to the current execution point are displayed in the call stack. This
function aids programmers in comprehending the logic of their code and locating the source
of problems and errors.
4. Exception handling:
Visual Studio IDE provides various tools and features to handle exceptions and errors in
the code. Developers can use try-catch blocks to catch exceptions and handle them
gracefully. Visual Studio IDE also provides a detailed exception window that shows the
stack trace and other information about the exception.
5. Debugging symbols:
Debugging symbols are files that contain information about the code structure, function
names, and other metadata. These symbols help developers to debug their code more
efficiently by providing more detailed information about the code.
During the development of the Grifindo Toys Payroll System, the debugging phase played a
pivotal role in ensuring the quality of the software. For instance, while implementing the
Salary Component, I encountered a problem where the calculation of the base pay value was
incorrect. By utilizing breakpoints and the watch window, I successfully identified the root
cause of this issue, which turned out to be a logical error in the calculation formula. Once
identified, I promptly rectified the error and proceeded to extensively test and debug the code
until it functioned accurately.
43
Another noteworthy example of how I leveraged the debugging process to enhance the
security and robustness of the application occurred during the implementation of the
Employee Component. While conducting tests, I discovered a potential loophole that allowed
the registration of employees with negative salaries. This posed a threat to the accurate
calculation of the base pay value. To address this, I skillfully employed exception handling
techniques and utilized debugging features to detect and gracefully handle such errors. I
ensured that an error message would be displayed to the user, effectively preventing the
registration of employees with negative salaries. Debugging plays a vital role in the software
development process, and I made effective use of the diverse features and tools offered by
the Visual Studio IDE to streamline and expedite the debugging process. By capitalizing on
these features, I successfully developed a more secure and robust application for the Grifindo
Toys Payroll System.
Part 4.3
In the development of the "Grifindo Toys Payroll System," adherence to specific coding
standards was essential. The following coding standards were employed:
1. Naming conventions: To ensure consistency, PascalCase was used for class names,
camelCase for variable and method names, and all abbreviations were spelled out.
2. Indentation and formatting: Tab indentation was used, curly braces were placed on a
new line, and spaces were utilized for code block alignment.
3. Commenting: Code was appropriately commented to provide explanations for code
blocks, methods, or classes as needed.
4. Error handling: Error messages were logged and displayed to users when necessary,
and exception handling techniques were implemented to prevent unexpected errors.
44
5. Code reuse: Common functionalities were extracted into reusable methods and classes.
Inheritance and interfaces were utilized to ensure modular and maintainable code.
Coding standards are necessary for both teams and individuals due to the following reasons:
1. Consistency:
A coding standard ensures uniformity in code structure, style, and format, facilitating
easier comprehension by other developers.
2. Maintainability:
Well-defined coding standards enable developers to easily maintain the codebase. It
assists in swiftly identifying the purpose of code blocks and making changes without
disrupting other system components.
3. Collaboration:
Coding standards facilitate collaboration among multiple developers working on the same
codebase. They promote code comprehension and enable seamless modifications without
confusion or conflicts.
4. Quality:
Coding standards contribute to high-quality code by promoting well-structured, readable,
and maintainable code. They help in minimizing common errors and bugs.
5. Efficiency:
Coding standards enhance productivity by reducing the time required for code reviews,
debugging, and maintenance. They enable developers to comprehend and modify each
other's code easily, leading to faster development cycles.
45