0% found this document useful (0 votes)
390 views54 pages

G.Malshi Dilinika - Programming

Programming assignment

Uploaded by

Malshi Dilinika
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)
390 views54 pages

G.Malshi Dilinika - Programming

Programming assignment

Uploaded by

Malshi Dilinika
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/ 54

Higher Nationals

Internal verification of assessment decisions – BTEC (RQF)


INTERNAL VERIFICATION – ASSESSMENT DECISIONS

Programme title Higher National Diploma in Computing

Mr.Tharindu Wijethilaka Mr.Sahan


Assessor Internal Verifier Devinda

Unit(s)
Programming
Assignment title
G.Malshi Dilinika
Student’s name
List which assessment criteria Pass Merit Distinction
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 Y/N
student work?
Has the work been assessed
accurately? Y/N
Is the feedback to the student:
Give details:
• Constructive?
• Linked to relevant assessment
Y/N
criteria? Y/N
• Identifying opportunities for improved Y/N
performance? Y/N
• Agreeing actions?
Does the assessment decision need
amending? Y/N

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
signature Date
Programme Leader
signature (if required) Date

Higher Nationals - Summative Assignment Feedback Form


Student Name/ID G.Malshi Dilinika
Unit Title Programming
1
Assignment Number Assessor
2023/12/30 Date Received 1st
Submission Date submission
Date Received 2nd
Re-submission Date submission
Assessor Feedback:
ss of
LO1. Define basic algorithms to carry out an operation and outline the proce programming an application.
Pass, Merit & Distinction Descripts P1 M1
D1
driven programming, conduct an
LO2. Explain the characteristics of procedural, object-orientated and event- 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 codi ng standard.
Pass, Merit & Distinction Descripts P4 P5 M4 D4

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.
Assignment Feedback
Formative Feedback: Assessor to Student

Action Plan

Summative feedback

Feedback: Student to Assessor

Assessor Date
signature

Student Date
signature
Pearson Higher Nationals in
Computing
Unit 01: Programming
Assignment 01

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
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 Edexcel 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) (Provide Submission Date)

Higher National Diploma in Computing


Assignment Brief
Student Name /ID Number G.Malshi Dilinika

Unit Number and Title Unit 01: Programming

Academic Year 2021/22

Unit Tutor Mr.Tharindu Wijethilaka


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

Issue Date 2023/11/25

Submission Date 2023/12/30

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.

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
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.
Activity 2
2. Compare andwhais meant by a Programming an the
1 discuss t Paradigm d main
characteristics of , Object orientedt-and
driven and
Procedural Even paradigms the
relationships among
. Write small snippets of code as example
thre for
them the above e
programming paradigms using a suitable)an criticall
programming language(s d y
evaluate the code samples give
that
abovinrelationtheir structure
you have n e to and
th uniqucharacterist
e e ics.

Activity 3 and Activity 4 are based


thefollowing
on 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.
ing They are look
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
-hourly,
ratesallowances).
• Admin should be able to update all employee details in the system (Update and
Delete including monthly salary, overtime
-hourly,
rates
allowances).
• Admin should be able to view individual employee details, view all employees
details, search employees.
2. Salary Component

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

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

Base Pay (Monthly Salary: salary_cycle_date_range, eg: 30 days): Each


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

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-
payvalue, and gross pay value of all the employees for a given month range.

3. Settings Component
This component should allow the admin to change parameter values such as
i. Date Range for a salary cycle. Eg:- 30 days
ii. Salary cycle begin date
iii. Salary cycle end date
iv. No of leaves for an employee for a year.

Activity 3
Write the complete pseudocode for the salary component of the above system (report
generation is not needed). Use the visual studio IDE (using C#.net) to implement the
above three components. Ideally there should be three separate classes for the above
three components and the developer can decide the methods which need to include in
those classes. Design the suitable database structure for keeping the data of the above
system.
Analyze the features of an Integrated Development Environment (IDE) and explain how
those features help in application development. Evaluate the use of the Visual StudioIDE
for your application development contrasted with not using an IDE.
Activity 4
4.1 Design and build a small GUI system for the above scenario and it should be a complete
functional system with all the functions which has described in the above scenario with the
database structure which has designed in activity 3.
4.2 Examine debugging process and the features available in Visual studio
IDE for debugging your code more easily. Evaluate how you used the
debugging process to develop more secure, robust application with
examples.

4.3 Explain and outline the coding standards you have used in your
application development. Critically evaluate why a coding standard is
necessary for the team as well as for the individual.
Grading Rubric

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

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
eventdriven
paradigms, in terms of
the code structure and
characteristics.
LO3 Implement basic
algorithms in code using
an IDE.

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.

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

Introduction to Algorithms:
An algorithm is a step-by-step set of instructions for performing a specific task or solving a
problem. It is a fundamental concept in computer science and plays a crucial role in various
fields such as programming, data analysis, and artificial intelligence. Algorithms provide a
systematic approach to solving problems, and they can be expressed using various forms,
such as natural language, flowcharts, or pseudocode.

Characteristics of a Good Algorithm:


A good algorithm exhibits certain characteristics that make it efficient, reliable, and easy to
understand. Here are some key characteristics of a good algorithm:
1. Correctness: The algorithm should produce the correct output for all valid inputs. It
should solve the problem it is designed for accurately.
2. Finiteness: The algorithm should have
a well-defined set of steps that eventually terminate after a finite number of iterations.
3. Input: The algorithm should clearly define the input it expects, whether it's data,
parameters, or initial conditions.
4. Output: The algorithm should provide the desired output or solution to the problem.
5. Clarity: The algorithm should be easy to understand and should use clear and concise
language to describe each step.
6. Efficiency: An efficient algorithm should accomplish its task using the least possible
resources, such as time and memory.
7. Generality: The algorithm should be designed in a way that it can be applied to a
wide range of inputs and scenarios.
8. Modularity: The algorithm should be divided into smaller, manageable modules or
subroutines, making it easier to understand, test, and maintain.
9. Robustness: The algorithm should be able to handle unexpected inputs or conditions
without crashing or producing incorrect results.
10. Optimality: An optimal algorithm is one that produces the best possible result in
terms of some criteria, such as minimizing the number of steps or maximizing
efficiency.

Pseudocode for Fibonacci Series:


Pseudocode is a way to describe algorithms using a mixture of natural language and basic
programming constructs. Here's a pseudocode representation of the Fibonacci series
generation algorithm:

```
function generateFibonacci(n)
initialize variables a and b to 0 and 1 respectively
for i from 1 to n
print a
next = a + b
a = b
b = next
end for
end function
```

Pseudocode for Factorial Calculation:


Here's a pseudocode representation of the factorial calculation algorithm:
```
function calculateFactorial(n)
if n is 0
return 1
else
result = 1
for i from 1 to n
result = result i
end for
return result
end if
end function
Steps in Writing and Executing a Program:
The process of writing and executing a program involves several steps:
i. Problem Definition: Clearly define the problem you want to solve or the task you
want to accomplish.
ii. Algorithm Design: Design an algorithm to solve the problem. This involves breaking
down the task into smaller steps.
iii. Coding: Write the actual code in a programming language based on the algorithm.
iv. Compilation/Interpretation: Depending on the programming language, the code might
need to be compiled or interpreted to generate machine-readable instructions.
v. Execution: Run the compiled/interpreted code, providing necessary inputs if required.
vi. Testing and Debugging: Test the program with different inputs to ensure it produces
the correct output. Debug and fix any issues that arise.
vii. Optimization: Refine the code for better efficiency, readability, and maintainability.
viii. Documentation: Provide comments and documentation to explain the code's
functionality.
ix. Deployment: If applicable, deploy the program for actual use.

Challenges in the Coding Phase:


The coding phase is a critical step in the software development process, and it comes with its
own set of challenges:
 Syntax Errors: These occur due to mistakes in the programming language syntax,
such as missing semicolons, parentheses, or incorrect variable names.
 Logic Errors: Logic errors lead to incorrect program behavior. The program might
run without errors, but it produces unintended results.
 Debugging Complexity: Identifying the source of errors can be challenging,
especially in complex programs. Debugging tools and techniques are essential.
 Algorithm Implementation:
Translating the algorithm into actual code can be tricky, as some algorithms might
require complex data structures or intricate control flow.
 Efficiency: Writing efficient code that minimizes resource usage and executes
quickly can be demanding, especially for large-scale applications.
 Edge Cases: Handling edge cases and unexpected inputs requires careful
consideration and testing.
 Integration Challenges: Integrating different modules or components can sometimes
lead to compatibility issues.
Dry Run and Sample Outputs:
Let's dry run the Fibonacci series and factorial algorithms for the sample number `n = 5`.
Fibonacci Series Algorithm:
- Initialize: a = 0, b = 1
- Loop 1: Print a (0), next = 0 + 1 = 1, a = 1, b = 1
- Loop 2: Print a (1), next = 1 + 1 = 2, a = 1, b = 2
- Loop 3: Print a (1), next = 1 + 2 = 3, a = 2, b = 3
- Loop 4: Print a (2), next = 2 + 3 = 5, a = 3, b = 5
- Loop 5: Print a (3), next = 3 + 5 = 8, a = 5, b = 8
- Loop ends

Output of Fibonacci series: 0, 1, 1, 2, 3

Factorial Algorithm:
- CalculateFactorial(5)
- 5 is not 0
- result = 1
- Loop 1: result = 1 1 = 1
- Loop 2: result = 1 2 = 2
- Loop 3: result = 2 3 = 6
- Loop 4: result = 6 4 = 24
- Loop 5: result = 24 5 = 120
- Return result (120)

Output of Factorial calculation for 5: 120

Big-O Notation and Efficiency:


Big-O notation is used to describe the upper bound of an algorithm's time complexity or
space complexity in terms of the input size. It helps in evaluating the efficiency of algorithms
and making informed choices about which algorithm to use for a given problem. The notation
is written as O(f(n)), where f(n) is a function representing the growth rate of the algorithm
relative to the input size n. For example, in the Fibonacci series algorithm, the time
complexity is O(n) because the number of iterations increases linearly with the input size. In
the factorial algorithm, the time complexity is also O(n) because there are n iterations.

Python Code for Fibonacci Series:


```python
def generate_fibonacci(n):
a, b = 0, 1
for

i in range(n):
print(a, end=" ")
next_val = a + b
a, b = b, next_val

n = 5
print("Fibonacci Series:")
generate_fibonacci(n)
```

Python Code for Factorial Calculation:


```
def calculate_factorial(n):
if n == 0:
return 1
result = 1
for i in range(1, n + 1):
result = i
return result

n = 5
print(f"Factorial of {n}: {calculate_factorial(n)}")
```

Efficiency Analysis:
Both the Fibonacci series and factorial algorithms have a time complexity of O(n), meaning
their performance grows linearly with the input size. This is because both algorithms involve
iterating over the input range (n) a fixed
number of times. As the input size increases, the number of iterations also increases
proportionally.
While these algorithms are efficient for small input sizes, they can become slower for larger
inputs. For even better efficiency, certain optimization techniques and algorithms with lower
complexities, such as dynamic programming for Fibonacci or recursive methods for factorial,
can be employed. So, algorithms are essential tools for solving computational problems, and
writing efficient algorithms requires careful consideration of their characteristics, logic, and
potential challenges. Big-O notation serves as a guide for evaluating and comparing the
efficiency of different algorithms, aiding in the selection of the most appropriate algorithm
for a given task. By understanding algorithm design and analysis, programmers can create
effective and optimized solutions to a wide range of problems.

Activity 2

Programming Paradigms and Their Characteristics:


A programming paradigm refers to a fundamental style or approach to writing computer
programs. Each paradigm defines a set of rules, conventions, and methodologies for
designing and structuring code. There are several major programming paradigms, including
procedural, object-oriented, and event-driven paradigms. Let's explore each of these
paradigms and their characteristics in detail, followed by code examples and a critical
evaluation of those examples.

Procedural Programming Paradigm:


The procedural programming paradigm is based on the idea of performing tasks by executing
a sequence of procedures or functions. It emphasizes dividing the code into reusable
functions, which can be organized hierarchically. Key characteristics of procedural
programming include:
 Functions and Procedures: Programs are structured as a collection of functions or
procedures, which encapsulate specific tasks.
 Modularity: Code is organized into modules, making it easier to manage and
maintain.
 Global Data: Data is shared among functions using global variables, which can lead
to potential issues with data integrity and encapsulation.
 Focus on Algorithms: Procedural languages are well-suited for algorithmic tasks
where the sequence of steps is critical.

Example of Procedural Code (using C):


```c
#include <stdio.h>

int add(int a, int b) {


return a + b;
}

int main() {
int num1 = 5;
int num2 = 7;
int sum = add(num1, num2);
printf("Sum: %d\n", sum);
return 0;
}
```

Object-Oriented Programming Paradigm:


The object-oriented programming (OOP) paradigm focuses on modeling real-world entities
as objects, which are instances of classes.
OOP promotes the use of classes and objects to encapsulate data and behavior together. Key
characteristics of OOP include:
 Classes and Objects: Code is organized around classes that define attributes (data)
and methods (functions) related to a specific entity.
 Encapsulation: Data hiding and encapsulation are achieved through access modifiers,
allowing objects to expose only necessary information.
 Inheritance: Classes can inherit attributes and methods from parent classes,
promoting code reuse and hierarchical organization.
 Polymorphism: Objects of different classes can respond to the same method name,
allowing for flexible behavior based on the context.
Example of Object-Oriented Code (using Java):
```java
class Rectangle {
private double width;
private double height;

public Rectangle(double width, double height) {


this.width = width;
this.height = height;
}

public double calculateArea() {


return width height;
}
}
public class Main {
public static void main(String[] args) {
Rectangle rectangle = new Rectangle(5.0, 7.0);
double area = rectangle.calculateArea();
System.out.println("Area: " + area);
}
}
```

Event-Driven Programming Paradigm:


The event-driven programming paradigm is centered around responding to events or user
actions. It's commonly used for graphical user interfaces (GUIs) and interactive applications.
Event-driven programming involves defining event handlers to respond to specific events.
Key characteristics of event-driven programming include:
 Events: Events represent user actions or system occurrences, such as button clicks or
mouse movements.
 Event Handlers: Code is organized around event handlers, which are functions
triggered by specific events.
 Asynchronous: Execution is driven by events, allowing the program to respond to
multiple events concurrently.
 User Interaction: Well-suited for applications where user interaction is a key aspect,
such as video games or GUI applications.
Example of Event-Driven Code (using JavaScript for a simple web page):
```html
<!DOCTYPE html>
<html>
<head>
<title>Event-Driven Example</title>
</head>
<body>
<button id="myButton">Click Me</button>
<p id="output"></p>

<script>
const button = document.getElementById("myButton");
const output = document.getElementById("output");

button.addEventListener("click", () => {
output.textContent = "Button clicked!";
});
</script>
</body>
</html>
```

Critical Evaluation of Code Samples:


Procedural Code Sample Evaluation:
The procedural code snippet demonstrates the use of functions to encapsulate code and
perform a specific task. However, global variables can lead to potential issues, such as data
conflicts and lack of encapsulation. This paradigm is effective for small-scale tasks but can
become challenging to manage in larger projects.
Object-Oriented Code Sample Evaluation:
The object-oriented code snippet showcases the use of classes and objects to model real-
world entities. Encapsulation and data hiding are achieved through private attributes.
Inheritance and polymorphism support code reuse and flexibility. This paradigm is highly
suitable for complex systems where entities can be modeled as objects and relationships are
crucial.
Event-Driven Code Sample Evaluation:
The event-driven code snippet highlights the response to a user event (button click) using
event handlers. This paradigm is excellent for interactive applications where user actions
drive the program's behavior. However, managing multiple events and asynchronous
execution can lead to complex code structures.
Programming paradigms provide distinct approaches to structuring and designing code. The
procedural paradigm focuses on functions and modularity, while the object-oriented paradigm
emphasizes classes, objects, and inheritance. The event-driven paradigm revolves around
responding to events and user interactions. Each paradigm has its strengths and weaknesses,
and the choice of paradigm depends on the nature of the problem being solved and the
desired characteristics of the program.
The code examples provided showcase the unique features of each paradigm, illustrating how
they differ in terms of structure and design. Understanding these paradigms allows
programmers to select the most appropriate one for a given task, leading to more efficient,
maintainable, and scalable code. While each paradigm has its merits, modern programming
often involves combining elements from different paradigms to create powerful and flexible
solutions.
Activity 3

Pseudocode for Salary Component:

class SalaryComponent {
// Method to calculate base pay
public decimal CalculateBasePay(Employee employee, DateTime
startDate, DateTime endDate) {
decimal basePay = employee.MonthlySalary +
employee.Allowances;
decimal noPayValue = (employee.MonthlySalary / (endDate -
startDate).TotalDays) * employee.AbsentDays;
decimal overtimePay = employee.OvertimeRate *
employee.OvertimeHours;
basePay += overtimePay - noPayValue;
return basePay;
}

// Method to calculate gross pay


public decimal CalculateGrossPay(decimal basePay, decimal
governmentTaxRate) {
decimal grossPay = basePay - (basePay * governmentTaxRate);
return grossPay;
}

// Method to generate salary reports


public void
GenerateSalaryReports(DateTime startDate, DateTime endDate) {
// Generate monthly salary report for each employee
foreach (Employee employee in employees) {
decimal basePay = CalculateBasePay(employee, startDate,
endDate);
decimal grossPay = CalculateGrossPay(basePay,
governmentTaxRate);
// Save basePay and grossPay in the database
}

// Generate overall salary summary for a couple of months


for each employee
foreach (Employee employee in employees) {
// Calculate overall salary summary
// Save the summary in the database
}

// Generate No-pay-value, base-pay-value, and gross pay


value for all employees for a given month range
// Calculate and save the values in the database
}
}

Database Structure:
Tables:
1. Employees (EmployeeID, Name, MonthlySalary, OvertimeRate, Allowances)
2. SalaryDetails (SalaryID, EmployeeID, StartDate, EndDate, BasePay, NoPayValue,
GrossPay)

Integrated Development Environment (IDE) Features and Benefits:

Integrated Development Environment (IDE) and its Features:


An Integrated Development Environment (IDE) is a powerful software suite that provides
developers with a comprehensive set of tools and features to facilitate the entire software
development lifecycle. IDEs are designed to enhance efficiency, streamline workflows, and
improve code quality. Here, we will delve deeper into the features of an IDE and explain how
each feature contributes to application development.
1. Code Editing:
IDEs offer advanced code editing capabilities that go beyond basic text editors. They provide
features like syntax highlighting, which color-codes different elements of the code to make it
easier to read and understand. Additionally, auto-completion suggests code snippets, variable
names, and function signatures as you type, reducing typing errors and improving coding
speed. Code navigation tools help developers quickly move between different sections of the
codebase.
2. Code Debugging:
Debugging is a critical aspect of software development, and IDEs provide a range of tools to
simplify the process. Breakpoints allow developers to pause execution at specific lines of
code, inspect variables, and step through code step by step. Watch expressions enable real-
time monitoring of variable values during debugging. This helps developers identify and fix
errors efficiently, leading to more reliable code.
3. Build and Compilation:
IDEs automate the build and compilation process, minimizing the need for manual command-
line operations. They provide a seamless environment to compile code, generate executable
files, and manage dependencies. Build errors are highlighted, enabling developers to quickly
identify and rectify issues, thus reducing the
chances of deploying faulty code.
4. Version Control Integration:
Version control is crucial for collaborative development, and IDEs often come with built-in
support for version control systems like Git. Developers can easily commit changes, create
branches, and merge code directly from the IDE. This integration simplifies collaboration,
reduces conflicts, and ensures codebase integrity.
5. Project Management:
IDEs provide project management features that allow developers to organize files, folders,
and resources within a project. They help manage dependencies, track progress, and set
milestones. This organized approach enhances code maintainability and simplifies project
tracking.
6. Code Refactoring:
Refactoring is the process of restructuring code to improve its readability, maintainability,
and efficiency. IDEs offer automated refactoring tools that can rename variables, extract
methods, and optimize code without changing its behavior. This promotes better code quality
and reduces the risk of introducing bugs during manual refactoring.
7. Code Templates and Snippets:
IDEs include a library of code templates and snippets for common programming tasks.
Developers can insert these pre-written code segments with a few clicks, saving time and
ensuring consistency in coding practices.
8. Testing Tools:
Many IDEs integrate testing frameworks, allowing developers to write, run, and automate
unit tests directly from the environment. Integrated testing tools help ensure code quality and
identify issues early in the development process.

Evaluation of Visual Studio IDE:

Pros:
1. Rich Feature Set: Visual Studio offers an
extensive array of features, encompassing code editing, debugging, version control, project
management, and more. This comprehensive toolset caters to all aspects of application
development.
2. Intuitive Interface: Visual Studio's user-friendly interface enhances productivity by
providing a unified workspace for coding, debugging, testing, and project management.
Developers can access tools and features conveniently, reducing the learning curve.
3. Integration with .NET: As Grifindo Toys is using C#.NET, Visual Studio offers seamless
integration with the .NET framework. This integration streamlines development, making it
easier to leverage the framework's capabilities.
4. Code Analysis: Visual Studio includes built-in code analysis tools that assist in identifying
potential issues, enforcing coding standards, and maintaining high code quality throughout
the project.
5. Database Tools: For applications with database integration, Visual Studio's database tools
simplify tasks such as designing, querying, and managing databases. This integration
contributes to a more efficient development process.

Cons:
1. Resource Intensive: Visual Studio's feature-rich environment can consume a significant
amount of system resources, potentially affecting system performance, especially on lower-
end machines.
2. Learning Curve: While Visual Studio's features are beneficial, mastering all of them can
take time, especially for developers new to the IDE. This learning curve might initially slow
down development.

Contrasting IDE vs. Non-IDE Approach:


Using an IDE:
- Efficiency: IDEs provide an integrated platform for all development tasks, reducing
the need to switch between various tools. This enhances productivity by streamlining
workflows.
- Automation: IDEs automate tasks
such as compilation, debugging, and testing. This reduces manual intervention and
the likelihood of human errors.
- Consistency: IDEs enforce coding standards and offer templates, ensuring consistent
coding practices throughout the project.
- Collaboration: IDEs integrate with version control systems, enabling seamless
collaboration among team members.
- Reduced Complexity: IDEs simplify complex processes like debugging and
refactoring, making them more accessible to developers.

Non-IDE Approach:
- Manual Management: Without an IDE, developers need to manage separate tools for
editing, compiling, debugging, and testing. This increases the complexity of the
development process.
- Efficiency Challenges: Manual processes can be time-consuming and error-prone, as
developers must execute each step manually.
- Learning Overhead: Developers must become proficient in multiple tools and manage
their interactions. This can increase the learning curve and slow down development.

In the context of developing Grifindo Toys' payroll system, using an IDE like Visual Studio
offers a clear advantage. The efficiency, automation, and integration features of an IDE align
well with the requirements of building a comprehensive payroll system with multiple
components and functionalities. While there might be a learning curve associated with
mastering Visual Studio's extensive features, the long-term benefits in terms of code quality,
development speed, and collaboration outweigh this initial investment.
Activity 4

4.1 Design and Build a GUI System:


Program
1. Employee Component:
- Design a form to register and update employee details, view individual and all
employees' details, and search employees.
- Implement event handlers for each action, such as "Register," "Update," "View," and
"Search."
- Utilize textboxes, labels, buttons, and data grids to display and input employee
information.
2. Salary Component:
- Design a form to input the date range, leaves taken, absent days, holidays, and
overtime hours for an employee.
- Implement a "Calculate Salary" button that triggers the calculation process based on
the entered data.
- Display the calculated base pay, no-pay value, and gross pay in appropriate textboxes.
3. Settings Component:
- Design a form to allow the admin to set parameters such as salary cycle details and
leaves per year.
- Implement input fields for each parameter and a "Save Settings" button.
- Store the settings in the database.
4. Database Connectivity:
- Use ADO.NET or Entity Framework to establish a connection to the database.
- Implement methods to insert, update, and retrieve data from the database for each
component.
- Ensure proper error handling and data validation.

Remember that this is just an overview, and the actual implementation would involve creating
classes, forms, event handlers, and database interactions based on the specifications provided.
4.2 Debugging Process and Visual Studio
Features:

Debugging is the process of identifying and fixing errors or issues in your code. Visual Studio
provides a range of features to make the debugging process easier and more effective:
1. Breakpoints: Set breakpoints in your code to pause execution at specific lines. You
can inspect variables, step through code, and understand the state of the program.
2. Watch and Quick Watch: Monitor the values of variables in real-time using the Watch
window or the Quick Watch feature. This helps you track changes and identify issues.
3. Call Stack: Understand the sequence of method calls that led to the current point of
execution. The call stack window helps you trace the flow of your program.
4. Immediate Window: Evaluate expressions and execute code while debugging without
altering your source code. This can be useful for quick testing.
5. Exception Handling: Visual Studio highlights exceptions and provides information
about their origins. You can choose to break on specific exceptions for thorough error
diagnosis.
6. Step Into, Step Over, Step Out: These debugging commands allow you to navigate
through code step by step, providing insights into how your program behaves.
7. Data Tips: Hover over variables while debugging to see their current values and data
types.

Using Debugging for a Secure and Robust Application:


1. Security: Debugging helps identify vulnerabilities and security flaws in the code. By
closely examining variables and inputs during debugging, you can detect potential
security breaches and address them before deployment.
2. Error Handling: Debugging allows you to catch exceptions and errors that might
otherwise go unnoticed. By addressing these errors during development, you prevent
unexpected crashes and improve the overall stability of the application.
3. Testing Edge Cases: Debugging enables you to test edge cases and scenarios that
might not be covered in standard testing. This helps uncover hidden issues and
ensures the application can handle
diverse inputs.
4. Code Optimization: During debugging, you can identify areas of the code that are
consuming excessive resources or executing slowly. This information can lead to
optimizations that enhance the application's performance.

4.3 Coding Standards and Their Importance:


Coding Standards: Coding standards are a set of guidelines, conventions, and rules that define
how code should be written within a development team. These standards cover aspects such
as naming conventions, code structure, indentation, commenting, and more.
Importance of Coding Standards:
Consistency: Coding standards ensure a consistent coding style across the project,
making the codebase easier to read and maintain. It enhances collaboration among team
members by reducing confusion caused by differing coding styles.
Readability: Well-defined coding standards improve code readability. Clear and
consistent naming conventions, indentation practices, and commenting help developers
understand the code more easily.
Maintainability: Code following coding standards is easier to maintain and update. When
multiple developers work on the same project, adhering to coding standards simplifies
understanding and modifying each other's code.
Reduced Bugs: Coding standards promote good coding practices that reduce the
likelihood of introducing bugs. Consistent naming, proper indentation, and thorough
commenting help prevent common mistakes.
Efficiency: Following coding standards streamlines code reviews and debugging
processes. When all team members adhere to the same set of rules, finding and fixing
issues becomes quicker and more efficient.
Scalability: As a project grows, maintaining a consistent coding style becomes
increasingly important. Coding standards ensure that the codebase remains organized and
coherent even as the project expands.
Onboarding New Team Members: New team members can quickly understand the
codebase and start contributing effectively when coding standards are followed.
Consistency in coding practices reduces
the learning curve.
For a Team:

1. Consistency:
- Readability: A coding standard ensures that code is written in a consistent style,
making it easier for team members to read and understand each other's code.
- Uniformity: Consistent coding styles promote a uniform look and feel throughout the
codebase, regardless of who wrote the code.

2. Collaboration:
- Interoperability: Team members can seamlessly collaborate when everyone follows
the same coding standards. It reduces friction when integrating code written by different
developers.
- Ease of Understanding: A standardized codebase makes it easier for developers to
understand and maintain each other's code, even if they didn't originally write it.

3. Maintainability:
- Ease of Maintenance: Code that adheres to a coding standard is typically easier to
maintain. When everyone follows the same conventions, it's simpler to identify and fix
issues or add new features.
- Reduced Technical Debt: Following coding standards helps prevent the accumulation
of technical debt, as it encourages clean and modular code.

4. Quality Assurance:
- Automated Testing: Coding standards often include guidelines for writing testable
code. This promotes the development of robust automated test suites, leading to higher
code quality.
- Reduced Bugs: Consistent coding
standards can catch common programming errors early, reducing the likelihood of
introducing bugs.

5. Onboarding and Training:


- Faster Onboarding: New team members can quickly get up to speed when the
codebase follows a consistent structure and style.
- Knowledge Transfer: A coding standard facilitates knowledge transfer among team
members, making it easier for developers to understand and contribute to various parts of
the codebase.

For an Individual:

1. Self-Documentation:
- Clarity: Coding standards often include guidelines for commenting and documenting
code. This helps an individual developer understand their own code when they revisit it
later.
- Intent Communication: Writing code in a standard way ensures that the intent of the
code is clear, making it easier for the individual developer to remember the purpose of
specific pieces of code.

2. Professionalism:
- Professional Image: Following coding standards demonstrates a commitment to
professionalism and best practices. It reflects positively on an individual developer's
work and contributes to a positive team culture.

3. Efficiency:
- Code Reviews: Adhering to coding standards streamlines the code review process.
Code that follows established conventions
is quicker to review, leading to faster feedback loops.
- Debugging: Standardized code is often easier to debug, as it reduces the likelihood of
introducing errors due to inconsistent coding practices.

4. Skill Development:
- Learning Opportunities: Following a coding standard exposes individual developers
to best practices and industry standards. It provides opportunities for skill development
and continuous improvement.

In conclusion, a coding standard is essential both for a team and an individual because it
promotes consistency, collaboration, maintainability, quality assurance, and
professionalism. It serves as a guide for writing clean, readable, and efficient code,
contributing to the overall success of software development projects.

Conclusion:
Designing and building a GUI system for Grifindo Toys' payroll scenario requires careful
consideration of the specifications provided. Visual Studio's debugging features play a crucial
role in identifying and rectifying errors, leading to more secure and robust applications.
Additionally, adhering to coding standards enhances code quality, readability, and
maintainability, benefiting both the development team and the individual developers. By
utilizing the capabilities of an IDE, leveraging debugging tools, and adhering to coding
standards, developers can create a functional and efficient application that meets the
requirements of the scenario.

References

Deitel, P. J., & Deitel, H. M. (2009). Visual C# 2008 How to Program (3rd ed.). Pearson.
Eckel, B. (2007). Thinking in Java (4th ed.). Prentice Hall.
Graham, P. (2002). Hackers & Painters: Big
Ideas from the Computer Age. O'Reilly Media.
Myers, G. J., Sandler, C., & Badgett, T. (2011). The Art of Software Testing (3rd ed.). Wiley.
Eck, D. J. (2019). Java: Programming Basics for Absolute Beginners. Apress.
Oracle Corporation. (2021). Java SE Documentation. https://docs.oracle.com/en/java/javase/
Gamma, E., Helm, R., Johnson, R., & Vlissides, J. (1994). Design Patterns: Elements of
Reusable Object-Oriented Software. Addison-Wesley.
Microsoft Corporation. (2021). Introduction to Windows Forms.
https://docs.microsoft.com/en-us/dotnet/desktop/winforms/
Troelsen, A., & Japikse, P. (2020). Pro C# 7: With .NET and .NET Core (8th ed.). Apress.
Balena, F. (2008). Programming Microsoft Windows with C#. Microsoft Press.
Schildt, H. (2017). C#: The Complete Reference (5th ed.). McGraw-Hill Education.
Adobe Inc. (2021). Adobe Illustrator User Guide. https://helpx.adobe.com/illustrator/user-
guide.html
Crockford, D. (2008). JavaScript: The Good Parts. O'Reilly Media.
Flanagan, D. (2011). JavaScript: The Definitive Guide (6th ed.). O'Reilly Media.
Stroustrup, B. (2013). The C++ Programming Language (4th ed.). Addison-Wesley.

You might also like