Professional Documents
Culture Documents
Bài Asigment 2
Bài Asigment 2
INFORMATION TECHNOLOGY
ASSIGNMENT 2
UNIT: PROGRAMMING
CLASS : SE06202
STUDENT ID : BD00345
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:
Nhat Linh
Grading grid:
P2 P3 P4 P5 M2 M3 M4 D2 D3
❒Summative Feedbacks: ❒Resubmission Feedbacks:
Last but not least, I would like to thank my family, who gave birth to me from the beginning
and supported me spiritually. They are always behind to care and help me have more motivation to
complete the work well!
I further declare that I have not previously submitted this assignment for assessment in any
other unit, except where explicit permission has been granted by all unit coordinators involved, or
at any other time in this unit, and that I have not duplicated or stolen ideas from the work of others
in any way.
I verify that the work I've submitted for this assignment is all my own, and that all
research sources have been properly credited.
Nhat Linh
REVIEWERS………………………………………………………………………………………..ii
ACKNOWLEDGMENTS ...................................................................................................... ii
INTRODUCTION ................................................................................................................. 1
2.2 Analyze the common features that a developer has access to in an IDE. (M2) ....... 22
3.1 Write a program that implements an algorithm using an IDE and Use the IDE to
manage the development process of the program. (P3-M3) ......................................... 33
4.2 Outline the coding standard you have used in your code. (P5) ............................... 56
Figure 33 Cross-platform............................................................................................. 27
Programming plays a very important role in life. It will help us understand more deeply
what an algorithm is, and understand programming models such as procedural
programming, object-oriented programming, the structure of a program, data, basic data,
and introduction.
Give students knowledge of IDE rules of naming in code. At the same time, helping stu-
dents have the knowledge to build basic applications. Coming to this report, we will learn
about the characteristics of procedural, object-oriented and event-driven programming,
conduct an analysis of a suitable Integrated Development Environment (IDE). Let's find out
in this assignment.
❖ Definition POP
There are two types of data, which are associated with these modules, one is global and
another is local data.
- The global data is available to the function so it is easily accessed by any function,
which creates certain problems.
❖ Application of procedural programming (POP)
- File management: By using procedures and functions to perform operations such as
reading, opening and closing files, procedural programming can be applied in reading data
and processing files.
- Embedded systems: Procedural programming can be used Procedural programming
can be used for hardware control, memory management, event handling, and other tasks in
embedded systems.
- Digital Science: It is used in arithmetic computation, data analysis and simulation.
- Application multitasking: POP allows concurrent tasks to be handled through the use
of processes and threads to manage and control tasks sequentially.
- Coures code:
- Code run:
❖ Definition OOPs
- Object-Oriented Programming (OOP) is a programming paradigm in computer science
that relies on the concept of classes and objects. It is used to structure a software program
into simple, reusable pieces of code blueprints (usually called classes), which are used to
Figure 5 Classes
Figure 6 Object
- Data abstraction: Simplify complex objects by defining classes with abstract data
types.
- Inheritance: Objects can inherit properties and behaviors from other objects or classes.
Figure 9 Inheritance
Figure 10 Polymorphism
- Overloading and Overriding: Methods can be defined with the same name but different
parameters (overloading) and derived classes can provide their own implementation of
inherited methods (overriding).
Figure 12 Binding
- Code Explanation:
In the above example, I have created two classes: Account and SavingsAccount, using
inheritance method in C#. The Account class is the base class, representing a bank account.
This class has two properties: AccountNumber (account number) and Balance (balance).
The Account class provides methods to deposit (Deposit), withdraw (Withdraw) and
display the balance (DisplayBalance). The Withdraw method checks if the balance is
sufficient for withdrawal.
The SavingsAccount class inherits from the Account class and extends the functionality
by adding an InterestRate property and a CalculateInterest (calculating interest) method.
The CalculateInterest method calculates the interest rate and adds it to the current balance.
In the Main section, I created a SavingsAccount object with the account number and the
corresponding interest rate. Then we make a deposit to the account through the Deposit
method and display the account information using the DisplayBalance method. Next, we
calculate the interest rate and add it to the current balance via the CalculateInterest method.
We withdraw some amount from the account using Withdraw method and show the account
information after withdrawing.
❖ Definition EDP
- Event driven programming (EDP) is a paradigm that relies on the occurrence of events
to trigger the execution of certain functions or methods. EDP can improve the
responsiveness, modularity, and scalability of your applications, but it also requires careful
design and organization of your code.
- When programming games in which a set of objects carries out control flow.
- When creating server applications, it is undesirable to spawn service
processes if, for one reason or another.
- When building user interfaces, including graphical ones.
- Procedural and Event Driven describe the general workflow of the application or
decision making logic where as Object Oriented describes more the structure of the decision
making logic
- Procedural describes a sequential workflow of logic, in general there are many steps
that must be performed in a sequence, there may be criteria between each step that might
an IDE. (M2)
Visual Studio was first released in 1997. The first version of Visual Studio was numbered
"Visual Studio 97" and was released in February 1997. Before that, Microsoft had separate
development tools. for each language such as Visual Basic, Visual C++ and Visual FoxPro.
Visual Studio 97 is the first time these tools have been combined into a single integrated
development environment (IDE), providing a unified and integrated development experience
for developers.
- Visual Studio 2010: Released in 2010, it offered an improved user interface, .NET
Framework 4.0 support, and integration with Windows Azure.
Figure 33 Cross-platform
Figure 40 Debugging
- Build and Deploy: Offers customization options for building, releasing, and deploying
applications.
- Code Analysis and Testing: Offers Code Analysis and Code Metrics tools for optimizing
code quality and identifying issues.
Use the IDE to manage the development process of the program. (P3-
M3)
In this part, I will write a program to create an interface with login / account creation
function, then open the student management interface, which has the function of entering
and updating information using DataGridview.
❖ Step 8: After the design is complete, you will get an interface as follows.
❖ Step 10: And after setting the properties for each element in the winform, we
continue to double-click on each component to code each function for each
component.
Figure 63 Debugging
Figure 64 Debugging
❖ Step 13: To connect two created winforms together you need to use the command
below.
- When running the code, you will first be taken to the account creation interface
to log in.
- Debugging is the process of identifying and fix errors or defects in a computer program
to ensure that it runs correctly and produces the correct result expected output. It involves
a systematic approach to locating and resolving issues that prevent the program from
functioning as intended. And Visual Studio provides us with many tools to simplifythe
process of debugging, finding and fixing program errors easier and faster.
- The first step is to identify error in the program. This can be done through various
means, such as observing unexpected behavior, incorrect outputs, or encountering
exceptions during program execution or by Breakpoints in Visual Studio.
I will write a simple project that sum of two number so that it prints to the screen.
Error 1:
Error 2:
Error 1:
In the above code, there is a logical error that I forgot to set the division condition in case
b is zero, causing the Form to run the calculation wrong.
This makes when declaring " Application " it will give an error as shown below if we do not declare
the library " using System.Windows.Forms; "
And to fix the above error we just need to declare the library used to run Winforms with the
statement " using System.Windows.Forms; "
4.2 Outline the coding standard you have used in your code. (P5)
- There are many Coding Standard Used, but here are some of the most usually:
Variable Naming:
- Provide clear comments or footnotes explaining the purpose and usage of variables,
especially for complex or less intuitive ones.
Naming Rules:
- Avoid using the same names with different cases (case sensitive), as it can lead to
confusion and unintended behaviors.
- When naming abbreviations, use Pascal Case or Camel Case to make them easily
distinguishable from regular words and to improve code understanding.
- Avoid using acronyms or parts of identifiers that might cause ambiguity or conflicts
within the codebase.
- Use Camel Case for names starting with a lowercase letter, followed by capitalized
first letters of subsequent words. This convention is ideal for local variables and method
names.
Namespace Naming:
- Choose meaningful nouns or noun phrases for class and struct names in Pascal
Case, clearly indicating the object's purpose and responsibilities.
- Name interfaces with adjective phrases or noun phrases, and prefix them with "I" to
distinguish them from classes.
- When inheriting classes, the derived class name should reflect the base class's name
to maintain a clear hierarchy.
- Use verb or verb phrases for method names, clearly conveying their actions or
operations.
- Fields should be named in Pascal Case, using nouns, noun phrases, or adjectives,
and avoiding prefixes to keep code clean and concise.
Indentation:
- Indent every substatement inside a block to clearly define code hierarchy and control
flow.
- Maintain aligned opening braces in a straight column with the corresponding closing
brace to make code blocks visually coherent.
in C# Winforms there are many rules for naming objects, but below is a summary
of some common naming conventions for objects in Winforms: