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

Programming

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

Programming

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

Higher Nationals

Internal verification of assessment decisions – BTEC (RQF)


INTERNAL VERIFICATION – ASSESSMENT DECISIONS

Programme title PEARSON BTEC HND IN COMPUTING


Assessor Internal Verifier

Unit(s) Unit 01 : Programming

Assignment title

Student’s name
Pass Merit Distinction

INTERNAL VERIFIER CHECKLIST

Do the assessment criteria awarded match


those shown in the assignment brief? Y/N

Is the Pass/Merit/Distinction grade awarded


justified by the assessor’s comments on the Y/N
student work?
Has the work been assessed
Y/N
accurately?
Is the feedback to the student:
Give details:
• Constructive? Y/N
• Linked to relevant assessment criteria? Y/N
Y/N
• Identifying opportunities for
improved performance?
Y/N
• Agreeing actions?
Does the assessment decision need
Y/N
amending?

Assessor signature Date

Internal Verifier signature Date


Programme Leader signature (if required)
Date

Confirm action completed


Remedial action taken
Give details:

Assessor signature Date

Internal Verifier
Date
signature

Programme Leader
Date
signature (if required)

1
Programming
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.

Pass, Merit & Distinction Descripts P1 M1 D1

LO2. Explain the characteristics of procedural, object-orientated and event-driven programming, conduct an analysis
Integrated Development Environment (IDE).

Pass, Merit & Distinction Descripts P2 M2 D2

LO3. Implement basic algorithms in code using an IDE.

Pass, Merit & Distinction Descripts P3 M3 D3

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

Grade: Assessor Signature: Date:


Resubmission Feedback:

Grade: Assessor Signature: Date:

Internal Verifier’s Comments:

Signature & Date:

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

2
Programming
Assignment Feedback
Formative Feedback: Assessor to Student

Action Plan

Summative feedback

Feedback: Student to Assessor


My lecturer for the Programming unit. His lecturing style is perfect. He used a variety of interesting
techniques to lecture us and supported us in completing our assignment on time. He not only
encouraged us to do our best, but he also guided us to do our best.

Assessor Date
signature

Student Date
signature

3
Programming
Pearson Higher Nationals in

Computing
Unit 01: Programming Assignment 01

4
Programming
General Guidelines

1. A Cover page or title page – You should always attach a title page to your assignment. Use
previous page as your cover sheet and make sure all the details are accurately filled.
2. Attach this brief as the first section of your assignment.
3. All the assignments should be prepared using a word processing software.
4. All the assignments should be printed on A4 sized papers. Use single side printing.
5. Allow 1” for top, bottom, right margins and 1.25” for the left margin of each page.

Word Processing Rules

1. The font size should be 12 point, and should be in the style of Time New Roman.
2. Use 1.5 line spacing. Left justify all paragraphs.
3. Ensure that all the headings are consistent in terms of the font size and font style.
4. Use footer function in the word processor to insert Your Name, Subject, Assignment No, and
Page Number on each page. This is useful if individual sheets become detached for any reason.
5. Use word processing application spell check and grammar check function to help editing your
assignment.

Important Points:

1. It is strictly prohibited to use textboxes to add texts in the assignments, except for the
compulsory information. eg: Figures, tables of comparison etc. Adding text boxes in the body
except for the before mentioned compulsory information will result in rejection of your work.
2. Carefully check the hand in date and the instructions given in the assignment. Late submissions
will not be accepted.
3. Ensure that you give yourself enough time to complete the assignment by the due date.
4. Excuses of any nature will not be accepted for failure to hand in the work on time.
5. You must take responsibility for managing your own time effectively.
6. If you are unable to hand in your assignment on time and have valid reasons such as illness,
you may apply (in writing) for an extension.
7. Failure to achieve at least PASS criteria will result in a REFERRAL grade .
8. Non-submission of work without valid reasons will lead to an automatic RE FERRAL. You will
then be asked to complete an alternative assignment.
9. If you use other people’s work or ideas in your assignment, reference them properly using
HARVARD referencing system to avoid plagiarism. You have to provide both in-text citation
and a reference list.
10. If you are proven to be guilty of plagiarism or any academic misconduct, your grade could be
reduced to A REFERRAL or at worst you could be expelled from the course

5
Programming
Student Declaration

I hereby, declare that I know what plagiarism entails, namely to use another’s work and to present it
as my own without attributing the sources in the correct way. I further understand what it means to
copy another’s work.

1. I know that plagiarism is a punishable offence because it constitutes theft.


2. I understand the plagiarism and copying policy of the Edexcel UK.
3. I know what the consequences will be if I plagiaries or copy another’s work in any of the
assignments for this program.
4. I declare therefore that all work presented by me for every aspects of my program, will be my
own, and where I have made use of another’s work, I will attribute the source in the correct
way.
5. I acknowledge that the attachment of this document signed or not, constitutes a binding
agreement between myself and Pearson, UK.
6. I understand that my assignment will not be considered as submitted if this document is not
attached to the attached.

Student’s Signature: Date:


(Provide E-mail ID) (20/11/2024)

6
Programming
Higher National Diploma in Computing
Assignment Brief
Student Name /ID Number

Unit Number and Title Unit 01: Programming

Academic Year 2024/22

Unit Tutor

Assignment Title Design &Implement a GUI based system using a suitable Integrated
Development Environment

Issue Date

Submission Date

IV Name & Date

Submission Format

This submission will have 3 components

1. Written Report

This submission is in the form of an individual written report. This should be written in a concise, formal
business style using single spacing and font size 12. You are required to make use of headings, paragraphs
and subsections as appropriate, and all work must be supported with research and referenced using the
Harvard referencing system. Please also provide a bibliography using the Harvard referencing system. (The
recommended word count is 1,500–2,000 words for the report excluding annexures)

2. Implemented System (Software)


The student should submit a GUI based system developed using an IDE. The system should connect with a
backend database and should have at least 5 different forms and suitable functionality including insert, edit
and delete of main entities and transaction processing.

3. Presentation
With the submitted system 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.

7
Programming
Unit Learning Outcomes:

LO1. Define basic algorithms to carry out an operation and outline the process of
programming an application.

LO2. Explain the characteristics of procedural, object-orientated and event-driven


programming.

LO3. Implement basic algorithms in code using an IDE.

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

8
Programming
Assignment Brief and Guidance:

Activity 1

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

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


relation.

Fn = F n-1 + F n-2

B. Factorial of a non-negative integer, is multiplication of all integers smaller than or equal to


n. For example, factorial of 6 is 6*5*4*3*2*1 which is 720.

n! = n * (n - 1) * …….. 1

Define what an algorithm is and outline the characteristics of a good algorithm. Write the algorithms
to display the Fibonacci series and the factorial value for a given number using Pseudo code. Determine
the steps involved in the process of writing and executing a program and carry out an analysis of writing
the code phase by discussing the potential challenges faced.
Take a sample number and dry run the above two algorithms. Show the outputs at the end of each
iteration and the final output. Examine what Big-O notation is and explain its role in evaluating
efficiencies of algorithms. Write the Python program code for the above two algorithms and critically
evaluate their efficiencies using Big-O notation.

9
Programming
Activity 2

2.1 Compare and discuss what is meant by a Programming Paradigm and the main
characteristics of Procedural, Object oriented and Event-driven paradigms and the relationships
among them. Write small snippets of code as example for the above three programming
paradigms using a suitable programming language(s) and critically evaluate the code samples
that you have given above in relation to their structure and the unique characteristics.

Activity 3 and Activity 4 are based on the following Scenario.

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

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

10
Programming
2. Salary Component

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

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

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

No-pay-value = (Total_Salary/salary_cycle_date_range) *No_of_absent_days

Base Pay need to calculate according to the below mentioned formula

Base Pay value = Monthly_Salary + Allowances +


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

Gross Pay = Base_Pay_value – (No_pay_value +


Base_Pay_value*government_tax_rate)

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

11
Programming
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.

12
Programming
Grading Rubric
Grading Criteria Achieved Feedback

LO1 Define basic algorithms to carry out an operation and


outline the process of programming an application.

P1 Define an algorithm and outline the process in building an


application

P2 Determine the steps taken from writing code to execution.

M1 Analyse the process of writing code, including the


potential challenges faced.

D1 Evaluate the implementation of an algorithm in a suitable


language and the relationship between the written algorithm
and the code variant

13
Programming
LO2 Explain the characteristics of procedural, object
orientated and event-driven programming

P3 Discuss what procedural, object orientated and event


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

M2 Compare the procedural, object-orientated and event


driven paradigms used in given source code of an application

D2 Critically evaluate the source code of an application that


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

14
Programming
P4 Write a program that implements an algorithm using
an IDE.

M3 Enhance the algorithm written, using the features of


the IDE to manage the development process.

D3 Evaluate the use of an IDE for development of


applications contrasted with not using an IDE.

LO4 Determine the debugging process and explain the


importance of a coding standard

P5 Explain the debugging process and explain the


debugging facilities available in the IDE.

P6 Explain the coding standard you have used in your


code.

15
Programming
M4 Examine how the debugging process can be used to
help develop more secure, robust applications.

D4 Evaluate the role and purpose of a coding standard and


why it is necessary in a team as well as for the individual.

16
Programming
Acknowledgement
I am deeply grateful to lecture for exceptional and unconditional support in successful
completion of this assignment. The support immeasurable and I also thank my friends and my
subordinates who supported me in the completion of this assignment in an efficient manner.
Your sincere,

17
Programming
Table of Contents
Acknowledgement ................................................................................................................... 17

List of figure............................................................................................................................. 21

List of Table ............................................................................................................................. 23

Activity 01................................................................................................................................ 24

1.1 Algorithm ....................................................................................................................... 24

1.2 Flow Charts .................................................................................................................... 25

1.3 Pseudo Codes ................................................................................................................. 26

1.4 Fibonacci Series ............................................................................................................. 27

1.5 Factorial Number System ............................................................................................... 28

1.6 Programming Process ..................................................................................................... 29

1.7 Dry Run .......................................................................................................................... 30

1.8 Big-O Notation ............................................................................................................... 31

1.9 Python Program for Fibonacci and Factorial Number System ....................................... 32

1. 10 Efficiencies of Using Big-O Notation ......................................................................... 34

Activity 02................................................................................................................................ 36

2.1 Programming Paradigm .................................................................................................. 36

2.2 Procedural Programing ................................................................................................... 36

2.3 Object-Oriented Programing .......................................................................................... 38

2.4 Object-Oriented Programming Structure ....................................................................... 38

2.5 Event-Driven Programming ........................................................................................... 42

2.6 Characteristics of Event Driven ..................................................................................... 42

2.7 Relationship between Procedural, Event-Driven and Object Oriented Paradigm


Relationships ........................................................................................................................ 44

Activity O3 ............................................................................................................................... 45

3.1 Puesdo Code for Salary Component .............................................................................. 45

3.2 Main Menu ..................................................................................................................... 45

18
Programming
3.3 Coding For the Main Menu ............................................................................................ 46

3.4 Employee Interface......................................................................................................... 46

3.5 View employee detail ..................................................................................................... 47

3.6 Update employee detail .................................................................................................. 47

3.7 Delete employee detail ................................................................................................... 48

3.8 Employee form coding ................................................................................................... 48

3.9 Interfaces for Salary Window......................................................................................... 49

3.10 Calculation in the Salary Window................................................................................ 50

3.11 Coding in salary window .............................................................................................. 50

3.12 Interfaces for Settings Window .................................................................................... 51

3.13 IDE ............................................................................................................................... 52

3.14 Visual Studio IDE ........................................................................................................ 52

3.15 Editions in Visual Studio .............................................................................................. 52

3.16 Features of Visual Studio IDE...................................................................................... 53

3.17 Types of IDE ................................................................................................................ 55

3.18 Features of IDE help in Application Development ...................................................... 56

Activity 04................................................................................................................................ 58

4. 1 GUI Design for Grifindo Payroll System ...................................................................... 58

4.2 Login Details .................................................................................................................. 58

4.3 Main Menu ..................................................................................................................... 59

4.4 Salary Calculation Window............................................................................................ 59

4.5 Employee Window ......................................................................................................... 60

4.6 Settings Window ............................................................................................................ 61

4.7 Debugging ...................................................................................................................... 62

4.8 Error List ........................................................................................................................ 62

4.9 Error 01........................................................................................................................... 62

4.10 Error 02......................................................................................................................... 63

19
Programming
4.11 Error 03......................................................................................................................... 64

1.12 Error 04......................................................................................................................... 64

Gantt chart ................................................................................................................................ 66

References ................................................................................................................................ 67

20
Programming
List of figure
Figure 1 flowcharts .................................................................................................................. 25
Figure 2 pseudo code ............................................................................................................... 26
Figure 3 Python code for Fibonacci number system................................................................ 32
Figure 4 Positive Output of Fibonacci number system in python code ................................... 32
Figure 5 Negative Output of Fibonacci number system in python code ................................. 33
Figure 6 Python code for Factorial number system ................................................................. 33
Figure 7 Negative Output of Factorial number system in python code ................................... 33
Figure 8 Python code of Fibonacci number system using big- o notation ............................... 35
Figure 9 python code of factorial number system using big- o notation ................................. 35
Figure 10 Python code for procedural programming paradigm .............................................. 37
Figure 11 Python code for procedural programming paradigm ............................................... 37
Figure 12 Python code for object oriented programming 1 ..................................................... 38
Figure 13 Python code for object oriented programming 2 ..................................................... 39
Figure 14 program and prevents unintended ............................................................................ 39
Figure 15 Python code for event driven programming ............................................................ 43
Figure 16 driven programming ................................................................................................ 43
Figure 17 Puesdo Code for Salary Component ........................................................................ 45
Figure 18 Main Menu .............................................................................................................. 45
Figure 19 Coding For the Main Menu ..................................................................................... 46
Figure 20 Employee Interface .................................................................................................. 46
Figure 21 View employee detail .............................................................................................. 47
Figure 22 Update employee detail ........................................................................................... 47
Figure 23 Delete employee detail ............................................................................................ 48
Figure 24 Employee form coding 1 ......................................................................................... 48
Figure 25 Employee form coding ............................................................................................ 49
Figure 26 Interfaces for Salary Window .................................................................................. 49
Figure 27 Calculation in the Salary Window ........................................................................... 50
Figure 28 Coding in salary window 1 ...................................................................................... 50
Figure 29 Coding in salary window 2 ...................................................................................... 51
Figure 30 Interfaces for Settings Window ............................................................................... 51
Figure 31 Solution Explorer ..................................................................................................... 53
Figure 32 Server Explorer ........................................................................................................ 54

21
Programming
Figure 33 Properties Window .................................................................................................. 54
Figure 34 Toolbox Window ..................................................................................................... 55
Figure 35 Login Details 1 ........................................................................................................ 58
Figure 36 Login Details 2 ........................................................................................................ 58
Figure 37 Main Menu .............................................................................................................. 59
Figure 38 Salary Calculation Window 1 .................................................................................. 59
Figure 39 Salary Calculation Window 1 .................................................................................. 60
Figure 40 Employee Window 1 ............................................................................................... 60
Figure 41 Employee Window 2 ............................................................................................... 61
Figure 42 Settings Window 1................................................................................................... 61
Figure 43 Settings Window 2................................................................................................... 62
Figure 44 Error 01 .................................................................................................................... 62
Figure 45 Error 02 .................................................................................................................... 63
Figure 46 Error 03 .................................................................................................................... 64
Figure 47 Error 04 .................................................................................................................... 64
Figure 48 Gantt chart ............................................................................................................... 66

22
Programming
List of Table
Table 1 Dry run for the Fibonacci number series .................................................................... 30
Table 2 Dry run for the factorial number system ..................................................................... 30
Table 3 Procedural oriented programming and object oriented programming ........................ 41

23
Programming
Activity 01
1.1 Algorithm
Algorithm is a set of well-defined instruction in sequence to solve a problem and a
representation of solution to a problem. Suppose that you are building a system, first the
developer should plan the steps involved with the particular and those steps should be
documented. Then the developer can follow those steps.
Algorithms are built in two ways such as,
 Flow charts – graphically represents the steps
 Pseudo codes – using English language steps are included
Characteristics of an algorithm
 Unambiguous – all the steps in the algorithm should be specific and defined
 Input – an algorithm must have one or many input
 Output – an algorithm must a specified output
 Finiteness – an algorithm must end after are specific pre-determined steps
 Feasibility – all the steps should be complete efficiently in an algorithm
 Independence – an algorithm steps should be well directed and independent in any
programming code
Advantages of an algorithm
 Independent programming language
 Non- technical users also can understand the code
 Methodical structure

24
Programming
Disadvantages of an algorithm
 Time consumption is high
 Challenging complex ideas
 Difficult to demonstrate the algorithm structure

1.2 Flow Charts


A flowchart is a graphical representation of the sequence of operation in program. Shows the
sequence of instruction in a single or subroutine program. Uses boxes of different shapes and
diamond to denote different types of instruction and connected using solid lines
Advantages of flowcharts
 The logic of the program can be understand
 Ensures error free
 Basic plan of the system can be implemented
 Acts likes an road map to the programmer

Figure 1 flowcharts

25
Programming
1.3 Pseudo Codes
Pseudo code is an informal way to express the design of a computer program.
Purpose is to provide a quick idea to programmers on how to build a program systematically.
It is written in simple manner that can be easily understood by the non-technical users. Written
line by line downwards each instruction is on a separate line. In this, any programming
language is not considered because this can be converted to any programming language.
Contents of a pseudo code
 Variables
 Assignment
 Input and output
 Control structures
Advantages of pseudo code
 Enhanced readability and understandability of the algorithm
 Each line is explained what to do
 Acts as an bridge between the program and the algorithm
 Useful to for software documentation field

Figure 2 pseudo code

26
Programming
1.4 Fibonacci Series
This is a number system of combining to preceding numbers. Starting with zero and one, series
of numbers starts increasing with each numbers to be equal to the sum of two numbers
Pseudo code for Fibonacci number system
Start
Input x
Define variable x, m
Function fib (m)
If m<=1:
return m
Else:
return fib (m-2) +fib (m-1)
End if
End functions
If x>0 then
For y=0 to x step 1
Print (fib (y))
Else
Print (“please enter a positive number”)
End if
Stop

27
Programming
1.5 Factorial Number System
The total of all the integers from 1 to a specific numbers is factorial
Pseudo code for factorial number system
Start
Define variable a, b
Input b
Function fac (a)
If a==0
Return 1
Else
Return a*fac (a-1)
End if
End function
If a<0 then
print (" Please input a number that’s positive ")
else
print (“factorial is: “, fac (b))
end if
Stop

28
Programming
1.6 Programming Process
To build a system effectively and efficiently there is steps and instruction to follow.
There are five steps in this particular process such as,
1. Defining the problem
2. Planning the solution
3. Coding the program
4. Testing the problem
5. Documenting the program
Defining the problem
If a problem is identified a computerized system will be designed to cover the problem .the
information should be entered into the system and the output should the relevant the system.
System access limitation should be identified and to the relevant parties only.
Planning the solution
Once the problem analysis is done, the way to solve the problem is planned. There may be
more than one method to solve many problems. A suitable solution is identified to solve the
problem effectively.
Coding the program
A programming computer language does Creation of the system and the result of coding is a
computer program. Algorithm is required for coding (pseudo code, flow charts) that are
prepared during at the time of planning the system.
Testing the program
The system created at the development step is tested to ascertain whether it is working
accurately. To confirm that accuracy data should be entered and the result should be checked.
Effort of this step is to minimize errors and provide software with high quality to the end users.
Documenting the program
A written test document from the point of the user of the reader that describes the software or
program to its users is called program documentation.

29
Programming
1.7 Dry Run
Dry run is a simulation of code execution in which you step through instructions and track the
values of the variables and the statements. This method can use both pseudo codes and the
flowcharts.
Dry run helps us to find out the output of the program before it is written using computer
language. This will help you to confirm your logical aspect and the output of the program.
Table 1 Dry run for the Fibonacci number series

x x>0 y (fib (y)) m m<=1 fib (m-2) fib (m-1) output

3 T 0 Fib(0) 1 T 0

1 Fib(1) 1 T 1

2 Fib(2) 2 F Fib(0) Fib(1)

Fib(1) 1 T 1

Table 2 Dry run for the factorial number system

b If b<0 a a==0 fac(a-1) fac(a) output

4 F 4 F 3

3 F 2

2 F 1

1 F 0

0 T 24 FAC : 24

1 1 F

0 T 1 FAC : 1

0 F 0 T 1 FAC : 1

30
Programming
1.8 Big-O Notation
Big O notation is one of the most necessary, mathematical notations used in computer science
to measure an algorithms complexity using algebraic terms efficiently. Measures an algorithm
is form the amount of time, storage, and other resources it takes to run the algorithm and a
change in the input size. Big O notation says how well an algorithm will perform in a particular
situation. In other words, it gives an algorithms upper-bound runtime or worst-case complexity.
Common types of notation and their names
 O(1) – constant
 O(N) – linear
 O(N2) – quadratic
 (Log N) – logarithmic
 Constant O(1)
Constant time algorithm will always takes the same amount of time to be executed. The
execution time of the algorithm is independent of the size of the input
 Linear O(N)
Linear time is the time to execute the algorithm is directly proportional to the input size.
Therefore, the time taken to run the algorithm will increase proportionately as the size of input
increase
 Quadratic O(N2)
Quadratic time is the time to execute proportionally to the square of the input size.
 Logarithmic O (Log N)
Logarithmic time is the time taken to run the algorithm proportionally to the input size,

31
Programming
1.9 Python Program for Fibonacci and Factorial Number System
Python code for Fibonacci number system

Figure 3 Python code for Fibonacci number system

Positive Output of Fibonacci number system in python code

Figure 4 Positive Output of Fibonacci number system in python code

32
Programming
Negative Output of Fibonacci number system in python code

Figure 5 Negative Output of Fibonacci number system in python code

Python code for Factorial number system

Figure 6 Python code for Factorial number system

Negative Output of Factorial number system in python code

Figure 7 Negative Output of Factorial number system in python code

33
Programming
1. 10 Efficiencies of Using Big-O Notation
An efficient algorithm is one that runs as fast as possible and requires a little computer memory
as possible. Only measure of speed we can apply to an algorithm is to count the number of
operation that it has to perform to produce the result. The fewer the number of operation the
faster it will execute. The time that will take to execute is related to processor speed and amount
of memory consumed by the program.
There are three ways of exposing the performance such as best case, worst case and average
case. Consider the task of performing a sequential search on some sort of list. Best-case would
be that your target value that was found in the first element.
Worst-case could be that the value was not there at all so all the elements would have to be
compared and tested including the last. Average case would always be mid-way between the
two.
Some operation would remain constant, regardless of the size of the list. Would always execute
in one more no matter how many element there were.
That efficiency is defined as the numbers of operations an algorithm has to perform to achieve
its result. Big o notation is simply a convenient theoretical way of measuring the execution of
an algorithm, expressing its efficiency,
Big o notation says the computing time of an algorithm grows no faster as big o notation
presents a worst-case scenario than a constant multiplied. The constant is machine specific as
it’s depends on such factors as processor speed so it is not usually included in a generalized big
o notation therefore it is mostly useful included in a generalized big o notation expression. It is
most useful as a comparison measure between algorithms rather than an absolute measure.
Linear search has time efficiency where is the number of elements being searched if the list
doubles in size, the time taken also doubles. A bubble sort is determined to be of order so the
time taken quadruples doubles.

34
Programming
Python code of Fibonacci number system using big- o notation

Figure 8 Python code of Fibonacci number system using big- o notation

Python code of factorial number system using big- o notation

Figure 9 python code of factorial number system using big- o notation

35
Programming
Activity 02
2.1 Programming Paradigm
This is a programming structure can be used and employed in a specific programming or
scripting language. Every paradigm has its own structure and approach according to their
programming structure. There are multiple types of programming paradigm that can be suited
according the type of problem. A programming paradigm is simply a technique for solving
issues that uses programming language. A paradigm can be challenging based on the language
employed. In order to use a paradigm a plan must be conform to the process. Many paradigms
can be used in particular software since they are not mutually incompatible.
These are some paradigm structures that can be employed.
 Imperative- programming that uses a clear hierarchy of commands.
 Declarative- programming in which is specified rather than the method of execution.
 Structured- organized control structure are used during programming.
 Procedural-imperative style for using procedure styles in programming.
 Functional-uses functions in programming to prevent any global uses
 Object oriented-objects are created by programming that can communicate with each
other.
 Event driven-uses asynchronous action emitters and listeners during programming
 Logic- implementing some set of rules and facts during programming. Etc.

2.2 Procedural Programing


Procedural programming is a subclass of structured programming and it is based on a concept
of procedure. Procedure is a set of computing steps in scripting. Seems to be linear or a top to
down built up of one or two modules together. They are also known as functions, subroutines
and routines. Although a program is executing every given process might be launched at any
point by another procedure or by itself.
 Python code for procedural programming paradigm

36
Programming
Figure 10 Python code for procedural programming paradigm

Figure 11 Python code for procedural programming paradigm

The code defines the method ‘sum’ which only accepts the single parameter ‘sample’ a list of
sample numbers. This procedure sets the variable ‘total’ to zero. The code then uses a ‘for’
loop to repeat going over each number in the sample list, and the adding numbers one by one
to the ‘total’ variable. The program then outputs the ‘total’ variable, which indicates the sum
of all numbers. Then the code creates two list named l1‘and ‘l2’, each of the list has a set of
numbers assigned. It then makes two calls to the ‘sum’ function, supplying each list of numbers
as a parameter, and assigns the result to a variable.
And at last, the variable value the total amount of numbers, is displayed in this example, the
first call to ‘sum (l1)’ would return the total number, which is 330, and the second call to ‘sum
(l2)’ would provide the total of l2, which is 75.

37
Programming
2.3 Object-Oriented Programing
This is a frequently used language in today’s world. When a series of instruction are prepared
in other language all the instruction should be made to a single file. On certain occasion, there
were thousands of lines in that file. Main weakness of this methodology was if any errors are
detected it takes long time find the error.
Updating this methodology of programming after the implementation of the program is
complex. This language identifies the tasks of the program and includes them in separate files.
Therefore, the ability of operating the program is easy to handle, troubleshoot and add new
features.

2.4 Object-Oriented Programming Structure


Classes are user-defined types that act as the blueprint for individual objects, attributes and
methods. Objects are instances of a class created with special data.
Objects can correspond to real world objects or an entity. The description defines the object.
Methods are known as functions that are defined inside a class that describe the behaviors of
an object. Each method is a class definitions starts with a reference to an instance object.
Subroutines of the object is known as instance method. Functions are encapsulated inside one
object at a time. Attributes are defined in the class template and to represent the state of an
object. Objects stores data in the attribute field.
Python code for object oriented programming

Figure 12 Python code for object oriented programming 1

38
Programming
Figure 13 Python code for object oriented programming 2

Main principles of OOP


Encapsulation
This principles state that all information contains in an object and only the selected information
will be exposed. Each individual objects implementation and state is kept private within a
predefined class. Other objects do not have access to this class or any authority to make
changes. They can only be executed in limited number of functions or methods. These data
hiding methodologies increase the security of the program and prevents unintended data
corruption.

Figure 14 program and prevents unintended

39
Programming
In this code, the “furniture” class is defined. This has two methods, “name” and “units” as well
as two variables, “name” and “units”. Python classes have a unique function called _init_ .also
known as constructor. When a class object is created, it is called to initialize the class’s
attributes. In the above code, it accepts two inputs, “name” and “units”, and assigns them to
the relevant class attributes. This “units” method is a simple process that prints the value of the
class’s “units” attributes and needs no input.
The “name” and “units” variables of the newly created object of the “furniture” class is given
the value “chair “and “600”. Therefore, after displaying the value of the objects “name”
attributes, it calls the object “units” method, which prints the value of the objects “age”
attributes. Therefore “name: chair” and “no. of units: 600” will be displayed by the code.
Abstraction
Objects only reveal internal mechanisms that are relevant for the use of other objects, hiding
any unnecessary implementation code. The derived class can have its functionality extended.
This methodology helps the developer t make additional changes overtime.
Inheritance
Classes may reuse coding of other classes. Objects can be given relationships and subclasses,
which enable programmers to reuse similar functionality while still upholding a clear hierarchy.
This OOP speeds up the development and assures improved accuracy by requiring a more
extensive data investigation.
Polymorphism
Objects are designed to share behaviors and they can take on more than one form. The program
will determine which meaning or usage is necessary for the execution of the object from the
parent class just to reduce the duplicity of the code. Child class is created which extends the
functionality of the parent class. This allows different types of objects to pass through the
similar interfaces.
Advantages of OOP
 Able to create system features independently by the programmers
 Encapsulation are self-oriented, which are corporately developed and troubleshooting
is easier
 Codes are inherited so the duplicity of code is less
 By utilizing the reusable codes and libraries, new programs can be written faster

40
Programming
 Complex codes are hidden by encapsulation and abstraction for security and
maintenance purposes
 External system description are easy since message passing mechanisms are employed
for object commission
 Same interface can be used by variety of objects through the function of polymorphism
Table 3 Procedural oriented programming and object oriented programming

Procedural oriented programming Object oriented programming

The program is broken down into The program is broken down into
clusters known as functions clusters known as objects

The program can be specify accessed The program access include private,
public protection

Complicated to add new functions Easy to add new functions

Data hiding is less secure Data hiding is more secured

Data overloading is not possible Allows data overloading

Data hiding and inheritance is not Data hiding and inheritance are concepts
possible here used in object oriented programming

Used for designing medium level Used for designing large complex
programs programs

41
Programming
2.5 Event-Driven Programming
Is type of programming paradigm that flows the program execution determined by events such
as key press, mouse click or a message by a program. It is designed to detect events as they
occur and the deal with them using an appropriate event handling methods’. It is an extension
of interrupts driven programming of the kind found in early command line environment where
the applications are implemented as firmware such as MS DOS.
This paradigm can be written in any programming language. Some languages are specially
designed for event driven programming such as visual basis. In addition, to provide an
integrated development environment that partially automates the production of the code and to
provide a comprehensive selection of built in objects and controls. Each of which can respond
to a range of events. Object oriented and other visual languages such as visual basic, visual
C++ and java support event driven programs

2.6 Characteristics of Event Driven


Programming
Service oriented
To design special programs for services using event-driven programming is known as service-
oriented programming. Only uses a small portion of the computers processor speed, but some
services run in the background of the OS to prevent sluggish performance
Time driven
Time driven code is specialized code that runs at a predetermined interval such as every hour,
week or month to perform a suggested predetermined task. In addition, the code that runs in
response to a time trigger in the context of event driven programming. Such as windows update
where the user can choose when to update or to check for the update download
Event handlers
During an event is trigged, an event handler is a sort of function or method that takes a
particular action. Such as button click by user, shows a message and hides the message
Trigger functions
Triggers a function that chooses what code to run when a particular event occurs. Another event
handler is used to apply for an event to use
Events
Is activated in application to occur, includes mouse, keypad and user experience events. This
calls for user interactions with programmers such as button selections of keyboard and mouse

42
Programming
Python code for event driven programming

Figure 15 Python code for event driven programming

Figure 16 driven programming

43
Programming
The above code defines a function name ‘bo’ that moves the turtle forward by 100 units and
turn its left by 60 degrees. The function then sets up a timer event to call itself every 70
milliseconds using the on timer method of the turtle screen object. This will cause the turtle to
move in a repeating pattern.

2.7 Relationship between Procedural, Event-Driven and Object Oriented


Paradigm Relationships
Procedural programming means that you define a program and sub-program as a series of steps.
Object oriented programming means that is a way of organizing code around the principle of
encapsulation, inheritance, substitution of programming they are mostly procedural. Event
driven programming is all about writing event-handling procedures and having loop to the
system. Errors can be minimized and libraries in the system can be provided to use. Mostly
written in object-oriented style.
Programming problem can be solved in different approaches. The foundation of procedural
programming is the notion of decomposing a solve into smaller processes or subroutines
commonly known as function. The focus of event driven programming is to re-use the code,
maintaining the code using classes and objects. OOP places less emphasis on the programs
logic and more on data and function that operate on it.

44
Programming
Activity O3
3.1 Puesdo Code for Salary Component

Figure 17 Puesdo Code for Salary Component

In the above pseudo, code there is a function named salarycalc, which takes two arguments
named hour worked and hour rate. It starts from verifying the inputs that they are positive after
it is verified it starts to calculate the salary by multiplying the hour rate by the no. of hours
worked.
If the employees worked more than 40 hours. The function calculates the salary at rate of 1.5
times the working rate for hours that are more than 40 hours. Then it will be added to the final
salary. At last, the final salary will be returned.

3.2 Main Menu


In this window, it allows you to access to employee, salaries and settings components.

Figure 18 Main Menu

45
Programming
3.3 Coding For the Main Menu

Figure 19 Coding For the Main Menu

3.4 Employee Interface

Figure 20 Employee Interface

46
Programming
3.5 View employee detail

Figure 21 View employee detail

3.6 Update employee detail

Figure 22 Update employee detail

47
Programming
3.7 Delete employee detail

Figure 23 Delete employee detail

3.8 Employee form coding

Figure 24 Employee form coding 1

48
Programming
Figure 25 Employee form coding

3.9 Interfaces for Salary Window

Figure 26 Interfaces for Salary Window

49
Programming
3.10 Calculation in the Salary Window

Figure 27 Calculation in the Salary Window

3.11 Coding in salary window

Figure 28 Coding in salary window 1

50
Programming
Figure 29 Coding in salary window 2

3.12 Interfaces for Settings Window

Figure 30 Interfaces for Settings Window

51
Programming
3.13 IDE
An integrated development environment (IDE) is a software system that provides an
environment to programmers with a huge and wide range of tools for developing application
systems. An IDE contains debuggers, source codes and automation tools.
Advantages of utilizing an IDE
 Can be used to create drivers, utility systems and software programs
 Can be used to repair errors and support to maintain code quality
 Provides simple collaboration facilities and program resources
 Are able to convert code from high level language to the object code of the targeted
platform

3.14 Visual Studio IDE


This is system software introduced by Microsoft as an Integrated Development Environment
(IDE) to support building graphical and console application, Web application and mobile
application. This application takes support from Microsoft Platforms, Windows Store,
Microsoft Silverlight and Windows API and others. This can be utilized in Mac OS also. Nearly
36 programming language are supported in this platform.

3.15 Editions in Visual Studio


Microsoft Visual Studio is available in three editions such as,
 Community Version
 Professional Version
 Enterprise Version
Community Version
This version allows you to create your own application and programs for systems and web
platforms. This provides access to wide range of extensions and languages such as C#, VB,
C++, HTML, JavaScript and Python to code as primary function.
Professional Version
This is premium version of visual studio, which provides access to tools such as Server
Explorer, interaction with Microsoft SQL Server, Support for XML and XSLT editing. A
payment must be done to continually utilize this edition after the trial period is over.

52
Programming
Enterprise Version
This comprehensive and integrated programming solution has a strict quality size and scaling
requirements. This version has a 90 days free trail offer and the customer has to pay if he wants
to utilize it further. This version is extremely scalable and can be utilized for producing high-
end quality software programs.

3.16 Features of Visual Studio IDE


Solution Explorer
This is specific window to manage the solutions, projects and shows the complete view of the
files in a particular project that allows the user to add or remove program files and can be used
to organize them into subfolders

Figure 31 Solution Explorer

53
Programming
Server Explorer
By this, the user is able to access the servers that are connected to the particular system and
modify the databases within the server.

Figure 32 Server Explorer


Properties Window
In this particular window can be found in the view button option or by searching in the above
search box. This can be utilized to view and modify the selected object.

Figure 33 Properties Window

54
Programming
Toolbox Window
This particular toolbox window includes controls, buttons, dialog boxes, data controls, text
boxes and other control option that are needed to build a user interface of an application

Figure 34 Toolbox Window

3.17 Types of IDE


Local IDE
Developers installing and running the platform on their local machines is known as Local IDEs.
They also should have to install some libraries depending on their particular project
requirement and language.
Cloud IDE
Developers use this online on their browser without installing on the local machines. These
platforms are well-standardized environments, independent platforms and better performance

55
Programming
3.18 Features of IDE help in Application Development
The process of creating software applications is difficult. Code, user interfaces (UI), project
structure, environment parameters, and other components must all be built with interoperability
in mind. The software development process has been made simpler via efforts that have
produced a wide range of Software solutions support for a wide range of design and
development activities.

As one example, an environment for integrated development (IDE) is a group of tools. Looking
at integrated development environments suggests that you are probably a relatively Developer
with experience. If not, using a low-code is probably more appropriate for you. Platform for
development or platform for developing without coding. As opposed to an actual
IDE, it incorporates more drag-and-drop elements with basic code editors and development
tools including auto completion, class exploration, hierarchy diagrams, and compilers. They
offer nearly every tool required by a developer.

Utilizing Visual Studio and Visual Studio Code for programming improvement undertaking
would be all around as basic as choosing an IDE and a supervisor. It is not, for the most part
since Visual Code can be designed to be very near an IDE for the overwhelming majority
programming dialects. Would assume that selecting between an IDE and an editor would be
the same as deciding between Visual Studio and Visual Studio Code for every particular
software development task. It is not, mostly because VS Code can be set up to resemble an IDE
for a wide range of programming languages.

Visual Studio will function immediately out of the box if your method of development is test-
driven. On the other hand, Node.js, Go .NET, and PHP are supported by more than 15 test-
driven development (TDD) extensions for Visual Studio Code. Visual Studio handles
databases, particularly Microsoft SQL Server and its alternatives, although VS Code provides
an abundance of database extensions.

While Visual Studio offers excellent support for refactoring, Visual Studio Code handles the
fundamental refactoring functions for distinct languages. Visual Studio Enterprise can be used
for the architecture diagrams if you are a software architect and have access to it. Visual Studio

56
Programming
is a better option if you have to work with team members on development or debugging tasks.
Visual Studio Enterprise can assist you if you need to do extensive code analysis, performance
profiling, or debug.

In the data science community, VS Code is frequently used. However, the data science
workload in Visual Studio has a wide range of features. Visual Studio does not run on Linux;
VS Code does. On the other hand, Visual Studio for Windows has a Linux/C++ workload and
Azure support.

57
Programming
Activity 04
4. 1 GUI Design for Grifindo Payroll System
4.2 Login Details

Figure 35 Login Details 1

Figure 36 Login Details 2

58
Programming
4.3 Main Menu

Figure 37 Main Menu

4.4 Salary Calculation Window

Figure 38 Salary Calculation Window 1

59
Programming
Figure 39 Salary Calculation Window 1

4.5 Employee Window

Figure 40 Employee Window 1

60
Programming
Figure 41 Employee Window 2

4.6 Settings Window

Figure 42 Settings Window 1

61
Programming
Figure 43 Settings Window 2
4.7 Debugging
Debugging is a process of identifying and fixing the problems that are found on a source code
of a software program. If a system programs are unable to run there may have, an error occurred
in the source code. Using the debugging tools that are available in IDE the errors can be
checked systematically during coding. By this debugging process, the errors can be finding and
fixed in the source code. These errors can lead to malfunction or crash of the programs

4.8 Error List


4.9 Error 01

Figure 44 Error 01

62
Programming
This above error message is showing that there is implementation exception thrown. It is known
as the method or property that you are attempting to invoke has no implementation of a
function. You should not handle this error in a try/catch block. You should remove the member
invocation from your code.

4.10 Error 02
This above error message shows that the compiler cannot find the SQL connection class.
However, there is no any namespace error in your code. To fix this above code this statement
should be entered on the top line of the source code file using System.Data.SqlClient.
This above lines include the namespace that contains the SQL connection class, which will you
allow access to use the class without any issues.

Figure 45 Error 02

63
Programming
4.11 Error 03

Figure 46 Error 03

This above message shows that the compiler has found an error while debugging the error.
Above error has occurred due to missing a curly bracket in the code platform.

1.12 Error 04

Figure 47 Error 04

64
Programming
This above error is shown because the intilliSense has stopped working due to the language
service may not be running. This error can be solved by restarting the visual studio IDE or
installing a language extension.
Coding Standards
Set of standards are required to be followed by a software development agency to compile
software project effectively and efficiently. Through following coding standards, complexity
can be reduced, able to enhance the readability and maintainability of the coding structure.
Able to detect and solve errors and faults simply.
Coding Standard that have been followed by me during this project are,
 Formalizing Exception handling
 Turning on Daily Backups
 Leaving Comments
 Focusing on code readability
 Declaring Variables

65
Programming
Gantt chart

Figure 48 Gantt chart

66
Programming
References
What-an-good-algorithm/. 2020. what-an-good-algorithm/. [ONLINE] Available at:
https://www.what-an-good-algorithm/.com/what-an-good-algorithm/. [Accessed 3 January
2024].
expertsmind. 2020. what-are-the-characteristics-of-a-good-algorithm. [ONLINE] Available
at: http://www.expertsmind.com/questions/what-are-the-characteristics-of-a-good-algorithm-
3016102.aspx. [Accessed 3 January 2024].
synapseindia. 2024. software-development-process. [ONLINE] Available at:
https://www.synapseindia.com/6-stages-of-software-development-process/141. [Accessed 3
January 2024].
tutorialspoint. 2024. Search-algorithm. [ONLINE] Available at:
https://www.tutorialspoint.com/data_structures_algorithms/search_algorithm. [Accessed 6
January 2024].
w3schools. 2019. Big-o-notation-and-algorithm-analysis. [ONLINE] Available at:
https://www.w3schools.com/data-structures-tutorial/big-o-notation-and-algorithm-analysis/.
[Accessed 4 January 2024].
techdifferences. 2024. efficiency -between-linear-search-and-binary. [ONLINE] Available at:
https://techdifferences.com/ efficiency -between-linear-search-and-binary-search.html.
[Accessed 4 January 2024].
merriam. 2024. dry run. [ONLINE] Available at: https://www.merriam-
webster.com/dictionary/dry-run. [Accessed 6 January 2024].
digitalfellows. 2024. programming-paradigms. [ONLINE] Available at:
https://digitalfellows.commons.gc.cuny.edu/programming-paradigms/. [Accessed 5 January
2024].
w3schools. 2024. encapsulation. [ONLINE] Available at: https:// www.w3schools.com
/programming-fundamentals/chapter/encapsulation/. [Accessed 5 January 2024].
stackify. 2020. abstraction. [ONLINE] Available at: https://stackify.com/oop-concept-
abstraction/. [Accessed 5 January 2024].
stackify. 2020. Polymorphism. [ONLINE] Available at: https://stackify.com/oop-concept-
Polymorphism /. [Accessed 5 January 2024].
stackify. 2020. Inheritance. [ONLINE] Available at: https://stackify.com/oop-concept-
Inheritance /. [Accessed 5 January 2024].

67
Programming

You might also like