Assignment 1: Qualification BTEC Level 5 HND Diploma in Computing
Assignment 1: Qualification BTEC Level 5 HND Diploma in Computing
Assignment 1: Qualification BTEC Level 5 HND Diploma in Computing
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.
Grading grid
P1 P2 P3 M1 M2 D1
Summative Feedback: Resubmission Feedback:
Table of Codes................................................................................................................................................ 4
II. Identify the program units and data and file structures: ...................................................................... 9
1. Identify the variable and data type required in the program: .............................................................. 9
2. Identify and describe 2 different selection structures, including the condition(s) to check; state why
they are needed and where they can be used in the context of the scenario. ............................................. 9
4. Split the program into functions (sub-functions) and draw a hierarchy diagram to illustrate the
structure of your program: ........................................................................................................................ 15
III. Design the program using: use-case diagram and Flowchart: ........................................................... 16
IV. Review / evaluate your design, state clearly pros vs cons and which needs to improve, using
characteristics of procedural programming as bases to discuss: .................................................................. 21
References .................................................................................................................................................... 22
Table of Diagrams
Diagram 1: Diagram illustrate the structure of program .............................................................................. 15
Diagram 2: Use-case diagram of required actions ....................................................................................... 16
Diagram 3: Flowchart diagram menu operation........................................................................................... 17
Diagram 4: Flow chart diagrams printing ID and grade .............................................................................. 18
Diagram 5: Flow chart diagrams finding max grade .................................................................................... 19
Diagram 6: Flow chart diagrams finding min grade .................................................................................... 20
Table of Figure
Figure 1: Divide of programming languages (Beal, 2017) ............................................................................ 6
Figure 2: Programming paradigms (Anon., 2018) ........................................................................................ 6
Figure 3: The flow chart of “If…else” statement ......................................................................................... 10
Figure 4: The flow chart of “Switch-case” statement .................................................................................. 11
Figure 5: Flow chart of “For” loop ............................................................................................................... 13
Figure 6: Flow Diagram of “do…while” ..................................................................................................... 14
Table of Codes
Code 1: "Hello world !" in Java .................................................................................................................... 5
Code 2: "Hello world !" in C ......................................................................................................................... 5
Code 3: Example about procedural programming ........................................................................................ 8
Code 4: "If' Statement Function ................................................................................................................. 10
Code 5: “Switch-case” Statement Function ................................................................................................ 12
Code 6: For-Loop to find highest mark ....................................................................................................... 13
Code 7: For-loop to printf to the screen ...................................................................................................... 14
I. Introduction to procedural programming:
The term programming language usually refers to high-level languages, such as: Python, Java, C, C++, C#,
PHP, …Each of these programming languages has similarities and differences, standardized against a set of
separate rules.
• Machine Language: is the base language of the processor. Programs written in all other languages
are eventually converted to the machine language before that program is executed. Instructions in
the machine language are represented as binary codes. This is the only language a microprocessor
can directly detect and execute. (Nguyễn, 2019)
• Assembly language: is a low level programming language for computers. The assembly is converted
to machine code that is executed by a named utility program a compiler like NASM, MASM, etc.
• High-level programming language: is a programming language with a form close to a natural
language, with high independence, less dependent on the type of device (processor type) as well as
the compilers. Some popular high-level programming languages today such as C, C ++, Java, Pascal,
PHP, Visual Basic. (Nguyễn, 2019)
Example:
Code 3: Example about procedural programming
- In the C language programming example, predefined functions are represented by main function,
display function with specified data types. They are declared in the library #include <stdio.h>, with
commands with specific names such as: scanf, printf, ...
- In the example, the global variable is: int benngoai = 1000; This variable is declared outside of any
other function defined in the code. Therefore, a global variable can be used in all functions, unlike a
local variable, it is used in both main () and display ().
- In the example, local variables are: int a, int b; It is declared in the display () and main () functions
that are limited to the local scope in which it is provided. The local variable can only be used within
the method it was defined in, and if it is used outside the method specified, the code will stop
working. They cannot be shared for different functions.
- In the example, we use display () and main () as two independent functions, the problem is divided
into such sub-functions but grouped together to end a larger task, it represents the modularity of
procedural programming.
- In the example: int sum(int & x, int & y), the purpose is to find the address of x and y in the program
to pass the value to it.
II. Identify the program units and data and file structures:
• Do-while:
C is a basic programming language, the foundation for all programmers to learn to code, it is the basis for
learning more advanced languages.
Although the program runs normally and shows what is needed, it has not been optimized. Some comments
about the program:
1. Menu operation:
We should use a "switch-case" structure instead of "if-else", which in my opinion is easier to understand.
Disadvantages: Two separate arrays are difficult to manage. It takes time to check the elements of the two
arrays in turn to find the smallest and largest values.
References
Anon., 2018. geeksforgeeks. [Online]
Available at: https://www.geeksforgeeks.org/introduction-of-programming-paradigms/
[Accessed 7 October 2020].