0% found this document useful (0 votes)
172 views

Student Assessment Submission and Declaration

Uploaded by

Khôi Vũ
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)
172 views

Student Assessment Submission and Declaration

Uploaded by

Khôi Vũ
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/ 35

Higher Nationals

STUDENT ASSESSMENT SUBMISSION AND


DECLARATION
ASSIGNMENT FINAL REPORT
When submitting evidence for assessment, each student must sign a declaration confirming
that the work is their own.

Student name: Student ID:

Vũ Đăng Khôi BS01129

Class: Assessor name: Truong Quoc Khanh

SE07203

Issue date: Submission date: Submitted on: CMS

20/08/2024 20/08/2024

Re-submission date: Re-submitted on:

Programme: BTEC Level 5 HND Diploma in Computing

Unit n, title and code: Unit 1: Programming (H/618/7388)

Assignment number and title: Final Report

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.

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals
Student Declaration
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand
the consequences of plagiarism. I declare that the work submitted for assessment has
been carried out without assistance other than that which is acceptable according to
the rules of the specification. I certify I have clearly referenced any sources and any
artificial intelligence (AI) tools used in the work. I understand that making a false
declaration is a form of malpractice.

Student signature: Vũ Đăng Khôi Date: 20/08/2024

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals
Higher Nationals – Summative Assignment Feedback
Form
Student Name/ID Vũ Đăng Khôi BS01129
Unit Title Unit 1: Programming (H/618/7388)

Assignment Final Report Assessor Truong Quoc Khanh


Number 20/08/2024 20/08/2024
Date
Submission Date
Received 1st
submission
Date Received
Re-submission
2nd submission
Date
Assessor Feedback:
*Please note that constructive and useful feedback should allow students to understand:

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.

Grade: Assessor Signature: Date:

Resubmission Feedback:
*Please note resubmission feedback is focussed only on the resubmitted work

Grade: Assessor Signature: Date:

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals
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.

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals

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

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals

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

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals

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.

II. MAIN CONTENT


1. Provide a definition of what an algorithm is and outline the
process in building an application.(P1)
A. Provide a definition of what an algorithm
- An algorithm is a precise, step-by-step procedure or formula for solving a problem or
accomplishing a task. It is a sequence of well-defined instructions that takes some input (or
set of inputs) and produces an output (or set of outputs) in a finite amount of time.
Algorithms are fundamental to computer science and programming, as they form the basis
for designing and implementing solutions to various computational problems.
- Algorithms Characteristics
• Finiteness: An algorithm must always terminate after a finite number of steps.
• Definiteness: Each step of an algorithm must be precisely defined; the actions to be
carried out must be rigorously and unambiguously specified for each case.
• Input: An algorithm has zero or more inputs
• Output: An algorithm has one or more outputs
• Effectiveness: the algorithms is based on the available resources. It should be effective,
exact and suitable for programs.

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals
• Language Independent: The Algorithm designed must be language-independent. It has to
be general resources. We can apply to all programming languages.
- Types of algorithms
• Sequence: this type of algorithm is characterized with a series of
steps, and each step will be executed one after another.
• Branching: this type of algorithm is represented by the "if-then"
problems. If a condition is true, the output will be A, if the condition
is false, the output will be B.
This algorithm type is also known as "selection type".
• Loop: for this type, the process might be repeatedly executed under
a certain condition. It is represented by "while" and "for" problems.
But make sure the process will end after a number of loops under the
condition. This algorithm type is also known as "repetition type".
- Algorithm representation
• Natural language
Pseudocode is a natural language description, like handwritten steps on paper.
Pseudocode is used to describe the steps of the algorithm without caring for the specific
syntax of the programming language.
VD:
Begin
Initialize the sum = 0
With each number in the array
Add that number into the sum
End of loop
Return
End
• Flowchart
The block diagram is an intuitive way of the algorithm with cubes and arrows.
The shapes represent the steps, and the arrow representing the control flow.
The block diagram helps Visualize processes and offers an overview of the algorithm.
VD:

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals

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:

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals

Figure 2. Pseudo code

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals
B. outline the process in building an application.
 Identify Requirements: Gather and analyze the requirements for the application. This
involves understanding what the application needs to do, who the users are, and any
constraints or limitations.
 Define Scope: Clearly define the scope of the application to ensure it meets the intended
purpose without unnecessary complexity.
 Algorithm Selection: Choose appropriate algorithms to solve each part of the problem.
Consider factors like efficiency, complexity, and suitability for the task.
 Algorithm Design: Develop detailed step-by-step procedures (algorithms) to solve each
part of the problem. This includes considering edge cases and handling errors.
 Modularization: Divide the code into modules or functions to promote reusability,
readability, and maintainability.
 Documentation: Document the code to explain its purpose, inputs, outputs, and any other
relevant information.
 Integration Testing: Test the application as a whole to verify that all components work
together correctly.
 Debugging: Identify and fix any errors (bugs) in the code through systematic testing and
troubleshooting.
 Deployment: Prepare the application for release to users. This may involve configuring
servers, setting up databases, and ensuring security measures are in place.
 Monitoring: Monitor the application post-deployment to identify and address any
performance issues or bugs that arise.
 Updates and Maintenance: Periodically update the application to add new features,
improve performance, and fix bugs as needed. Maintain documentation to facilitate future
enhancements or troubleshooting.
 Gather Feedback: Collect feedback from users to identify areas for improvement and
inform future iterations of the application.

2.Determine the steps taken from writing code to execution.(P2)


ABC Software independent software company has asked you to develop a simple
program to calculate the monthly water bill. The specific requirements are as follows
Allow users to enter the following information:
- Customer name
- Water meter index last month
- This month's water meter index
- Type of customer (household, administrative agency, production unit, business
service)
Calculate and display the following information:

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals
- Total water bill
- Including 10% VAT
Household customers have different prices based on the consumption. The prices are
provided in the problem.

Figure 3. Code of the electricity and water budget

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals

Figure 4. Run Code Calculating Water Cash for Households

Figure 5. Run Code Code Calculating Water Cash for


Administrative Agency and Public Services

Figure 6. Run Code Calculating Water Cash for


Production Unit

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals

Figure 7. Run Code Calculating Water Cash for Businesses

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

- 2 for government/public service

- 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):

- For household customers:

- 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 between 21 and 30, the bill is calculated as:

(59.730 + 70.520 + ((m3 - 20) * 8.699)) * 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.

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals
- For government/public service customers, the bill is calculated as (m3 * 9.955 )* 1.1.

- For manufacturing customers, the bill is calculated as (m3 * 11.615) * 1.1.

- For business customers, the bill is calculated as (m3 * 22.068 )* 1.1.

5. The calculated water bill is stored in the variable( f ).

6. Finally, the code prints the water bill for the current month.

3. Discuss what procedural, object-orientated and event-driven


paradigms are; their characteristics and the relationship
between them. (P3)
-Programming procedure, object -oriented and events are three different approaches to build
software. Each model has its own advantages and disadvantages, suitable for different types of
applications.

 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.

Figure 8. Examples of procedural programming

 OOP revolves around objects, which combine data (attributes) and actions (methods). It's
like modeling real-world entities.

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals

Figure 9. Examples of object -oriented programming

 Event-driven programming responds to events (user actions, system notifications). It's like
waiting for something to happen and then reacting.

Figure 10. Examples of event programming

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals
4. Write a program that implements an algorithm using an IDE.(P4)
Variable Declarations:

 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:

 if (int.TryParse(txtPrevious.Text, out previous) && int.TryParse(txtCurrent.Text, out


current)): This block checks if the previous and current water readings can be successfully
parsed from their respective text box controls (txtPrevious and txtCurrent). If the parsing is
successful, the values are stored in the previous and current variables.

Water Usage Calculation:

 waterUsage = current - previous;: This line calculates the water usage by subtracting the
previous reading from the current reading.

Water Bill Calculation:

 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.

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals

Figure 11. Winform's water budget code

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals

Figure 12. Winform water budget code of Design table

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals

Figure 13. Calculate water money for households

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals

Figure 14. Calculate water money for public services

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals

Figure 15. Calculate the water money for the production unit

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals

Figure 16. Calculate water money for businesses

5. Explain the debugging process and explain the debugging


facilities available in the IDE.(P5)
The process of debugging application include

 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

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals

Figure 17. run debug

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

6. Explain the coding standard you have used in your code(P6)


This source code is written in C# and is used in a Windows Forms application. It calculates the
water bill based on the input information such as:

Customer Name

Previous Electricity Consumption

Current Electricity Consumption

Customer Type

The coding standards used include:

Namespace: WaterBill - A group of classes related to calculating water bills.

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals
Partial Class: Form1 - This class is divided into several parts, each part is defined in a separate
file.

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.

String Formatting: ToString("C") - Formats the bill result into currency.

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.

7. Analyse the process of writing code, including the potential


challenges faced. (M1)
- The steps needed to write the first step is to understand the requirements and the goal is
aiming to understand unknown or incomplete will cause the quality of the second step to set the
structure and algorithm to star Achieving use efficiency and easy to maintain when there is a
problem after writing the code will come to the test step to check if the code is faulty. If the
error must be clearly defined where the error is and the solution. Finally, it is necessary to
review the last time and optimize to increase the effectiveness but not affect the project.
 Technical Complexity: Dealing with complex algorithms or integration with external
systems can be challenging. Requires deep technical knowledge and problem-solving
skills.
 Time Constraints: Meeting deadlines while ensuring code quality and functionality can be
demanding. Requires effective time management and prioritization.
 Error Handling: Identifying and handling errors effectively, especially in complex systems
or with large codebases, requires thorough testing and debugging skills.
 Security Concerns: Writing secure code to prevent vulnerabilities and protect sensitive data
requires awareness of security best practices and potential threats.
 Performance Optimization: Optimizing code for efficiency without sacrificing clarity or
maintainability can be challenging. Requires profiling tools and knowledge of performance
trade-offs.

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals

Figure 18. flowchart

8. Compare the procedural, object-orientated and event-driven


paradigms used in given source code of an application.(M2)
-Procedural Programming (POP)

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.

-Object-Oriented Programming (OOP)

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals
There are minimal signs of OOP in the given code:

 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.

-Potential Improvements using OOP

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.

9. Enhance the algorithm written, using the features of the IDE to


manage the development process.(M3)
Understanding the Code

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.

Potential Enhancements Using IDE Features

Code Readability and Maintainability

 Indentation: Ensure consistent indentation for better readability. Most IDEs have automatic
indentation options.

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals
 Naming Conventions: Use descriptive names for variables and controls. Some IDEs
suggest naming conventions.
 Comments: Add comments to explain complex logic or the purpose of code sections.
 Code Formatting: Format the code consistently using the IDE's formatting options.

Error Handling and Input Validation

 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.

Code Structure and Organization

 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

 Performance: If performance is critical, profile the code to identify bottlenecks.


 Data Structures: Explore using more efficient data structures if applicable.
 Algorithms: Consider alternative algorithms for calculations if necessary.

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

private void CalculateWaterBill()

int previousReading, currentReading;

double waterUsage, bill = 0;

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals
// Input validation

if (!int.TryParse(txtPrevious.Text, out previous) || !int.TryParse(txtCurrent.Text, out


current))

lblResult.Text = "Invalid input. Please enter valid previous and current readings.";

return;

waterUsage = currentReading - previousReading;

// Determine customer type and calculate bill

if (rbHoGiaDinh.Checked)

bill = CalculateHouseholdBill(waterUsage);

else if (rbCoQuanHanhChinh.Checked)

bill = CalculateGovernmentAgencyBill(waterUsage);

// ... other customer types

lblResult.Text = "Tiền nước bạn cần trả trong tháng này là: " + bill.ToString("C");

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals

private double CalculateHouseholdBill(double waterUsage)

// Calculate bill based on water usage for household

// ...

private double CalculateGovernmentAgencyBill(double waterUsage)

// Calculate bill based on water usage for government agency

// ...

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.

10.Examine how the debugging process can be used to help


develop more secure, robust applications.(M4)
-Debugging is an important part of developing secure and robust applications. Here are some ways
that debugging can be used to improve the quality and safety of applications: Early detection and
correction of errors: By implementing a continuous debugging process throughout the
development process, errors can be detected and corrected early, reducing the cost and time of
correction later. Improved testing: Debugging can help enhance the testing process, including unit
testing, integration testing, and system testing. This helps ensure that errors are detected and
corrected before the application is deployed. Improved safe programming: By analyzing errors
discovered during debugging, developers can learn and apply safer programming techniques,
reducing the likelihood of similar errors occurring in the future. Enhanced Knowledge and Skills:
The debugging process provides an opportunity for developers to enhance their knowledge and
skills in technologies, programming languages, and security techniques, making them more
proficient in developing secure applications. Improved Development Process: Analyzing issues
and errors that arise during debugging can help improve the development process, including the

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals
processes, tools, and practices used, contributing to the quality and safety of future applications.
Overall, the debugging process plays an important role in developing secure and robust
applications, helping to detect and correct errors, enhance testing, improve secure programming,
enhance knowledge and skills, and improve the development process.

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):

Figure 19. Comparative photo between POP and OOP

12.Evaluate the use of an IDE for development of applications


contrasted with not using an IDE (D3):
Using an IDE (Integrated Development Environment) in the application development process
has many advantages over not using an IDE. Here are some important comparisons:

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.

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals
Not using an IDE: Programmers have to perform many manual operations such as filling in
code, searching and using libraries, etc. This reduces the productivity and speed of
development.

Code management and organization:

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.

Integrating development tools:

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.

Programming language support:

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.

Maintenance and development:

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.

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):
The Role and Purpose of Coding Standards

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals
A coding standard is a set of guidelines and conventions governing the structure and style of
software code. It provides a framework for developers to follow, ensuring consistency, readability,
and maintainability in codebase.

Importance for a Team

 Improved Collaboration: A shared coding standard facilitates teamwork by establishing a


common language and understanding.
 Enhanced Code Readability: Consistent code style makes it easier for multiple developers
to understand and modify code.
 Accelerated Development: Adherence to standards reduces time spent on code formatting
and style debates, allowing for faster development.
 Reduced Errors: Coding standards often include best practices that help prevent common
errors.
 Easier Maintenance: Well-structured code is simpler to maintain and update, leading to
lower costs and faster bug fixes.

Importance for an Individual

 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

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals
III. CONCLUSION
In conclusion, the water bill calculation program was developed using an object-oriented
programming approach, which allowed for a modular and maintainable codebase. The key
components of the program were the Customer, WaterMeter, and WaterBill classes, each with
their own responsibilities and working together to handle the input, calculations, and output of
the water bill information.

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.

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0
Higher Nationals

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.

BTEC HN Student Submission and Declaration Form


Issue Date: Jan 2024 Owner: HN QD
DCL1 Public (Unclassified) Version 2.0

You might also like