PROCESS7048 1712772218517 Unit 01 Programming Assignment - 2024
PROCESS7048 1712772218517 Unit 01 Programming Assignment - 2024
Assessor Feedback:
LO1. Define basic algorithms to carry out an operation and outline the process of programming an applicat i
LO2. Explain the characteristics of procedural, object-orientated and event-driven programming, conduct
an Integrated Development Environment (IDE).
LO4. Determine the debugging process and explain the importance of a coding standard.
P a g e 1 | 51
A.A.JASHAB AHAMAD /E194215
PROGRAMMING UNIT - 01
lOMoARcPSD|45372092
* Please note that grade decisions are provisional. They are only confirmed once internal and external
moderation has taken place and grades decisions have been agreed at the assessment board.
Assessor Feedback:
• 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.
Important Points:
1. It is strictly prohibited to use textboxes to add texts in the assignments, except for the compulsory
information. eg: Figures, tables of comparison etc. Adding text boxes in the body except for the before
mentioned compulsory information will result in rejection of your work.
2. Avoid using page borders in your assignment body.
3. Carefully check the hand in date and the instructions given in the assignment. Late submissions will not be
accepted.
4. Ensure that you give yourself enough time to complete the assignment by the due date.
5. Excuses of any nature will not be accepted for failure to hand in the work on time.
6. You must take responsibility for managing your own time effectively.
7. If you are unable to hand in your assignment on time and have valid reasons such as illness, you may apply (in
writing) for an extension.
8. Failure to achieve at least PASS criteria will result in a REFERRAL grade.
9. Non-submission of work without valid reasons will lead to an automatic RE FERRAL. You will then be asked to
complete an alternative assignment.
10. If you use other people’s work or ideas in your assignment, reference them properly using HARVARD
referencing system to avoid plagiarism. You have to provide both intext citation and a reference list.
11. If you are proven to be guilty of plagiarism or any academic misconduct, your grade could be reduced to A
REFERRAL or at worst you could be expelled from the course
12. Use word processing application spell check and grammar check function to help editing your assignment.
13. Use footer function in the word processor to insert Your Name, Subject, Assignment No, and Page Number
on each page. This is useful if individual sheets become detached for any reason.
and keep carefully detailed notes of all your sources of materials for material you have used in your work,
including any material downloaded from the Internet. Please consult the relevant unit lecturer or your course
tutor if you need any further advice.
Guidelines for incorporating AI-generated content into assignments: The use of AI-
generated tools to enhance intellectual development is permitted; nevertheless, submitted work must
be original. It is not acceptable to pass off AIgenerated work as your own.
Student Declaration
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of
plagiarism. I understand that making a false declaration is a form of malpractice.
Submission Format
The assignment submission is in the form of the following.
• The submission should be in the form of an individual written report written in a
concise, formal technical style using single spacing and font size 12. • Student has to
submit the complete GUI System with the database.
LO4. Determine the debugging process and explain the importance of a coding standard
• Contextual awareness, e.g. the ability to understand and meet the needs of individuals,
business and the community, and to understand how workplaces and organisations are governed.
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
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 Lanka Toys is a small-scale Toy building company which is in Sri Lanka and
currently they have 20 employees working at this company. Grifindo Lanka Toys is the Sri
Lankan branch of Grifindo Toys Company which is in UK and previously they have hired your
freelance company to develop their payroll system and now they are hiring you again to
develop their leave management system for the Sri Lankan branch, Grifindo Lanka Toys
Company.
Specifications for the leave management system as follows,
This leave management system has two user roles, and they are Employee and Admin, and they
are having two separate desktop applications to interact with the centralized database . Developer
can consider the centralized database as a local database for the development purposes.
1. Employee Application.
• Employee should be able to login to the system with the employee number and
the given password.
Note:- Normally an employee has 14 annual leaves, 7 casual leaves for a year and
2 shorts leaves per a month. Employee can apply casual leaves as they want
before their defined roaster starts. Annual leaves can be applied before 7 days
prior to the leave date. Short leave duration is 1 hour and 30 minutes and can be
applied for up coming time slots.
• Employee can view the status of applied leaves (Whether applied leaves are
approved or not).
• Employee can view their remaining leaves and history of applied leaves.
2. Admin Application
• Admin should be able to define the number of annual leaves, casual leaves for a
year and 2 short leaves per every month for every employee. (Newly joined
employees will less number of leaves compared to permanent employees)
• Admin should be able to define the roaster starting time and end time for each
employee.
Activity 3
3.1. Write the complete pseudocode for the employee apply leave function of the
above system. Use the visual studio IDE (using C#.net) to implement the above two
applications. Ideally there should be two separate classes for the above two applications and
the developer can decide the methods which need to include in those classes. Design the
suitable database structure for keeping the data of the above system.
Activity 4
4.1 Design and build two small GUI systems for the above scenario and those two applications
should be complete functional systems with all the functions which has described in the
above scenario with the database structure which has designed in activity 3.
4.2 Examine debugging process and the features available in Visual studio IDE for debugging
your code more easily. Evaluate how you used the debugging process to develop more
secure, robust application with examples.
4.3 Explain and outline the coding standards you have used in your application development.
Critically evaluate why a coding standard is necessary for the team as well as for the
individual.
Reading:
Aho, A. V. et al. (1987) Data Structures and Algorithms. 1st Ed. Addison-Wesley. Hunt, A.
et al. (2000) The Pragmatic Programmer: From Journeyman to Master. 1st Ed.
HN Global:
HN Global HN Global (2021) Reading Lists. Available at:
https://hnglobal.highernationals.com/learning-zone/reading-lists
Activity-01...............................................................................................................................16
01. Algorithm
6) Big o Notation
1) Programming Paradigm
Activity 03...............................................................................................................................32
02. Functions by using Visual studio IDE to implement the above algorithms
5)Uses of Visual studio IDE for my application development contrasted with not using an
05. IDE
Activity 01
1. Algorithm
The definition of an algorithm is, a step-by-step process involved by successfully completing a task. It is
possible to write algorithms in many ways and languages like English, Japanese, etc. Algorithms have
been specified precisely using an appropriate math formalism. (Anon., n.d.)
• Input: Algorithms take input data, which can be in various formats, such as numbers, text, or
images.
• Output: The result you get after computation of the input is an output. An algorithm should
have one more well- defined outputs, also they should match with the expected output. To get
precise outputs, we should know the kind of output, how much of it and the form of output, or
if there should be an output.
• Definiteness: A good algorithm should have detailed steps and the order in which the steps
should be must be taken in the process should be specified. Specifying the sequence of
operations involved in turning input to output is called Definiteness.
• Effectiveness: Algorithms are effective when all the step involved in gaining the output are
feasible with the available resources.
• Finiteness: A good algorithm should always have an end point (either the desired output or the
required response). It should not have infinite steps.
• Independent — A good algorithm has step-by-step directions which are independent
From our program code. It should run on any programming language.
1.1.2 Algorithms to display the Fibonacci series and the factorial value for a given number using
Pseudo code.
1.1.2.1 Algorithms to display the Fibonacci series for a given number using Pseudocode.
Try 1:
Start
Step 06 — if it not in the above, put else statement to return (Fibonacci (n -1) + (n - 2)) Step 07 —
End if
Step 08 — declare variable x
Step 10 — assign the value of x to n in Fibonacci(n) and print it (eg: print (Fibonacci (x)))
End
Note: this does not generate all the Fibonacci series numbers until user input number (x), but gives
the output for xt" number in the Fibonacci series.
Try2:
Start
Step 10 - else
Step 13 - print(x)
Step 14 - z = x + y
1.1.2.2 Algorithms to display the factorial value for a given number using Pseudocode
Start
Step 06 — end if
Step 07 — declare variable x, and ask user to input an int value for x
Step 08 — assign the value of x to the function above and print the answer (eg:
print(facto(x)))
This is indeed the first Step to creating a program. And it involves getting information about the program you are
about to create. It is in this stage that you determine what you want to achieve with your program, how you want
to achieve it, etc.
This information is very important for the programmer because it provides him the basis for planning about the
program and to control the possible difficulties that may arise.
2. Algorithm Design.
In this stage all the instructions which are to be performed at different stages in the program are listed in simple
English language. We may call it as a strategy.
Let's takes a simple calculator program as an example. The algorithm will be.
Figure 1
In this stage the programmer writes the instructions in a language understood by the computer to solve the
problem(s) drafted out in the previous stages. It's obvious how, many programmers jump the initial stages and
start writing bunch of codes. Because all the processes of Coding depend upon the information we obtained in the
previous stages.
NOTE: Choice of language depends entirely upon the requirements and facilities available with a language in
contrast with what you want to achieve.
5. Debugging:
Figure 2
In this stage we correct all the errors in the program, because there is a great probability of mistakes occurring
when coding.
Here the program is executed manually, called DRY RUN. This is done several times until all the errors are
removed from the program and the system become error free.
6. Testing:
This stage is similar to debugging except that In this stage we test the program by entering dummy datas (includes
usual, unusual and invalid data) to check how the behaviour of the program when given such datas.
7. Final Output:
After going through all the above stages, the program is given the TRUE DATA. Here the programmer expects
the positive results of the program and expects full efficiency of the program.
8. Documentation
Majority of programmers neglect this stage by giving many reasons, but this is very significant, because it will
encourage the programmer to find solutions to the problems that may occur in the program.
Types of documentation:
User Manual.
Technical Manual.
The User Manual provides the user with the complete information on how to operate the program, and what needs
to be done when the user encounters a problem while using the program.
The Technical Manual contains the technical information about the program. This is necessary to provide users
technical details of the program, and what to do when the system is not working as supposed or requires
modifications.
1.3 Taking a sample number to dry run the above two algorithms
ALGORITHM Fibonacci(n)
1. Initialize:
F0 = 0
F1 = 1
2. IF n = THEN
Return F0
3. ELSE IF n = 1 THEN
Return
4. ELSE
FOR I = 2 TO n DO
Fn = n-1 + F n-2
ENDFOR
5. Return Fn
ALGORITHM Factorial(n)
1. Initialize result = 1
2. IF n = 0 THEN
Return 1
3. ELSE
FOR i = 1 TO n DO
result = result * i
ENDFOR
4.Return result
Dry Run
```
F0 = 0, F1 = 1
i=2: F2 = F1 + F0 = 1 + 0 = 1
i=3: F3 = F2 + F1 = 1 + 1 = 2
i=4: F4 = F3 + F2 = 2 + 1 = 3
i=5: F5 = F4 + F3 = 3 + 2 = 5
‘’’
Final Output: 5
```
n=4
Iteration 1: result = 1 * 1 = 1
Iteration 2: result = 1 * 2 = 2
Iteration 3: result = 2 * 3 = 6
Iteration 4: result = 6 * 4 = 24
```
Final Output: 24
1.4 Examining what Big -O notation is and explaining its role in evaluating efficiencies of algorithms
Imagine you’ve written a program, and it’s working fine, but you start to notice it’s running slower with more
data. This is where Big O Notation comes into play. It’s like a mathematical microscope that lets us peek into our
algorithms and see how they perform as the size of input data grows.
Big O Notation is a way to express the worst-case scenario of an algorithm’s running time or space used, in terms
of the size of the input data. It’s like measuring the thirstiness of a car based on how much gas it guzzles as the
journey gets longer.
Why? In the worst case, you might have to look through each element in the list to find what you’re searching for.
So, if your list has ’n’ elements, in the worst case, you’ll make ’n’ comparisons.
• Bubble sort: this is simpler than linear search and binary search. It orders the numbers in
ascending order. For example, if we have a set of numbers that are not ordered, bubble sort
compares the first two numbers and if the first number is greater than the second, then it swaps
positions where the smaller number comes to the first position. Then it moves to the second
position a compares it with the third number, if it is larger than the third it swaps place where
the second
becomes smaller than the third. This process keeps on happening till there is
nothing to compare and all the numbers are in ascending order. (Anon., n.d.)
Why? Each step in binary search halves the number of elements to check. So instead of looking through ’n’ items,
you’re only looking through log₂(n) items. This makes the search extremely efficient as the size of the dataset
grows.
Why? Each Fibonacci number is the sum of the two preceding ones. With a naive recursive approach, the
number of operations doubles for each additional element. This exponential growth makes it impractical for
large ‘n’.
#declaring variables x = 0 y = 1 c = 0 z = 0
P a g e 27 | 51
A.A.JASHAB AHAMAD
/E194215
PROGRAMMING UNIT - 01
2. Python program code factorial value
def factorial(n):
result = 1
for i in range (1, n+1):
result *= i
return result
1) Programming paradigm
2) Main characteristics of
As functions are action oriented, the procedural programming paradigm does not model
real-world problems well.
• Classes are the collection of Objects and these classes are arranged in Hierarchy.
The flow within the program is driven by events such as user actions, mouse clicks, key
presses, messages from other programs, or hardware inputs.
These three paradigms are not related hierarchically, but in common usage they are mostly
nested within one another. Procedural programming can be used to create an event-driven
system. Also, Object oriented programming can be used to create an event-driven system.
Because procedural programming isn't a great fit for data-sensitive projects, some
professionals choose to use object-oriented programming instead. Object-oriented
programming functions with the idea that each sequence within a code should be self-
sustainable. Because of this, object-oriented programming can offer a code that operates
similarly to procedural programming but features steps that are each self-sustained,
working both independently and in conjunction with other tasks. In order to choose
whether to use procedural programming or object-oriented programming, you may want to
consider these differences: Data: Object-oriented programming uses mutable data, while
procedural programming uses immutable data. This means that when using object-oriented
programming, professionals can modify data after its creation within the code.
Parallel programming: Parallel programming describes a process in which the code completes
different tasks simultaneously. Object-oriented programming isn't suitable for parallel
programming, which procedural programming can support.
Flow control: In procedural programming, function calls control the flow of the code. In
object-oriented programming, conditional statements and loops control the flow.
Execution order: In procedural programming, the order in which the tasks finish isn't
important. Inversely, object-oriented programming prioritizes execution order.
Int main()
cout << “Factorial value of” << num << “is:” << fact << endl;
return 0;
figure 3 (procedural
programming for
factorial value of any
number )
self.name = name
self.Height = Height
self.number = number
plants.varCount += 1
def dispPlants(self):
MessageBoxButtons.OK, MessageBoxIcon.Information);
Figure 8
Figure 9
Figure 10
Figure 11
Figure 13
Figure 15
Developers use numerous tools throughout software code creation, building and testing.
Development tools often include text editors, code libraries, compilers and test platforms.
Without an IDE, a developer must select, deploy, integrate and manage all of these tools
separately. An IDE brings many of those development-related tools together as a single
framework, application or service. The integrated toolset is designed to simplify software
development and can identify and minimize coding mistakes and typos.
Some IDEs are open source, while others are commercial offerings. An IDE can be a
standalone application or it can be part of a larger package.
Squiggles are wavy underlines that alert you to errors or potential problems in your code
as you type. These visual clues help you fix problems immediately, without waiting to
discover errors during build or runtime. If you hover over a squiggle, you see more
information about the error. A lightbulb might also appear in the left margin showing
Quick Actions you can take to fix the error.
Code Clean-up
With the click of a button, you can format your code and apply any code fixes suggested
by your code style settings. editorconfig conventions, and Roslyn analysers. Code Clean-
Refactoring
IntelliSense
IntelliSense is a set of features that display information about your code directly in the
editor and, in some cases, write small bits of code for you. It's like having basic
documentation inline in the editor, so you don't have to look up type information
elsewhere.
Visual Studio menus, options, and properties can seem overwhelming at times. Visual
Studio search, or Ctrl+Q, is a great way to rapidly find IDE features and code in one
place.
Live Share
Collaboratively edit and debug with others in real time, regardless of your app type or
programming language. You can instantly and securely share your project. You can also
share debugging sessions, terminal instances, localhost web apps, voice calls, and more.)
Call Hierarchy
The Call Hierarchy window shows the methods that call a selected method. This
information can be useful when you're thinking about changing or removing the method,
or when you're trying to track down a bug.
CodeLens helps you find code references, code changes, linked bugs, work items, code
reviews, and unit tests, without leaving the editor.
Go To Definition
The Go To Definition feature takes you directly to the location of a function or type
definition.
Peek Definition
The Peek Definition window shows a method or type definition without opening a
separate file.
Visual programming
Visual programming can be a usage scenario that generally requires a dedicated IDE.
Visual Basic enables users to create new applications by moving programming, building
blocks, or nodes of code to create flowcharts or structure diagrams that are squared and
then compiled or applied. Square Measure supported the uniform modelling language.
This interface has become popular with Lego Mind's Storm system and is actively
pursued by a variety of companies who wish to take full advantage of custom browser
features such as those offered by Mozilla. KTechlab supports flow code and can be a
modern open-source IDE and package development machine for microcontrollers. Visual
programming is also responsible for the simplicity of distributed programming (see
LabVIEW and EICASLAB software). One of the earliest visual programming systems,
Max, was statuesque when it comes to the analog synthesizer style and has been used to
create vintage music performance packages since the 1980s. The first example was
Paragraph, a stream-based system originally developed for the Macintosh. The graphic
programming environment "Grape" is used to program fix gear units. This approach is
also used in specialized packages like Open Lab, where suggestion users want the
flexibility of a full artificial language, but not the normal learning curve that comes with
it.
Login Form
Figure 16
Figure 17
Figure 18
Leave categories
Figure 19
Figure 22
Figure 24
Figure 25
Figure 26
Coding Standard
• For naming I have followed the General naming guidelines. Example: for variables,
methods, packages – lower case with underscores.
• To build a good code I have avoided one letter names, redundant labelling, getter and
setter methods.
• One statement per line
Why coding standards is necessary for the team as well as for the individual:
Building the code quality standards reduces many problems and the risk of project failures.