You are on page 1of 21

ASSIGNMENT 2 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title Unit 1: Programming

Submission date Date Received 1st submission

Re-submission Date Date Received 2nd submission

Student Name Nguyen Chau Toan Student ID GCD210174

Class GCD1102 Assessor name Nguyen Van Loi

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 Toan

Grading grid
P2 P3 P4 P5 M2 M3 M4 D2 D3 D4

1
 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date:


Lecturer Signature:

2
Table of Content
I. Introduction my program………………………………………………………………………………………….……5
1. Introduce the Overview…………………………………………………………………………………………….……5
2. List out application’s requirements………………………………………………………………………………..5
II. Explain programming paradigms…………………………………………………………………………………….5
1. Explain what is Procedural Programming with source code and illustrations………………….5
2. Explain what is Object-Oriented Programming with source code and illustrations…………6
3. Explain what is Event-Driven Programming with source code and illustrations………………7
4. Conclude which paradigms will be used to develop the application with explanation……9
III. Design and Implementation…………………………………………………………………………………………10
1. Flowchart……………………………………………………………………………………………………………………..10
2. Source code and screenshots of the final application with explanation………………………..11
3. Explain and evaluate coding standards used in the program………………………………………..18
4. Explain the benefits of using coding standards…………………………………………………………….20
References……………………………………………………………………………………………………………………………….21

3
Figure 1: POP in programming

Figure 2: OOP in programming

Figure 3: Event-Driven programming

Figure 4: Flowchart

Figure 5, 6: Book.cs

Figure 7, 8: Library.cs

Figure 9: Function main

Figure 10: Menu

Figure 11: Input

Figure 12: Display

Figure 13: Searching by name of author

Figure 14: Searching by name of the book

Figure 15: Delete

Figure 16: Press chooses

Figure 17: Enter number of book to add

Figure 18, 19: Enter information of book

Figure 20, 21: Show information of book

Figure 22: Searching by name of author

Figure 23: Searching by name of the book

Figure 24: Delete book by name

Figure 25: Exit program

Figure 26: Space between methods

Figure 27: Rules of the brackets

Figure 28: If statement

Figure 29: Length of the line of code

4
I. Introduce my program

1. Introduce the Overview


As you all know about books, these are things that rewrite the knowledge and culture of the
ancient people left behind. With the development of science and technology, people need
to learn more and more knowledge, especially young people. They often go to the Library or
Internet to find books about technology, science, space, novels, etc. So, it isn’t easy to
manage all of the information about them. Seeing such difficulty, I designed a small
software to solve this problem.

2. List out the application’s requirements


 Enter information of books
 Show information entered
 Find book by the name author
 Find by name book
 Delete book by name
 Exit

II. Explain programming paradigms

1. Explain what is Procedural Programming with source code and illustrations


Structure-oriented programming, also known as procedure-oriented programming (POP): is
a traditional programming technique in which a program is divided into functions
(subroutines). Subroutines use other functions or smaller subroutines to execute.
Simply put, structured programming breaks down a big problem into a small problem, a
minor problem into a micro problem. And so on until the problem is solved.
 Characteristic:
- While designing a program, POP follows a top-down programming approach
- Most functions allow system-wide data to be shared
- It also divides more extensive programs into smaller parts called functions
- It allows data to move freely around the system
- Functions convert data from one form to another

5
Figure 1: POP in programming

2. Explain what is Object-Oriented Programming with source code and illustrations


Object-oriented programming (Object-Oriented Programming - OOP): is a technical program
that will be divided into small parts called objects (Object). The object in the object-oriented
set will be suitable for implementing the problem, and it will have properties (properties),
operations (methods). Objects can interact with each other when exchanging data with
each other.
Simply put, OOP will be creating one large object from the smaller objects. If structure-
oriented is an analytic function, object-oriented is an aggregation function.
Functions will make the program bigger and bigger, so OOP will have to comply with many
regulations in development.
 Characteristic: OOP has four essential characteristics
- Encapsulation: Encapsulation allows hiding information and the internal processing
properties of the object. Other objects cannot directly affect the data inside and
change the object's state but must go through public methods provided by that
object. This property helps to increase the object's security and avoid unintentional
data corruption.

6
- Inheritance: Inheritance allows building a new class (Child class), inheriting and
reusing properties and methods based on the old class (Parent class) that existed
before. The Child classes inherit all the Parent class members and do not need to be
redefined. Subclasses can extend inherited components or add new ones.
- Polymorphism: Diversity in OOP settings allows different objects to perform the
same function differently.
- Abstraction: Calculation help remove the unnecessary complexity of the object and
focuses only on what is essential.

Figure 2: OOP in programming

3. Explain what is Event-Driven Programming with source code and illustrations


An event-driven program responds preeminent to user events or other similar input. The
principle of event-driven programming is essential in application development and different
types of programming, and it has resulted in the development of system calls and other
resources. Programmers use Event-Driven programming in graphical user interfaces and
other applications that perform user actions in response to user input.

7
 Characteristic:
- Service-Oriented: Service-oriented is a significant aspect of event-driven
programming used to develop programs for services. It does not slow down the
computer since service-oriented only uses a tiny percentage of the computer
processing power and services typically operate in the operating system's
background.
- Even: Nothing will happen unless the user interacts with the software, according to
this feature. Clicking buttons and entering text into text fields are examples of
events.
- Trigger Functions: According to this feature, nothing will happen until the user
interacts with the software. Events include things like clicking buttons and putting
text into text areas.
- Event handlers: When an event happens, an event handler is a function or method
that performs a particular action. An event handler may, for example, be a button
that, when clicked, shows a message and then shuts it when the user hits the button
again.

Figure 3: Event-Driven programming

8
4. The concluding model I will be used to develop the application with an explanation
 I used OOP and mixed a little POP to build a library management program in this
program. I use OOP and POP, and I use both because it's easier to manage code when a
program changes and system-wide data is shared between functions in the program,
thanks to POP.
 Instead of changing the object's source code, the programmer only needs to change
some component functions.
 Easy project expansion.
 Help programmers can significantly save system resources.
 OOP is highly secure and reusable.

9
III. Design and Implementation

1. Flowchart
Start

Input Choose
true
Choose = 1 Enter information of book

false true
Choose = 2 Show information entered
false true
Choose = 3 Find book by name of author
false true

Choose = 4 Find book by name of book


false true
Choose = 5 Delete book by name
false true
Choose = 6 End program

false

Figure 4: Flowchart

10
2. Source code and screenshots of the final application with the explanation
 Book.cs

Figure 5: Book.cs

Figure 6: Book.cs

11
 Library.cs

Figure 7: Library.cs

Figure 8: Library.cs

12
 Function main: cases that users will choose in my library manager program.

Figure 9: Function main

 Menu: These are all the essential functions a library management program needs. When
users need a function, they need to press a number corresponding to that function to
use it.

Figure 10: Menu

13
 Input: User enters the number of books to add.

Figure 11: Input

 Display: Displays information of entered books such as book title, author name, price,
language, year of manufacture, manufacturer, and semester.

Figure 12: Display

 Searching by name of author: When the user enters the name of an author, the
program will display the works written by that author that has been saved on the library
management program.

Figure 13: Searching by name of author

14
 Searching by name of the book: When the user enters the name of the work, the
program will display all the information of that work that has been entered.

Figure 14: Searching by name of the book

 Delete: Users who want to delete a book need to enter the name of the work and
delete that book from the library management software.

Figure 15: Delete

15
 Result
 Enter the number corresponding to the choice

Figure 16: Press chooses

 Enter the number of books to add

Figure 17: Enter the number of book to add

 Enter information of book needs to add

Figure 18: Enter information of book

Figure 19: Enter information of book

16
 Display information of books just enter

Figure 20: Show information of book

Figure 21: Show information of book

 Find by name author of books need to find

Figure 22: Searching by the name of author

 Find a book by name need find

Figure 23: Searching by the name of the book

17
 Delete book by name

Figure 24: Delete book by name

 Exit the program

Figure 25: Exit program

3. Explain and evaluate coding standards used in the program


 Space between methods

Figure 26: Space between methods

18
Building a program can be frustrating if there is no clarity between methods when a
programmer needs to add something to a method if there is a blank line between
methods, will create transparency, the programmer will be able to find a method that
needs editing quickly, I have also implemented it in my library manager, and I find it very
useful in the process your program builder.
 Rules of the brackets
There are two rules for closing the brackets:
- Put brackets on the same line as the keyword
- Put brackets on the next line to align with closing brackets

In my program, I used solution two because I feel when I write multiple blocks of
commands, I align parentheses to easier code management.

Figure 27: Rules of the brackets

 If statement
Always put the comparison variable on the left and the comparator on the right.

Figure 28: If statement

19
 Length of a line of code

Figure 29: Length of a line of code

In my program, each line of code contains only one statement, and each line should
have no more than 78 characters for optimal display.

4. Explain the benefits of using coding standards


 Minimize the risk of the project: Often, IT projects fail due to software development
problems, and coding standards reduce the risk of failures.
 Reduces complexity: The greater the complexity of a code, the more prone it is to
mistakes. Coding standards aid in developing software systems with less complexity,
hence reducing errors.
 Maintenance becomes easy: It is simple to maintain if the source code is consistent.
This is because anybody may step in at any point and carry it or make changes.
 Correction of bugs: A consistent source code makes it simple to find and fix flaws in
software.
 A comprehensive view: A consistent source code allows for a better understanding of
how the code fits into the more extensive program or the firm as a whole.

20
References
Lelli, F., 2019. francescolelli. [Online]
Available at: https://francescolelli.info/
[Accessed 22 8 2022].

unknow, 2017. thuatngumarketing. [Online]


Available at: https://www.thuatngumarketing.com/
[Accessed 22 8 2022].

unknow, 2021. alphaprogrammer. [Online]


Available at: https://www.alphaprogrammer.in/
[Accessed 23 8 2022].

unknow, unknow. alphaprogrammer. [Online]

Available at: https://www.alphaprogrammer.in/


[Accessed 23 8 2022].

21

You might also like