0% found this document useful (0 votes)
20 views66 pages

E180419 1703958178377 347413 Programee

Uploaded by

nehanlokuge123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views66 pages

E180419 1703958178377 347413 Programee

Uploaded by

nehanlokuge123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 66

Pearson Higher

Nationals in
Computing

Unit 01: Programming


Assignment 01

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 1


Higher Nationals

Internal verification of assessment decisions – BTEC (RQF)

INTERNAL VERIFICATION – ASSESSMENT DECISIONS

Program title Higher National Diploma in Computing

Ms. MALEESHA
Assessor Internal Verifier

Unit 01: Programming


Unit(s)

Design &Implement a GUI based system using a suitable


Assignment title Integrated Development Environment

IYNUL HIKMA HASAN


Student’s name

List which assessment Pass Merit Distinction


criteria the Assessor has
awarded.

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 student work? Y/N

Has the work been assessed


accurately? Y/N

Is the feedback to the student:

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 2


Give details:

• Constructive?
• Linked to relevant
assessment criteria?
• Finding Y/
opportunities for
N
improved performance?
Y/
• Agreeing actions?
N

Y/
N

Y/
N

Does the assessment decision need


amend? Y/N

Assessor signature Date

Internal Verifier signature Date

Program Leader signature (if


needed) Date

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 3


Confirm action completed

Remedial action
taken.

Give details:

Assessor signature Date

Internal
Verifier Date
signature

Program Leader
signature (if Date
needed)

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 4


Higher Nationals - Summative Assignment Feedback Form

Student Name/ID IYNUL HIKMA HASAN (KAN 00200526)

Unit Title PROGRAMMING

Assignment Number 01 Assessor Ms. MALEESA

Date Received
Submission Date 1st submission

Date Received 2nd


Re-submission Date submission

Assessor Feedback:

LO1. Define basic algorithms to conduct an operation and outline the process of programming an
a
Pass, Merit & Distinction Descripts P1 M1 D1

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


analysis of a suitable 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. Decide the debugging process and explain the importance of a coding standard.

Pass, Merit & Distinction Descripts P4 P5 M4 D4

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 5


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.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 6


Assignment Feedback

Formative Feedback: Assessor to Student

Action Plan

Summative feedback

Feedback: Student to Assessor

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 7


Assessor Date
signature

Student signature Date

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 8


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 is theft.


2. I understand the plagiarism and copying policy of 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 aspect 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 Edexcel UK.
6. I understand that my assignment will not be considered as gave if this document is not
attached to the attached.

Student’s Signature: Date:

(Provide E-mail ID) (Provide Submission Date)

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 9


Higher National Diploma in Computing

Assignment Brief

Student Name /ID Number

Unit Number and Title Unit 01: Programming

Academic Year 2021/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 must 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 supply 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 be given a GUI based system developed using an IDE. The
system should connect with a backend database and should have at least 5 different

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 10


forms and suitable functionality including insert, edit and deleting of main entities and transaction
processing.

3. Presentation
With the gave system students should do a presentation to demonstrate the system that was
developed. Time distributed is 10 to 15 min. Student may use 5 to 10 PowerPoint slides while
doing the presentation, but live demonstration of the system is needed. Evaluators will also check
the ability to change and debug the system using the IDE.

Unit Learning Outcomes:

LO1. Define basic algorithms to conduct 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. Decide the debugging process and explain the importance of a


coding standard

Assignment Brief and Guidance:

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 11


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, the 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. Decide the steps involved in writing and executing a program and conduct 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.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 12


Activity 2
2.1Compare 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 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 has five components and the specifications for the components
are follows,

1. Employee Component.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 13


 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. The salary cycle’s
beginning 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 part and if the user enters something else
the system should display an error message.

The admin should be able to enter the nod 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,

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 14


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 needs to be calculated according to the formula below.

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 be recorded in the
database under each employee for each month. This part 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 part should allow the admin to change parameter values such as

i. Date Range for a salary cycle. E.g.: - 30 days


ii. Salary cycle begin date.
iii. Salary cycle end date

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 15


iv. No of leaves for an employee for a year

Activity 3

Write the complete pseudocode for the salary part 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 be included
in those classes. Design a 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 have described in the above scenario with
the database structure which has been 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 a 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

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 16


Table of Contents
1.1. What is Algorithm?.............................................................................................................................21
1.2. Characteristics of good algorithms.................................................................................................21
1. Clear and unmistakable.............................................................................................................21
2. Well-Defined Inputs...................................................................................................................21
3. Well-Defined Outputs................................................................................................................21
4. Language Independent...............................................................................................................21
5. Generality....................................................................................................................................22
6. Accuracy......................................................................................................................................22
7. Understandability.......................................................................................................................22
8. Flexibility.....................................................................................................................................22
9. Maintainability...........................................................................................................................22
10. Readability..............................................................................................................................22
11. Correct output........................................................................................................................22
1.3. Pseudo Code for Fibonacci Series......................................................................................................22
1.4. Pseudo Code for Factorial..................................................................................................................23
1.5. Five steps to write a code?..................................................................................................................24
1. Find a Problem...................................................................................................................................24
3. Designing.............................................................................................................................................24
4.......................................................................................................................................................Coding 25
5.......................................................................................................................................................Testing 25
6...................................................................................................................................................Execution 25
Conclusion of steps.............................................................................................................................25
1.6. Challenges in coding...................................................................................................................25
1.7. Dry Run............................................................................................................................................28
1.8. Dry Run for Factorial Value..........................................................................................................29
1.5. Big – O – Notation..........................................................................................................................30
1.6. Python Code for Fibonacci Series......................................................................................................30

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 18


1.7. Python Code for Factorial..................................................................................................................32
2.1. Programming Paradigm.....................................................................................................................33
1. Top Programming Paradigm.........................................................................................................33
2. Procedural Programming..............................................................................................................34
3. Functional Programming...............................................................................................................34
4. Declarative Programming.............................................................................................................35
2.2. object-oriented paradigm...................................................................................................................35
2.3. Event driven.........................................................................................................................................37
3.1. Pseudo code for salary components...............................................................................................37
3.2. Database Structure..........................................................................................................................40
3.3. Visual Studio IDE Implementation....................................................................................................41
3.4. IDE Features........................................................................................................................................45
3.5. GUI System interface overview..........................................................................................................46
4.1. Debugging Process in Visual Studio................................................................................................53
4.1.1 Debugging Steps............................................................................................................................56
Breakpoint Setting..............................................................................................................................57
Stepping Through Code.....................................................................................................................57
Error List............................................................................................................................................58
4.2. Coding Standards................................................................................................................................58
4.3. What are the coding standards that I used?.....................................................................................59
4.4 . Importance of coding standards...................................................................................................60
1. Promoting the Maintenance of Code Quality...................................................................................60

2. Improving Bug Resolution Simpler...................................................................................................61

3. Ensuring adherence to regulations....................................................................................................61

4.5. The Significance of Coding Standards for Individuals............................................................62


4.6. The Significance of Coding Standards for Development Teams............................................63

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 19


Figure 1 Fibonacci code
.....................................................................................................................................................................
31
Figure 2 Factorial code
.....................................................................................................................................................................
33
Figure 3 OOP concept
.....................................................................................................................................................................
36
Figure 4 OOP concept in Payroll system
.....................................................................................................................................................................
36
Figure 5 Event driven.
.....................................................................................................................................................................
37
Figure 6 Opening page.
.....................................................................................................................................................................
42
Figure 7 New project
.....................................................................................................................................................................
43
Figure 8 Choose a Template
.....................................................................................................................................................................
44
Figure 9 Naming the project file.
.....................................................................................................................................................................
45
Figure 10 Login page
.....................................................................................................................................................................
47
Figure 11 Home page
.....................................................................................................................................................................
48
Figure 12 Employee page
.....................................................................................................................................................................
49
Figure 13 Salary page
.....................................................................................................................................................................
50
Figure 14 Branch details
.....................................................................................................................................................................
51
Figure 15 Settings page
.....................................................................................................................................................................
52
Figure 16 Debugging features.
IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 20
.....................................................................................................................................................................
54
Figure 17 Start debugging Feature.
.....................................................................................................................................................................
55
Figure 18 Stop debugging button
.....................................................................................................................................................................
56
Figure 19 Example for Breakpoint Setting
.....................................................................................................................................................................
57
Figure 20 Stepping Through Code
.....................................................................................................................................................................
57
Figure 21 Error List
.....................................................................................................................................................................
58
Figure 22 Descriptive variable names for an employee detail
.....................................................................................................................................................................
59
Figure 23 consistent indentation
.....................................................................................................................................................................
60

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 20


1.1. What is Algorithm?

An algorithm is a set of well-defined


instructions or value of inputs that produce the output
to solve a particular problem in an efficient manner.
Algorithms are guiding the computer and programs
with the set of instructions complete by a proper
output. It can also perform a task.

An algorithm is a process used to conduct a


computation or solve a problem. In either hardware-
based or software-based routines, algorithms function
as a detailed sequence of instructions that conduct
predetermined operations sequentially. Algorithms are
employed in a systematic and effective method to solve
issues or automate processes. They are a set of
instructions or rules that direct a computer or software
to complete a certain job or solve a problem.

1.2. Characteristics of good algorithms

Good algorithms make efficient problem solving.

1. Clear and unmistakable – The algorithm


should be clear. Each of its phases must
be obvious in every way and lead to just
one meaning.

2. Well-Defined Inputs – If an algorithm


requires inputs, those inputs should be
well- defined. It may or may not accept
user input.

3. Well-Defined Outputs - The algorithm


must explicitly specify and be well-
defined what output wants to be shown.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 21


It should generate at least one output.

4. Language Independent - The specified


algorithm must be language-independent,
it must be merely simple instructions. In
any language and still supply the intended
result

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 22


5. Generality – is the capacity to transport a program between computer installations; the
ability to keep a program while changing hardware; and the ability to use one program
to build another - without if.

6. Accuracy - Code must produce correct and correct results while meeting established
requirements and expectations. All calculations, conditions, and operations must be
error- free.

7. Understandability - You should write your code so that you and other developers can
easily understand it in the future. Understanding will be meaningful remarks and simple,
intuitive reasoning.

8. Flexibility - Without requiring significant alterations, code should be able to adjust to


additions and changes. It creates with an abstraction level that makes adding new
features and customizations simple.

9. Maintainability - Code must be easy keep Modular programming, proper


concern separation, and documentation to support upcoming updates and bug
fixes are all examples of this.

10. Readability - Clear and consistent writing style is important for code. Code that is
easy to read and understand should have consistent formatting, naming conventions,
and indentation.

11. Correct output - The code must produce output that meets the specified
requirements and expectations. This requires thorough testing to ensure that your
code behaves correctly in different scenarios and can manage edge cases properly.

1.3. Pseudo Code for Fibonacci Series

1.) Function Definition: - def Fibonacci(n): defines a function named Fibonacci that takes an
integer.
parameter n.

2.) Initialization: - a = 0 and b = 1 initialize the first two numbers of the Fibonacci sequence.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 23


3.) Printing Initial Numbers: - print(a) and print(b) print the first two numbers.

4.) Fibonacci Sequence Calculation: - The for loop iterates n - 1 times (specified by range (n - 1))

5.) In each iteration: - c = a + b calculates the next Fibonacci number.


a = b and b = c updates the values for the next iteration.
print(c) prints the calculated Fibonacci number.

6.) Function Call: - Fibonacci (12) calls the function with argument twelve, showing that we
want to generate the first twelve numbers of the Fibonacci sequence.

1.4. Pseudo Code for Factorial

1.) Function Definition (def fac(n): - The function fac is defined to calculate the factorial of
a given number n.

It uses recursion, which means the function calls itself.

2.) Base Case (if n == 0:) - The function checks if n is equal to 0. If true, it returns

1. This is the base case that stops the recursion. The factorial of 0 is defined to be 1.

3.) Recursive Case (else:) - If n is not zero, the function returns n * fac (n - 1).

It multiplies n by the result of calling the fac function with the argument n - 1.

This is the recursive step, where the problem is broken down into smaller subproblems.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 24


4.) User Input (a = int (input ("Enter a number: "))) - The user is prompted to enter a number,
and the input is converted to an integer (int).

The entered value is assigned to the variable a.

5.) Function Call (b = fac(a)) - The fac function is called with the user-entered value

a. This starts the recursive calculation of the factorial.

6.) Print Result (print(b)) - The result of the factorial calculation is stored in the variable

b. The result is printed on the console.

1.5. Five steps to write a code?

1. Find a Problem

Finding and understanding the problem that needs to be solved is the first stage in the
coding process. To do this, it is necessary to have a thorough understanding of the specifications,
limitations, and expected outcomes.

2. Solution for the Problem

Developing a solution is the next stage after finding the problem. This includes figuring
out the method or algorithm to use to address the issue. Examine several practical options and
decide which best satisfies the requirements.

3. Designing

The next stage is to plan the structure of the code when you have determined the answer
to the problem. This entails defining variables, classes, and functions as well as how they will all
interact. To solve the problem, you should also divide the problem into smaller components and
arrange how these will work together.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 25


4. Coding

The next step is to start writing the code, which comes after planning and designing the
programme. In this step, the algorithm that was made during the design part is changed into a
certain programming language. It is important to follow the best coding practices, pay attention
to the structure of the language being used, and make sure the code is simple to read and keep up
to date. Different writers will be able to understand and use the code better in the future.

5. Testing

Testing is an essential step to ensure the proposed solution works as designed. It includes
checking the code with different inputs, including edge cases. For our example, testing would
involve supplying different lists of numbers and verifying that the average is calculated correctly.

6. Execution

After conducting thorough testing, the code has been considered ready to be run. This
includes running the program and seeing how it behaves. In our specific case, executing the code
involves inputting a list of numbers and then obtaining the average of those numbers through the
program's calculations.

Conclusion of steps

programming is more than just creating code; it is a complete process that integrates
problem-solving, meticulous planning, and thorough testing. This holistic method ensures not
only the creation of functional code but also its reliability and utility in practical situations. Each
step plays a crucial role in supplying a successful and effective solution.

1.6. Challenges in coding

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 26


Syntax and logic errors are regular challenges faced by programmers during coding.
Syntax errors occur when the code violates the rules and structure of the computer language,
resulting in grammatical mistakes that prevent successful compilation or execution. On the other
hand, logic errors appear when the code's algorithm or logic is flawed, leading to unintended and
incorrect results even though the code may run without syntax issues. Runtime errors, in
contrast, occur during the execution of a program when unexpected events prevent the program
from continuing. These errors, such as division by zero or trying to access an index that doesn't
exist, result in the termination of the program and the generation of error messages. While syntax
and logic errors are found during the coding phase, runtime errors become obvious only when
the program is executed, making them a unique challenge in the debugging process.

1. Syntax Error - Syntax errors occur when the code violates the rules of a programming
language. These errors find by the compiler or interpreter during the compilation or
execution phase.
Syntax errors are mistakes in the structure of a program's code that prevent it from being
properly run. These mistakes appear when the rules of the programming language are not
followed, such as incorrect placement of punctuation, misspelled keywords, or improper use
of brackets and parentheses. When a syntax error occurs, the program will not run and an
error message will be displayed, showing the exact location and nature of the error.

Example: Forgetting to close a parenthesis or using an incorrect keyword.

2. Logical Error - Logical errors are more subtle and harder to find. They occur when there is a
flaw in the algorithm or the overall logic of the program, leading to unexpected behavior.
Logic errors, also known as conceptual errors, occur when a program runs correctly but
produces incorrect results due to a mistake in the logic of the code. These errors aren't
detected by the compiler or interpreter and can be difficult to identify and fix. They can come
from incorrect assumptions, flawed thinking, or faulty understanding of the problem being
solved.
Example: Incorrect conditional statements that do not produce the intended outcome.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 27


3. Runtime errors – Runtime - errors refer to errors that appear while a program is running.
These errors can happen when a program is executing and can cause the program to end or
act unexpectedly. Runtime errors are often caused by problems such as division by zero,
accessing an array piece out of bounds, or using a variable before it has been initialized.
Unlike syntax errors, which are caught by the compiler, runtime errors are not discovered
until the program is running.

4. Time Management - Time management in programming involves effectively planning


and distributing time for various tasks in the software development life cycle, such as
coding, testing, debugging, and documentation.

5. Importance - Efficient time management ensures that projects are completed on time and
deadlines are met.

6. Variable Declaration - Variables are containers for storing data values in a program.
Variable declaration involves specifying the data type and name of a variable before
using it in the program.

7. Creating algorithm - involves designing a set of well-defined instructions to perform a


specific task or solve a problem.
Example: Designing an algorithm to find the maximum value in an array.

8. Testing - Testing is an important stage in software development in which the code for
defects and its functionality is proven to verify it satisfies the defined criteria.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 28


1.7. Dry Run
Dry Run for Fibonacci Series

A=B B=C C=A+B C (Output)


0
1 0 1+0 1
0 1 0+1 1
1 1 1+1 2
1 2 1+2 3
2 3 2+3 5
3 5 3+5 8
5 8 5+8 13
8 13 8+13 21
13 21 13+21 34
21 34 21+34 55
24 55 24+55 89
55 89 55+89 114

Initial Values

A=1
B=0
C=A+B=1+0=1
First Iteration (Output Column)

C (Output) is initialized as 0.
The values of A, B, and C are updated.
A=B=0
B=C=1

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 29


C=A+B=0+1=1
Output: 0

Later Iterations

 Each row is an iteration.


 The values of A, B, and C are updated based on the expressions.
 The Output column shows the value of C from the earlier iteration.
 The process continues until the desired number of iterations.

Example (Row 4):

A = 1 (from the earlier row)


B = 1 (from the earlier row)
C=A+B=1+1=2
Output: 1 (from the earlier row)

Final Iteration (Row 12)

 The process continues until the 12th row.


 A, B, and C values are updated accordingly.

The final output is 114.

1.8. Dry Run for Factorial Value

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 21


0
1.5. Big – O – Notation

Big O documentation particularly illuminating a treasure's worst-case complicatedness


through algebraic conditions. By engaging a standardized prose to illustrate time and scope
complicatedness, it aids planners in making aware resolutions about algorithm pick. This
examining method is especially stressed and widely used at guests like Meta. Expressing the
adeptness of algorithms in terms momentary and room complexity is aiding in sharpening
builders' skills and helping the concoction of optimized resolutions. Understanding and
administering Big
O notation is specifically suitable in dynamic and capability-exhaustive environments, making it a
Num Fac Fac*Num Output
necessary 5had the toolkit for planners aiming to become proficient their art, especially inside
associations
5-1=4such as
20Meta. 5*4 20
4-1=3 2 20*3 60
3-1=2 1 60*2 120
2-1=1 0 120*1 120
1-0=0

1.6. Python Code for Fibonacci Series

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 30


def Fibonacci(n):
a=0
b=1
print(a)
print(b)
for I in range (n - 1):
c=a+b
a=b
b=c
print(c)
Fibonacci (12)

Figure 1 Fibonacci code

The time complexity of the given Fibonacci code is O(n) because it uses a single loop that
iterates from 0 to n-1, and within each iteration, constant time operations are performed. The space

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 31


complexity is O (1) because the algorithm uses a constant amount of space to store variables (a,
b, c) regardless of the input size.

1.7. Python Code for Factorial

def fac(n):

if n == 0:

return 1

else:

return n * fac (n - 1)

a = int (input ("Enter a number: "))

b = fac(a)

print(b)

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 32


Figure 2 Factorial code

Time Complexity - The time complexity of this recursive factorial algorithm is O(n),
where n is the input number. This is because the function makes a recursive call for each value
from n to 1, and each call involves constant time operations.

2.1. Programming Paradigm

Programming paradigms refer to different approaches and styles in which a program or


programming language can be structured. Each paradigm has its own set of structures, features,
and ideas on how to solve common programming problems.

1. Top Programming Paradigm

Imperative programming is a paradigm that focuses on describing how a program should


achieve its goals by supplying a sequence of statements that change a program's state. It stresses

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 33


the step-by-step execution of commands, and the control flow is explicit. In imperative
programming, you specify the exact steps the computer should take to perform a job.

Key Features

 Uses statements that clearly change program state.


 Emphasizes the order of action.
 Common use of loops and conditionals to control flow.

2. Procedural Programming

Procedural programming is a subset of imperative programming that organizes code into


processes or routines. A procedure is a self-contained block of code that performs a specific job.
The focus is on procedures, which may have input parameters and return values, making it easier
to break down difficult problems into simpler, manageable parts.

Key Features

 Organizes code into procedures or functions.


 Uses procedures to organize the program.
 Emphasizes flexibility and reusability.

3. Functional Programming

Functional programming sees computation as the evaluation of mathematical functions


and avoids changing state and mutable data. It is based on the idea of functions as first-class
citizens, meaning functions can be passed as arguments to other functions and returned as values.
Immutability (unchangeable data) and the avoidance of side effects are key concepts in
functional programming.

Key Features

 Emphasizes the use of pure functions (no side effects).


 Avoids changeable state, promoting immutability.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 34


 Supports higher-order functions and function building.

4. Declarative Programming

Declarative programming focuses on specifying what a program should perform without


specifying how to achieve it. It focuses on expressing the logic of the computation, and the
control flow is abstracted away. Declarative languages often use descriptive statements or rules
to describe relationships and constraints, leaving the interpreter or compiler to decide the
execution details.

Key Features

 Specifies the expected outcome without specifying the steps.


 Emphasizes the "what" over the "how."
 Commonly used in database queries, markup languages, and some parts of
functional programming.

2.2. object-oriented paradigm

you build a system by using objects that have both data and the actions that can be
performed on that data. In a payroll system, for instance, there might be objects that stand for
workers, payroll data, and tax calculations. Each of these objects would hold the relevant data
and the methods for performing tasks related to that data. This method allows for a more
organized and modular system design.

Object-oriented paradigm is a way of designing and developing software systems based on the
concepts of objects, classes, inheritance, polymorphism, and encapsulation. It helps to create
modular, reusable, and maintainable code that can model complex real-world problems.

A payroll system is a software application that manages the payment of employees in an


organization. It typically involves calculating salaries, deductions, taxes, benefits, and other
aspects of payroll. A payroll system can be implemented using object-oriented paradigm in C#.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 35


Figure 3 OOP concept

Figure 4 OOP concept in Payroll system

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 36


2.3. Event driven.

Event-driven architecture is a way of designing software applications where the various parts of
the system interact and share inf ormation through events. These events are captured,
Figure 5 Event driven.
communicated, and processed between various parts of the system, allowing for asynchronous
communication and task accomplishment. This approach allows the system to be more flexible
and scalable, as well as allowing for better decoupling of services.

3.1. Pseudo code for salary components

 Method: Calculate Salary (employee, SalaryCycleBeginDate, salaryCycleEndDate)


 Input: employee details, salary cycle begin date, salary cycle end date
 Output: no-pay value, base pay value, gross pay value

// Step 1: Confirm the date range //

If start Date is after end Date:

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 37


Display Error ("Invalid date range entered.")

Return

// Step 2: Calculate attendance and absent days //

attendance = Calculate Attendance (employee, salaryCycleBeginDate,


salaryCycleEndDate)

absent Days = salaryCycleEndDate - attendance

// Step 3: Calculate No-pay value //

Hopevale = Calculational (employee. total Salary, salaryCycleEndDate, absent Days)

// Step 4: Calculate Base Pay value //

basipetal = Calculate Base Pay (employee. monthly salary, employee. Allowances,


employee. overtime Rate, employee. number of Overtime Hours)

// Step 5: Calculate Gross Pay value //

grossPayValue = Calculate Gross Pay (basipetal, noPayValue, employee.


governmentTaxRate)

// Step 6: Save calculated values to the database //

SaveToDatabase (employee, salaryCycleBeginDate, salaryCycleEndDate, Hopevale,


basePayValue, grossPayValue)

// Step 7: Display results or generate reports if needed //

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 38


Display Results (employee, salaryCycleBeginDate, salaryCycleEndDate, Hopevale,
basePayValue, grossPayValue)

Method: Calculate Attendance (employee, start Date, end Date)

// Calculate attendance based on employee records within the date range //

// Return the number of attended days //

Method: Calculational (total Salary, salaryCycleEndDate, absent Days)

// Calculate No-pay value using the given formula //

Return (total Salary / salaryCycleEndDate) * absent Days

Method: Calculate Base Pay (monthly Salary, allowances, overtime Rate, number of Overtime
Hours)

// Calculate Base Pay value using the given formula //

Return monthly Salary + allowances + (overtime Rate * numberOfOvertimeHours)

Method: Calculate Gross Pay (base Pay, Hopevale, government Tax Rate)

// Calculate Gross Pay value using the given formula //

Return base Pay - (noPayValue + base Pay * government Tax Rate)

Method: SaveToDatabase (employee, start Date, end Date, noPayValue, basePayValue,


grossPayValue)

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 39


// Save calculated values to the database under each employee for each month

Method: Display Results (employee, start Date, end Date, noPayValue, basePayValue,
grossPayValue)

// Display the calculated results or generate reports as needed

Method: Display Error(message)

// Display an error message to the user

3.2. Database Structure

Simplified database Structure

-- Employee Table

CREATE TABLE Employee (

Employed INT PRIMARY KEY,

Name VARCHAR (255) NOT NULL,

Monthly Salary DECIMAL (10, 2) NOT NULL,

Overtime Rate DECIMAL (5, 2) NOT NULL,

Allowances DECIMAL (10, 2) NOT NULL,

-- Add other employee-related fields as needed

);

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 40


-- Salary Record Table

CREATE TABLE Salary Record (

Recorded INT PRIMARY KEY,

Employed INT,

FOREIGN KEY (employee) REFERENCES Employee(employee),

Date Range VARCHAR (50) NOT NULL,

Base Pay DECIMAL (10, 2) NOT NULL,

No Pay DECIMAL (10, 2) NOT NULL,

Gross Pay DECIMAL (10, 2) NOT NULL,

-- Add other salary record fields as needed

);

-- Settings Table

CREATE TABLE Settings (

Parameter INT PRIMARY KEY,

Date Range VARCHAR (50) NOT NULL,

SalaryCycleBeginDate DATE NOT

NULL, SalaryCycleEndDate DATE NOT

NULL, LeavesPerYear INT NOT NULL,

-- Add other settings-related fields as needed

);

3.3. Visual Studio IDE Implementation

1. Open Visual Studio IDE.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 41


2. Click on "File" -> "New" -> "Project..."

3. Choose a suitable project template (e.g., Console App or Windows Forms App).

4. Name your project and click "Create."

Figure 6 Opening page.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 42


Figure 7 New project

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 43


Figure 8 Choose a Template

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 44


Figure 9 Naming the project file.

3.4. IDE Features

An Integrated Development Environment (IDE) is a comprehensive software suite that


supplies a centralized and unified platform for software developers to manage, streamline, and
perfect the entire software development life cycle. An IDE typically combines various tools,
functionalities, and features, allowing developers to perform tasks such as coding, debugging,
testing, and deployment within a single integrated environment.

 Toolbox: -Developers can easily drag and drop controls onto design surfaces.

 Error List - Allows developers to quickly find syntax errors or other issues.: Clicking on
an error in the list navigates directly to the corresponding code.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 45


 Solution Explorer: - Easily navigate through the structure of the solution and its projects,
manage project files, add new files, and organize resources, Right-clicking on items
supplies context-specific actions.

 Property Window: -The Property Window allows developers to see and change the
characteristics of specific items. This can help them customize the behavior and
appearance of their code more easily and efficiently.

 Code Editor: Supplies syntax highlighting, auto-completion, and error checking for
efficient coding.

 Integrated Debugger: Eases finding and fixing bugs during development.

 Project Management: Allows organizing files, dependencies, and resources in a


structured manner.

 Version Control Integration: Supports collaboration and tracking changes in the codebase.

 Built-in Tools: Offers tools for unit testing, profiling, and performance analysis.

 GUI Design: For Windows Forms or WPF applications, Visual Studio supplies a drag-
and- drop GUI designer.

3.5. GUI System interface overview

Visual Studio, a widely embraced IDE, is renowned for crafting GUIs tailored to
Windows applications. The GUI's primary aim is to supply a user-friendly interface, enhancing
the overall user experience. With drag-and-drop functionality, pre-built controls, and
customizable templates, Visual Studio aids developers in the intricate process of GUI design and
implementation. Its versatility is highlighted by extensive support for programming languages
like C#, Visual Basic, and C++. This comprehensive suite of resources streamlines the creation
of visually captivating and user-intuitive interfaces for Windows applications.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 46


Figure 10 Login page

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 47


Figure 11 Home page

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 48


Figure 12 Employee page

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 49


Figure 13 Salary page

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 50


Figure 14 Branch details

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 51


Figure 15 Settings page

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 52


Gracindo Payroll System boasts a comprehensive set of features, each intricately
designed to streamline the payroll management process. The system encompasses dedicated
pages for Settings, Employee Details, Branch Information, and Att

endance tracking. Users receive help from a seamless interface where they can effortlessly insert
and update dates, easing efficient management of employee attendance. The system ensures user
convenience with a convenient 'exit-back' function.

Key functionalities include the ability to add and manage employee details, ensuring a
comprehensive database. The calculation of salaries is simplified through the inclusion of a
'calculate value' button, allowing for the swift determination of No Pay, Base Pay, and Gross
Pay. Branch details further enhance the system's versatility, The Report page serves as a valuable
tool for employees to communicate problems, the Settings page empowers administrators to fine-
tune the Gracindo Payroll System according to the evolving needs of the organization.

4.1. Debugging Process in Visual Studio

Debugging is an essential tool in software development, crucial for finding and


efficiently rectifying errors. It entails a thorough examination of code to detect and address issues
that may result in errors or unexpected behavior. Debugging tools play a pivotal role in this
process by empowering developers to systematically traverse their code, check variable values,
and precisely pinpoint the source of problems. The use of debugging tools significantly enhances
efficiency by swiftly finding errors, enabling developers to streamline the resolution process.
This efficient debugging approach ultimately contributes to the creation of more reliable and
robust software applications.

It seems like you're referring to the process of starting a debugging session in VS. When you're
working on a software project in Visual Studio, you can use the "Start Debugging" button (often
represented by a green arrow) in the toolbar to run your application in debug mode. Pressing F5
on keyboard

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 53


Figure 16 Debugging features.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 54


Figure 17 Start debugging Feature.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 55


Figure 18 Stop debugging button.

Example of Debugging

an issue with the calculation of Gross Pay for employees. The Gross Pay is computed using the
formula.

 The Gross Pay is displaying incorrect values, and the team has received reports
from users about discrepancies in salary calculations.

Gross Pay=Base Pay− (No Pay Base Pay Government Tax Rate)

4.1.1 Debugging Steps

1. Setting Breakpoints

2. Stepping Through Code

3. Variable Inspection

4. Finding Calculation Error

5. Fix Implementation

6. Re-testing

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 56


Breakpoint Setting

Breakpoints are a powerful debugging feature that enables developers to pause the
execution of a program at a specific line of code. This aids in inspecting the program
state, variables, and finding errors more effectively.

Figure 19 Example for Breakpoint Setting

Stepping Through Code

When a program meets a function or method call, using "Step Into" allows you to jump into the
called function/method and inspect its behavior. This is particularly useful for understanding
how a specific function works and what happens inside it during execution. Step Into is a
valuable tool for debugging and troubleshooting code, as it supplies a way to track the flow of
execution and find any issues.

Figure 20 Stepping Through Code

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 57


Error List

The "Error List" is a crucial tool for developers, supplying a comprehensive overview of
errors, warnings, and messages met during the compilation or build process of a project. It serves
as a combined view of potential issues within the code, “Error List" displays errors that occur
during the compilation or build process. These errors prevent the successful creation of an
executable program.

Figure 21 Error List

4.2. Coding Standards

Coding standards, also referred to as coding guidelines or programming style guides, are a set of
rules and conventions that developers adhere to while writing code. These standards define the
structure, formatting, and organization of code to ensure a consistent and readable codebase. The
primary goals of coding standards include keeping code quality, enhancing readability, and
promoting collaboration among developers.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 58


4.3. What are the coding standards that I used?

Descriptive Variable and Method Names

// Descriptive variable names for an employee detail //

Descriptive variable names are names that are given to storage locations (variables) in a
program. The aim is to choose names that clearly and accurately describe the content or purpose
of the variable.

Figure 22 Descriptive variable names for an employee detail

// Descriptive method names related to Salary //

Descriptive method names are names that are given to functions or procedures in a
program. These names should clearly communicate the action or operation that the method
performs. In other words, the name of the method should describe what it does in a clear and
understandable way. This makes it easier for other programmers to understand and use the
method in their own code.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 59


Consistent Indentation

// consistent indentation //

Consistent indentation is crucial for readability and understanding the code, as it helps to
clearly find the scope of different elements such as loops, conditionals, and functions. It also
makes the code easier to keep and change, as it supplies a clear visual representation of the
code's structure. In C#, it is common to use four spaces for each level of indentation.

Figure 23 consistent indentation

Commenting Practices

// Commenting Practices //

Commenting practices entail inserting descriptive comments within code to offer explanations,
clarifications, or context for different sections. These comments function as a type of
documentation, aiding developers in understanding the code's functionality, logic, and purpose.
Here's a brief overview of commenting practices.

4.4 . Importance of coding standards

1. Promoting the Maintenance of Code Quality

Coding standards give developers a set of rules they can consistently adhere to, which
simplifies the task of keeping code quality. This guarantees that throughout time, the codebase
will continue to be stable and compliant with best practices.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 60


2. Improving Bug Resolution Simpler

Debugging becomes easier and bug resolution happens more quickly when coding
standards are followed. A more effective development cycle is eased by developers being able to
quickly detect and address problems thanks to consistent coding methods.

3. Ensuring adherence to regulations

Following coding guidelines makes it easier for businesses to follow industry rules and
official code guidelines. This is particularly important in industries where compliance with
certain standards is needed for certification or legal reasons.

1. Improving the Security of Code:

Code security is greatly enhanced by coding standards. Development teams can lower the
risk of security breaches and guarantee the confidentiality and integrity of the code by
proactively addressing potential vulnerabilities and integrating safe coding practices into the
standards.

2. Reduce Cost and Faster Time-to-Market:

Adhering to coding standards can lead to faster time-to-market and lower costs. Maintaining
a standardized codebase saves time and resources needed for continuous development and
upgrades. It also quickens the development process, which enables products to hit the market
sooner.

Coding standards which I used in the system.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 61


1. Using variables naming
2.Consistent camel case
3. Comments for Clarity

4.5. The Significance of Coding Standards for Individuals

1. Readability and Clarity: - Coding standards improve the readability and clarity of
code.
People can navigate and understand well-formatted, consistent code with ease.

2. Cooperation and Teamwork: - Coding standards give team members a common


language to communicate in.
This encourages cooperation, making it possible for people to cooperate and understand
one another's code.

3. Error Prevention: - Regular coding procedures aid in the avoidance of frequent


mistakes. More resilient code can be written by individuals, which lowers the possibility
of errors being introduced.

4. Efficient Code Review: - The code review procedure is streamlined by coding


standards. People gain from evaluations that are completed more quickly and effectively,
guaranteeing code quality.

5. Knowledge Transfer: - Knowledge transfer is made easier by coding standards. It


takes less work for people to join or leave a project knowing the coding rules and styles.

6. Maintainability: - Long-term initiatives require well-maintained code. Code


that adheres to defined standards is easier for people to update and keep.

7. Professional Development: - Professionalism is proved by the following coding


standards.
People can further their professional development by proving their dedication to best
practices.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 62


8. Consistent Style: - A consistent code style is mandated by coding standards. A
uniform and standardized approach helps individuals and strengthens the cohesiveness of
the codebase.

9. Code Efficiency: - Efficient coding techniques are encouraged by adhering to coding


standards.
It is possible for everyone to build performance-focused and optimized code.

10. Adaptability to Change: - Code is flexible due to coding standards. Code is easily
extensible and modifiable by anyone, allowing it to adapt to changing project
requirements.

4.6. The Significance of Coding Standards for Development Teams

1. Consistency Throughout Projects: - Coding standards offer a collection of


standardized procedures that guarantee consistency throughout every project in a group.
It is easier for developers to move between projects with ease because of this uniformity.

2. Better Code Readability: - Code readability is improved by standard coding techniques.


A shared set of conventions among team members makes it easier for everyone to
understand, check, and update the code.

3. Ease of Collaboration: - Several engineers often work in teams, sharing a single


codebase. Coding standards guarantee that all team members can understand and
contribute to the codebase, setting up a common language that promotes productive
teamwork.

4. Shorter Learning Curve for New Developers: - When coding standards are followed,
new developers can rapidly become up to speed with the codebase. As a guide, the
standardized processes lessen the learning curve for new employees.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 63


5. Quicker Code Reviews: - The process of reviewing code is accelerated by coding
standards. Code reviews are completed more quickly and effectively when reviewers
concentrate on logic and functionality rather than formatting and style concerns.

6. Preventing Common Errors: - Coding guidelines often incorporate recommended


practices that aid in avoiding frequent programming mistakes. This initiative-taking
approach aids in the creation of code that is more dependable and error-free.

7. Maintainability and Long: - Term Sustainability: The codebase's long-term


sustainability and maintainability are guaranteed by a consistent coding style. It also
makes updating and improving code easier and less likely to turn into a knotted mess
over time.

8. Effective Onboarding Procedure: - When coding standards are followed, new team
members can integrate into the development process more quickly. It supplies a defined
set of guidelines and expectations, which eases their ability to contribute successfully.

9. Cross-Team Collaboration: - Coding standards make it easier for teams in larger


organizations with numerous development teams to collaborate with one another. When
teams must collaborate on related projects, shared standards ease a more seamless
integration process.

10. Consistent Outcome and Quality Assurance: - Coding standards play a part in overall
quality assurance. By ensuring that the team consistently delivers high-quality code, they
lessen the possibility of errors or inconsistencies being introduced.

IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 64


IYNUL HIKMA HASAN PROGRAMMING (UNIT-01) 65

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy