Student Assessment Submission and Declaration
Student Assessment Submission and Declaration
SE07203
20/08/2024 20/08/2024
Grading Grid
P1 P2 P3 P4 P5 P6 M1 M2 M3 M4 D1 D2 D3 D4
Plagiarism
Plagiarism is a particular form of cheating. Plagiarism must be avoided at all costs and
students who break the rules, however innocently, may be penalised. It is your responsibility
to ensure that you understand correct referencing practices. As a university level student,
you are expected to use appropriate references throughout and keep carefully detailed notes
of all your sources of materials for material you have used in your work, including any
material downloaded from the Internet. Please consult the relevant unit lecturer or your
course tutor if you need any further advice.
a) Strengths of performance
b) Limitations of performance
c) Any improvements needed in future assessments
Feedback should be against the learning outcomes and assessment criteria to help students
understand how these inform the process of judging the overall grade.
Feedback should give full guidance to the students on how they have met the
learning outcomes and assessment criteria.
I certify that to the best of my knowledge the evidence submitted for this assignment is the student’s
own. The student has clearly referenced any sources and any artificial intelligence (AI) tools used in
the work. I have not solely used AI to grade the student’s work.
Resubmission Feedback:
*Please note resubmission feedback is focussed only on the resubmitted work
* 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.
Table of Content
s
I. INTRODUCTION......................................................................................................................................7
II. MAIN CONTENT......................................................................................................................................7
1. Provide a definition of what an algorithm is and outline the process in building an application.(P1)7
2. Determine the steps taken from writing code to execution.(P2).....................................................11
3. Discuss what procedural, object-orientated and event-driven paradigms are; their characteristics
and the relationship between them. (P3)................................................................................................15
4. Write a program that implements an algorithm using an IDE.(P4)..................................................17
5. Explain the debugging process and explain the debugging facilities available in the IDE.(P5).........23
6. Explain the coding standard you have used in your code(P6)........................................................24
7. Analyse the process of writing code, including the potential challenges faced. (M1)......................25
8. Compare the procedural, object-orientated and event-driven paradigms used in given source code
of an application.(M2)..............................................................................................................................26
9. Enhance the algorithm written, using the features of the IDE to manage the development process.
(M3)27
10. Examine how the debugging process can be used to help develop more secure, robust
applications.(M4).....................................................................................................................................30
11. Critically evaluate the source code of an application that implements the procedural, object-
orientated and event-driven paradigms, in terms of the code structure and characteristics (D2):.........31
12. Evaluate the use of an IDE for development of applications contrasted with not using an IDE
(D3): 31
13. Evaluate the role and purpose of a coding standard and why it is necessary in a team as well as
for the individual (D4):.............................................................................................................................32
III. CONCLUSION....................................................................................................................................34
REFERENCES.................................................................................................................................................35
Table of Figure
Figure 1. FlowChart........................................................................................................................................9
Figure 2. Pseudo code..................................................................................................................................10
Figure 3. Code of the electricity and water budget......................................................................................12
Figure 4. Run Code Calculating Water Cash for Households........................................................................13
Figure 5. Run Code Code Calculating Water Cash for Administrative Agency and Public Services...............13
Figure 6. Run Code Calculating Water Cash for Production Unit.................................................................13
Figure 7. Run Code Calculating Water Cash for Businesses..........................................................................14
Figure 8. Examples of procedural programming..........................................................................................15
Figure 9. Examples of object -oriented programming..................................................................................16
Figure 10. Examples of event programming................................................................................................16
Figure 11. Winform's water budget code.....................................................................................................18
Figure 12. Winform water budget code of Design table..............................................................................19
Figure 13. Calculate water money for households.......................................................................................20
Figure 14. Calculate water money for public services..................................................................................21
Figure 15. Calculate the water money for the production unit....................................................................22
Figure 16. Calculate water money for businesses........................................................................................23
Figure 17. run debug....................................................................................................................................24
Figure 18. flowchart.....................................................................................................................................26
Figure 19. Comparative photo between POP and OOP................................................................................31
I. INTRODUCTION
ABC software has requested the development of a simple program to calculate monthly water
bills for their clients. The program should allow users to input the necessary information and
provide the calculated water bill based on the provided pricing structure.
The program should capture the customer's name, last month's water meter reading, current
month's water meter reading, type of customer (Household, Administrative Agency,
Production Unit, or Business Services), and the number of people in the household (for
household customers). The program will then calculate the water consumption and the total
water bill based on the provided pricing table. The output should include the customer's name,
last month's water meter reading, current month's water meter reading, water consumption (in
cubic meters), and the total water bill (including environmental protection fees).
The program should be designed with a focus on flexibility, maintainability, and ease of use.
The development team at ABC software is interested in understanding the programming
paradigms, design decisions, and debugging techniques used during the development process.
Figure 1. FlowChart
• Pseudo code
The code is a way to represent the algorithm with a specific syntax of the programming
language.
The code includes statements, variables, functions, and data structures to perform the steps
of the algorithm.
VD:
This code calculates the water bill for a customer based on their water usage and customer type.
Here's a detailed explanation of the code:
1. The code starts by prompting the user to enter their name, the previous month's water usage,
and the current month's water usage.
2. It then calculates the difference in water usage between the current and previous month, which
is stored in the variable (m3).
3. The code then prompts the user to enter a number corresponding to their customer type:
- 1 for household
- 3 for manufacturing
- 4 for business
4. The code then calculates the water bill based on the customer type and the water usage
difference (m3):
- If (m3) is between 0 and 10, the bill is calculated as (m3 * 5.973 )* 1.1.
- If (m3) is between 11 and 20, the bill is calculated as (59.730 + ((m3 - 10) * 7.052) )* 1.1.
- If (m3) is greater than or equal to 30, the bill is calculated as (59.730 + 70.520 + 86.690 +
((m3 - 30) * 15.929)) * 1.1.
6. Finally, the code prints the water bill for the current month.
POP focuses on procedures or functions as the primary building blocks. It's like a recipe,
where you follow a sequence of steps to achieve a result.
OOP revolves around objects, which combine data (attributes) and actions (methods). It's
like modeling real-world entities.
Event-driven programming responds to events (user actions, system notifications). It's like
waiting for something to happen and then reacting.
string name = txtName.Text;: This line retrieves the customer's name from a text box
control named txtName.
int previous, current, customerType;: These variables will store the previous water reading,
current water reading, and the customer type.
double waterUsage, bill = 0;: These variables will store the calculated water usage and the
water bill amount.
Input Validation:
waterUsage = current - previous;: This line calculates the water usage by subtracting the
previous reading from the current reading.
The code uses a series of if-else statements to determine the customer type and calculate
the water bill based on the water usage and the corresponding pricing tiers.
For a "Household" customer type (rbHoGiaDinh.Checked), the bill is calculated using a
tiered pricing structure based on the water usage.
For other customer types (rbCoQuanHanhChinh.Checked, rbDonViSanXuat.Checked,
rbDoanhNghiep.Checked), the bill is calculated using a fixed rate per unit of water usage.
If the customer type is not recognized, an error message is displayed in the lblResult label.
Output:
The final water bill amount is formatted as a currency string and displayed in the lblResult
label.
This code is designed to calculate the water bill for different customer types based on their water
usage. The key aspects of the code are input validation, water usage calculation, and the
application of different pricing structures based on the customer type. The code also includes error
handling to ensure that it can handle invalid input data or unrecognized customer types.
Figure 15. Calculate the water money for the production unit
Spotting an error
Finding the lines of code that cause the error
Fixing the error in the code
Testing to check if the error is gone and no new errors are introduced
Purpose of Debugging
Finding Bugs: Identifying errors (bugs) in the source code that may cause unexpected
issues or results.
Understanding the Problem: Analyzing and understanding the root cause of the error.
Fixing the Error: Making the necessary changes to correct the error.
Verifying the Fix: Checking the program again to ensure the error has been fixed and
no new errors
Customer Name
Customer Type
Event Handler: btnCalculate_Click - This method is called when the user clicks the "Calculate"
button.
Type Checking: int.TryParse - Checks whether the input values are valid or not.
Conditional Statements: if/else - Used to check the customer type and calculate the
corresponding bill.
Calculation Logic: Use formulas to calculate water bills based on specific price lists.
Overall, this source code complies with common C# programming standards, with appropriate
use of programming techniques such as input data processing, logical calculations, and result
presentation.
The provided code primarily exhibits procedural programming characteristics. This is evident in:
Sequential execution: The code follows a linear flow from top to bottom.
Functions/subroutines: While not explicitly defined as functions, the code blocks within
the if statements can be considered as logical subroutines performing specific calculations.
Data as separate entities: Variables like name, previous, current, waterUsage, and bill are
treated as independent data elements.
No classes or objects: The code does not define any classes or create objects.
Lack of encapsulation: Data and behavior are not encapsulated within objects.
-Event-Driven Programming
The code is not event-driven. There is no indication of event handling or response to external
stimuli.
-The provided code is predominantly procedural in nature. It lacks the characteristics of object-
oriented and event-driven programming. To enhance the code's structure and maintainability,
incorporating OOP concepts could be beneficial. For example, creating a Customer class to
encapsulate customer information and billing calculations would improve code organization and
reusability.
If we were to introduce OOP concepts, we could create a Customer class with properties like
Name, PreviousReading, CurrentReading, CustomerType, and methods like CalculateBill(). This
would improve code modularity and flexibility.
By using OOP, we can create multiple Customer objects and perform calculations for different
customers without repeating code. This approach would make the code more organized, reusable,
and maintainable.
Before diving into improvements, let's break down the code's functionality:
Input: Reads previous and current water readings from text boxes.
Calculation: Calculates water usage based on input.
Customer Type: Determines customer type based on radio button selection.
Billing: Calculates the water bill based on water usage and customer type.
Output: Displays the calculated bill on a label.
Indentation: Ensure consistent indentation for better readability. Most IDEs have automatic
indentation options.
Input Validation: Check if the input values are valid numbers before proceeding with
calculations. Use TryParse to handle potential parsing errors.
Error Handling: Display informative error messages to the user if input is invalid or
calculations fail.
Exception Handling: Consider using try-catch blocks to handle potential exceptions, such
as FormatException for invalid input.
Modularization: Break down the code into smaller, reusable functions or methods. For
example, create separate functions for input validation, calculation, and displaying results.
Object-Oriented Design: If applicable, consider using object-oriented principles to
encapsulate data and behavior. Create classes for customer types and billing calculations.
Code Optimization
Testing
Unit Testing: Write unit tests to verify the correctness of individual code units.
Integration Testing: Test how different parts of the code interact.
Example Improvements
lblResult.Text = "Invalid input. Please enter valid previous and current readings.";
return;
if (rbHoGiaDinh.Checked)
bill = CalculateHouseholdBill(waterUsage);
else if (rbCoQuanHanhChinh.Checked)
bill = CalculateGovernmentAgencyBill(waterUsage);
lblResult.Text = "Tiền nước bạn cần trả trong tháng này là: " + bill.ToString("C");
// ...
// ...
By applying these enhancements, you can improve the code's readability, maintainability, and
robustness. The specific improvements will depend on the programming language, IDE, and
project requirements.
Programming efficiency:
Using an IDE: IDEs provide tools and automation features such as auto-complete, syntax
highlighting, code folding, etc. that help programmers increase their speed and productivity.
Using an IDE: IDEs provide features such as project managers, code browsers, version
management, etc. that help programmers easily manage and organize source code.
Not using an IDE: Programmers have to manage and organize source code using manual tools
such as text editors, file management systems, etc. This can cause many difficulties and risks.
Using IDEs: IDEs integrate many development tools such as compilers, debuggers, code
quality testing tools, etc., making it easy for programmers to use and coordinate these tools.
Not using IDEs: Programmers have to manage and connect these development tools
themselves, leading to more difficulties and hardships.
Using IDEs: IDEs often provide programming language support features such as auto-
complete, syntax highlighting, refactoring, etc., which help programmers work more
efficiently.
Not using IDEs: Programmers have to perform these operations manually, which is time-
consuming and more prone to errors.
Using IDEs: IDEs provide maintenance and development support tools such as debuggers,
version control, automated builds, etc., which make application maintenance and development
easier.
Not using IDE: Programmers have to manage and perform these tasks themselves, which takes
more time and effort. In short, using IDE in application development brings many benefits in
terms of performance, code management, tool integration, language support, and
maintenance/development process. This is an optimal choice compared to not using IDE,
helping programmers improve productivity and product quality.
Professional Development: Developing good coding habits early in a career is essential for
long-term success.
Improved Code Quality: Following coding standards leads to higher-quality code, which
can boost an individual's reputation.
Faster Debugging: Consistent code is easier to debug, saving time and effort.
Increased Employability: Demonstrating adherence to coding standards is often a
requirement for many job positions.
Personal Satisfaction: Writing clean, well-structured code can be personally rewarding.
coding standards are crucial for both teams and individuals. They serve as a foundation for
creating high-quality, maintainable, and collaborative software development processes. By
establishing clear guidelines and expectations, coding standards contribute significantly to the
overall success of a software project
The algorithms used for calculating the water bills were based on the pricing table provided in
the requirements, with different rates for different tiers of water usage for household customers
and fixed rates for other customer types. The environmental protection fees were also factored
into the calculations.
Since the client did not specify a Graphical User Interface, a command-line interface was
implemented to allow users to input the necessary information and view the calculated water
bills. The program also includes optional features, such as the ability to sort, search, and
generate invoices, as suggested in the requirements.
Throughout the development process, various debugging tools, such as a debugger, were used
to identify and resolve any issues. Unit tests and integration tests were also implemented to
ensure the correctness and overall functionality of the program.
In the presentation to the development team, I discussed the benefits of using an object-oriented
programming approach, demonstrated the usage of the debugging tools, and shared insights on
the challenges encountered and how they were addressed. This presentation aims to provide the
team with a better understanding of the development process and the best practices employed,
which can be applied to future projects.
Overall, the water bill calculation program was developed using a structured and well-
documented approach, ensuring that it meets the client's requirements and can be easily
maintained and expanded upon in the future.
REFERENCES
Kumari, R. (2020). What is an Algorithm? Types, Applications, and Characteristics | Analytics
Steps. [online] www.analyticssteps.com. Available at: https://www.analyticssteps.com/blogs/what-
algorithm-types-applications-characteristics.
airfocus (n.d.). What is a Front End (In a Website) - Definition & Development. [online]
airfocus.com. Available at: https://airfocus.com/glossary/what-is-a-front-end/.
Techopedia.com. (2019). What is an Algorithm? - Definition from Techopedia. [online] Available
at: https://www.techopedia.com/definition/3739/algorithm.
Upadhyay, S. (2022). What Is An Algorithm? Characteristics, Types and How to write it |
Simplilearn. [online] Simplilearn.com. Available at: https://www.simplilearn.com/tutorials/data-
structure-tutorial/what-is-an-algorithm.