Docsity

asm1 programming btec, Essays (high school) of Programming Languages

Toggle sidebar
bg1
ASSIGNMENT 2 FRONT SHEET
Qualification BTEC Level 5 HND Diploma in Computing
Unit number and title Unit 1: Programming
Submission date 29/03/2024 Date Received 1st submission 29/03/2024
Re-submission Date Date Received 2nd submission
Student Name NGUYEN LE THANH CONG Student ID BS01057
Class SE07102 Assessor name TRUONG QUOC KHANH
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.
Student’s signature Cong
Grading grid
P3 P4 P5 P6 M2 M3 M4 D2 D3 D4
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25

Partial preview of the text

Download asm1 programming btec and more Essays (high school) Programming Languages in PDF only on Docsity!

ASSIGNMENT 2 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 1: Programming Submission date 29/03/2024 Date Received 1st submission 29/03/ Re-submission Date Date Received 2nd submission Student Name NGUYEN LE THANH CONG Student ID BS Class SE07102 Assessor name TRUONG QUOC KHANH Student declaration I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that making a false declaration is a form of malpractice. Student’s signature Cong Grading grid P3 P4 P5 P6 M2 M3 M4 D2 D3 D

❒ Summative Feedback: ❒ Resubmission Feedback: Grade: Assessor Signature: Date:

List of Table:

  • I. Introduction....................................................................................................................
  • II. Explain programming paradigms...................................................................................
      1. Procedural programming:..........................................................................................
      1. Event Driven programming:.......................................................................................
      1. Object Orientated programming:..............................................................................
      1. Comparison between three programming paradigms:.............................................
  • III. Explain about IDE (Integrated Development Environment).........................................
      1. Definition:..................................................................................................................
      1. Features:....................................................................................................................
      1. Debugging:.................................................................................................................
      • 3.1. Definition:............................................................................................................
      • 3.2. How it works:.......................................................................................................
      • 3.3. Tools used:...........................................................................................................
      • 3.4. Process of debugging:..........................................................................................
  • IV. Coding Implementation..............................................................................................
      1. Design of program:..................................................................................................
      1. Flowchart of program:.............................................................................................
      1. Code of water bill application:.................................................................................
      • 3.1. Input, output of application:.............................................................................
      • 3.2. Algorithm for application:.................................................................................
      • 3.3. Requirement running program:........................................................................
      • 3.4. Code and result:................................................................................................
      1. Coding standard.......................................................................................................
      • 4.1. Definition:..........................................................................................................
    • 4.2. Coding standards I have used in the program:.................................................
  • V. References....................................................................................................................
  • Table 1: Relationship between three programming paradigms..........................................
  • Figure 1: The visual application before enter Submit button.............................................. List of Figure:
  • Figure 2: The visual application after enter Submit button.................................................
  • Figure 3: Flowchart of program...........................................................................................
  • Figure 4: Have to enter name for running the program......................................................
  • Figure 5: Have to choose type for running the program.....................................................
  • Figure 6: Have to enter number of people in case of household customer........................
  • Figure 7: Can't enter number of people in case of customer is not household..................
  • Figure 8: Have to enter last month's water uses for running the program.........................
  • Figure 9: Have to enter this month's water uses for running the program........................
  • Figure 10: The program can not run if last month’s water uses more than this month.....
  • and enter their name........................................................................................................... Figure 11: Let customer enter their Last month water's uses and This month water's uses
  • Figure 12: Requirement for running program.....................................................................
  • Figure 13: Condition for bool isChecktype...........................................................................
  • public services and Production Units and Business Services............................................... Figure 14: Function for printing water bill for customer who is Administrative agency,
  • Figure 15: Function for printing water bill for customer who is Household.......................
  • Figure 16: Price to calculate water bill for customer who is Household.............................
  • Figure 17: Price to calculate water bill for customer who isn't Household.........................

I. Introduction

In this essay, I will show my project about calculating bill water application that was produced using the IDE and was subject to Coding standards for a comprehensive business problem. As a result, I have to write a WinForm application in the C# programming language of Microsoft Visual Studio. I also introduce to three programming paradigms: Procedural Programming, Object Orientated Programming, Event Driven Programming.

II. Explain programming paradigms

1. Procedural programming:

Procedural programming is a way of telling a computer what to do by giving it a list of instructions. These instructions a grouped together into smaller tasks called procedures. Procedural programming completes the task into step by step instructions. This style of programming is focused on the steps themselves, rather than on the date the program works with. It’s a good way to code for simpler tasks but this way couldn’t be suitable for complex tasks.

2. Event Driven programming:

Instead of following a step by step instructions, event-driven programming lets programs respond to things happening around them. These "things" are called events, and they can come from various sources:  Users interacting with the program (clicks, swipes, key presses)  Sensors in the environment  Other programs sending messages  The network (data arriving or being sent)

The program constantly listens for these events, and when one happens, it triggers a specific piece of code designed to handle that situation. This makes event-driven programming useful for programs that need to be flexible and react to unexpected changes. EDP is particularly useful for programs that need to handle many things at once, or that need to react to unpredictable events from the outside world. For example, user interfaces, video games, and network servers all heavily rely on event-driven programming.

3. Object Orientated programming:

Instead of just telling the computer what to do step-by-step (like a recipe), Object- oriented programming (OOP) lets you organize programs around real-world things. These things are called objects, and they bundle together data (like what they are and their properties) and instructions (what they can do). This makes OOP easier to understand and manage, especially for big and complex programs. OOP has 4 basic properties:  EncapsulationAbstractionInheritancePolymorphism

(objects) that contain data (properties) and functionalities (methods) to operate on that data. objects. Objects are instances of classes and contain data and methods specific to that object. interact with each other through method calls. maintainabilit y for complex projects. EDP Focuses on how programs react to events (user interactions, sensor data, network activity) rather than following a rigid list of instructions. Code is structured around event listeners that wait for specific events and then execute corresponding code to handle those events. Control flow is event- driven, meaning it depends on the order and timing of events that the program encounters. Highly responsive to user input and external changes, ideal for user interfaces and network applications. Debugging event- driven programs can be challenging due to the asynchronous nature of events. Table 1 : Relationship between three programming paradigms

III. Explain about IDE (Integrated Development Environment)

1. Definition:

An IDE stands for Integrated Development Environment. It's basically a software application that combines a bunch of different tools that programmers use to write computer programs.

2. Features:

Source code editor: This is where programmers write their code. IDEs typically have features like syntax highlighting, which makes the code easier to read, and code completion, which can help programmers write code faster.  Build automation tools: These tools help programmers automate the process of building their programs. This can save programmers a lot of time and effort.  Debugger: This tool helps programmers find and fix errors in their code.  There are also many other features that IDEs may have, such as version control integration, unit testing frameworks, and code profilers.  IDEs can be used for a variety of programming languages, including Python, Java, C++, and web development languages like HTML, CSS, and JavaScript.

3. Debugging:

3.1. Definition: Debugging refers to the process of identifying and fixing errors, or bugs, in software. It's a vital part of software development to ensure the final product works as intended. Debugging involves finding and resolving issues that cause a program to malfunction, perform poorly, or generate incorrect results. These issues are often called bugs.

5. Fix the Error (Implement a Solution): Once you understand the root cause, you can fix the bug. This might involve correcting a syntax error, fixing a logical mistake in the code, or handling unexpected inputs differently. 6. Test the Fix: After implementing the fix, thoroughly test the program again. Verify that the error is resolved and no new issues are introduced. Sometimes, fixing one bug might uncover another, so it's important to retest comprehensively. 7. Document the Fix: It's good practice to document the bug, the solution implemented, and any relevant notes for future reference. This helps maintain the codebase and can be valuable for other developers working on the project.

IV. Coding Implementation

1. Design of program:

The program was designed by a window form, in the context of Windows Forms development, is the foundation of a graphical user interface (GUI) for desktop applications. The visual application before enter Submit button:

Figure 1 : The visual application before enter Submit button The visual application after enter Submit button:

2. Flowchart of program:

Figure 3 : Flowchart of program

3. Code of water bill application:

3.1. Input, output of application:Input:

  1. Name of customer
  2. Type of customer
  3. People number of customer (for customer is household)
  4. Last month water’s uses index
  5. This month water’s uses index  Ouput:
  6. Name of customer
  7. Type of customer
  8. People number of customer (for customer is household)
  9. Last month water’s uses
  10. This month water’s uses
  11. Consumption of water
  12. Total price 3.2. Algorithm for application: Step 1: Let customer enter their name Step 2: Let customer choose their type Step 3: Let customer enter last month water’s uses Step 4: Let customer enter this month water’s uses Step 5: Calculate total price for each customer’s type

Customer have to choose their type for running the program Figure 5 : Have to choose type for running the program

In case of customer is household, they must enter number of people for running the program Figure 6 : Have to enter number of people in case of household customer