Programming Assignment PDF
Programming Assignment PDF
Unit(s)
Assignment title
Vitharana Gamage Gayan Praneeth
Student’s name
List which assessment criteria Pass Merit Distinction
the Assessor has awarded.
Give details:
Internal Verifier
Date
signature
Programme Leader
Date
signature (if required)
Higher Nationals - Summative Assignment Feedback Form
Student Name/ID Vitharana Gamage Gayan Praneeth
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
Formative Feedback: Assessor to Student
Action Plan
Summative feedback
Assessor Date
signature
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.
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.
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
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,
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,
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
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.
Grading Rubric
4 Factorial numbers..................................................................................................................... 36
5 Pseudocode .............................................................................................................................. 40
11 Differences in the code and the algorithm, the efficiency of the programs in reference to the
Big-O notation. ........................................................................................................................ 54
14.1.3 Settings..................................................................................................................... 62
17.7 The classes and methods created for the program ............................................................. 88
18 Debugging ................................................................................................................................ 91
18.4 How debugging features were used to develop the program and make it better ............... 94
20 References ................................................................................................................................ 99
Step 1: Get the input for the number (N) of instances needed on the Fibonacci sequence
Step 2: Define integers and values for the counter (C = 0), First Number (F1 = 0), the
Second number (F2 = 1) and the Next number (Next = 0)
Step 4: Check the counter (C) is less than the Input number (num) if so, go to next step. If
not, End the programme. Since the first two numbers are already displayed, who instances
have been removed from the number
Step 1: Input the number than needs to be shown in the factorial (Num)
Step 3: Check whether the Counter is lower or equal to the Input Number. If not, Output the
Value of M and End the programme. If so, go to the next step.
Step 4: Make the calculation and define the new value of M multiplied by the counter.
(M = M*C)
Step 5: Increment the counter by 1. (C = C+1)
Writing code is a systematic and strategic process which needs more preparation time than
the actual coding itself. If the programmer is fully equipped with all the information he needs,
coding the program would face less challenges and hindrances.
Therefore, breaking down the problem from an abstract idea to a specific definition is one of
the important steps in the process. By doing this, the programmer can have a clear vision as
to what he needs to do to solve the problem. If this step fails, the entire process can be faulty.
After the problem is thoroughly broken down and the algorithm is created, using an actual
programming language is the next part of the puzzle which needs to be taken care of. Though
most programming languages are similar to natural language, they are not completely similar
and can have differences with various methods and syntaxes. Translating the algorithm into
the proper programming language can be challenging especially when the problem is
complicated and has a lot of intricacies within.
As each programming language has its way of writing, the actual coding lines can differ from
the algorithm and pseudocode which were prepared beforehand leading to complications.
Sometimes, there can be easier ways to achieve the desired goal and the programmer might
not be aware of this.
Apart from these internal factors, there are a number of external factors that could come into
play when writing code. The resources the programmer has, i.e., the processing capabilities
of the system they use can have a direct effect on the programming phase. The timeline can
also pose a challenge because most of the time, programmers have to work under tight
deadlines and this might be negatively affecting the coding process.
F1 = F2
F1 = 1
F1 = F2
F1 = 1
C< N-2 Next = F1 + F2 Print value of C=C+1
2<5-2 Next = 2+ 1 Next C=2+1
2<3 Next = 3 Next = 3 C=3
Yes
Print 3 F2 = Next
F2 = 3
F1 = F2
F1 = 2
C< N-2
3<5-2
3<3
No
At the end of the run, the program has output the following values. There are 5 numbers and the 5th one is 3.
0
1
1
2
3
Table 1: Fibonacci numbers dry run
In this graph, the horizontal axis represents the size of the input, and the vertical axis
represents the time the program takes to process the input. If the curve is close to parallel to
the horizontal axis, it means the algorithm, or the program takes the same amount of time to
process any amount of input. If the curve is parallel to the vertical axis, this means the
algorithm will take exponential time to process the input. So, Big-O notation states that the
less time it takes an algorithm to run a process, the better its runtime complexity value is.
As described in the above graph, there are several Big-O cases that can be seen in an
algorithm.
f1 = 0
f2 = 1
Next = 0
c = 0
print("Fibonacci sequence:")
print("0")
print("1")
Programming paradigms fall into two main categories. The imperative and the Declarative
programming paradigms.
Imperative programming paradigms has a step-by-step approach to solve a problem executing
from top to bottom. Being one of the earliest programming paradigms, achieving the goal is
its focus. These languages are simple to implement, and they contain variables and loops.
Some of the main programming paradigms within imperative programming paradigm are, the
Procedural Programming Paradigm, the Object-Oriented Programming paradigm and the
event driven programming paradigm.
def Sum(list_of_numbers):
total = 0
for x in list_of_numbers:
total += x
return total
print(Sum(first_list))
print(Sum(second_list))
Figure 16: Code example for Procedural Programming
In the above example, a simple code has been provided to calculate the sum of a list of
numbers. The program runs line b line and then outputs the results. The first_list should output
500 as the total and the second_list should output 75 as the total.
When the above code is executed, the names and authors of the books should be printed in
the screen.
Advantages Disadvantages
The code can be reused in similar conditions Can be slower than procedural programs
and situations
Can relate to real world entities making the Can contain more lines of code making it
coding process productive complicated.
Easily upgradable and scalable If done without proper standards, can cause
a lot of issues.
Modularity and ease of troubleshooting Has a steep learning cure and takes time
getting used to
In the code, each element is waiting for a specific action to happen in order to run the
designated code.
Advantages Disadvantages
Event driven programs can be flexible in Because the blocks of code arrange
terms of changing something. As one themselves as the programmer codes them,
event-based code would not necessarily the flow of the program can be less logical
affect another most of the time. and obvious.
Suitable for GUI interfaces with buttons, Troubleshooting can be cumbersome and
text boxes and other elements. time consuming.
Can easily pinpoint the code or the part of Having a lot of forms, classes buttons and
the program designated to a specific other elements can make it confusing
object.
Enables the programmes to be complex These types of programmes can consume
and more interactive. more resources and the program can be
slower.
Else
End
While writing the code, it not only provides suggestions, it detects errors and provides tips to
correct the errors while coding.
Using visual studio made the programming process easy and somewhat enjoyable. If there
was no IDE available to create this project, it would take much more time and a huge amount
of effort to perform all these automated actions manually and it would be close to impossible.
There are two search buttons in this segment. The user can enter a Employee ID and search it
using the Search by ID button or the user can enter the NIC of the employee and search their
information using the search by NIC button.
This interface also has a CRUD operation where the user can Create, Read, Update and Delete
entries. Input the necessary data into the text boxes and pressing the desired button will
execute the desired task.
The salary component automatically fills the salary cycle information segment grabbing the
data from the database as the program loads. Or the user can click the refresh button to refresh
the data. The Settings button would take the user to the settings interface if there is a need to
change the settings.
The text fields for absent days, OT Hours and Gov Tax rate should be filled as per the
instructions shown in the interface. The other fields: the No Pay value, Base pay value, OT
payable and Gross salary will be filled once the user presses the Calculate button. These fields
will not take inputs from the user.
The Pay button records all the data from this interface into the SalaryInfo table in the database.
The report section generates reports on a numerous user defined conditions and the buttons
and their function is mentioned below.
17.6.1 Load all employees
This button loads the complete information of all the employees in the company database.
Figure 55: Code for All salary payments within the date range
Figure 61: The connection string has been added to App Config to be used in the class
These tools can go from line to line as needed and, on the bottom right of the screen, the
current values related to that particular line is displayed.
Figure 70: Using the debugger to see the current values of variables
While coding, visual studio provides an error count so that the programmer can correct errors
even before they run the programme. However Visual Studio debugger allows editing the
code while the debugger is running and to reload the application making the debugging
process more efficient.
The debugger is visual studio is a powerful tool that allows the programmer to debug their
code within the same environment and to remove the bugs in the program resulting in a more
robust and secure application.
Figure 72: Named textboxes and the button makes the code easy to understand