Unit 0: IT Fundamentals - Procedural Programming Analysis and Design

Verified

Added on  2022/02/26

|25
|5515
|15
Report
AI Summary
This report presents a comprehensive analysis and design of a procedural programming solution for a grade management application, as requested by a math teacher. The report begins with an introduction to procedural programming and programming languages, discussing their key features and characteristics. It then delves into the analysis phase, identifying variables, data types, selection structures (if, if-else, switch-case), and iteration constructs (for, do-while) required for the application. The program is broken down into functions, and a hierarchy diagram illustrates its structure. The design phase includes a use case diagram for required actions and flowcharts for menu operation, printing grades, and finding maximum and minimum grades. Finally, the report evaluates the design, highlighting its strengths and weaknesses based on procedural programming principles, and concludes with a discussion of potential improvements. The report is formatted in a formal business style with appropriate headings, subsections, and references using the Harvard referencing system.
Document Page
1
Assignment Brief 1 (RQF)
Higher National Certificate/Diploma in Computing
Unit Number and Title Unit 0: IT Fundamental & Procedural Programming
Academic Year 2021
Unit Tutor Ho Nguyen Phu Bao
Assignment Title Analysis and Design a solution for procedural programming
problem
Issue Date
Submission Date
IV Name & Date Vo Minh Tri
Learning Outcomes and Assessment Criteria
Pass Merit Distinction
LO1 Understand the principles of procedural programming
LO2 Be able to design procedural programming solutions
P1 Provide an introduction to
procedural programming
M1 Discuss on characteristics
and features of procedural
programming
D1 Critically evaluate the
design of your solution
against the
characteristics and
features of procedural
programming.
P2 Identify the program units
and data and file structures
required to implement a
given design
M2 Review the design of a
procedural programming
solution.
P3. Design a procedural
programming solution for a
given problem
Assignment Brief
Scenario:
A math teacher wants to manage grades of a class. He asks you to help him to write a
small application to do that. He needs to enter student IDs, student’s grades and store
these information into 2 separate arrays (integer array for IDs and float array for
grades). Then he needs to print all student IDs together with their grades. Finally, he
needs to know which student has highest grade and lowest grade. Your program should
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
2
be menu based with the options above. When an option is done, the program should go
back to the main menu so he can choose another option. There should be an option to
quit program.
Task 1
To prove your programming ability to be appointed to this small project, please prepare
an illustrated guide on programming in general and a particular emphasis on procedural
programming. Here you will need to include introduction to computer programming
languages and discuss key features of procedural programming.
Task 2
Your next task is to do the analysis for the scenario mentioned above by doing the
following subtasks
Identify the variables and data types required in the program.
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.
Identify and describe any iteration constructs.
Split the program into functions (sub-functions) and draw a hierarchy diagram to
illustrate the structure of your program.
Task 3
You need to use a drawing tool to draw design diagram for your program, includes:
A use case diagram for actions required
Flow chart diagrams for: menu operation, printing IDs and grades, finding max
grade and finding min grade.
Review / evaluate your design, state clearly pros vs cons and which needs to
improve, using characteristics of procedural programming as bases to discuss.
Write a report for 3 tasks above and submit the report to CMS in PDF format.
Submission Format
The submission is in the form of an individual written report. This should be written in a
concise, formal business style using single spacing and font size 12. You are required to make
use of headings, paragraphs and subsections as appropriate, and all work must be supported
with research and referenced using the Harvard referencing system. Please also provide a
bibliography using the Harvard referencing system.
Document Page
1
Table Of Contents
Assignment Brief 1 (RQF) ...................................................................................................... 1
Higher National Certificate/Diploma in Computing ................................................................ 1
Introduction ........................................................................................................................... 2
Chapter 1: Procedural Programming and Programming Languages (P1, M1) ............................... 3
1.1 What is Programming Language? ....................................................................................... 3
1.2 Procedural Programing................................................................................................... 5
1.2.1 What is procedural programming and why is it so important? ...................................... 5
1.2.2 Characteristics of procedural programming language .................................................. 6
Procedural or Procedure Oriented Programming (POP): ...................................................... 6
Main Characteristics of POP: ............................................................................................ 6
1.2.3 Key features of procedural programming ................................................................... 6
Chapter 2: Analysis (P2) ......................................................................................................... 7
2.1 Variables and data types ................................................................................................. 8
2.1.1 Variables ........................................................................................................... 8
2.2 Conditional statements and loop statement needed in the problem .................................... 10
2.2.1. If” statement function ...................................................................................... 10
2.2.2 If – Else” statement function ........................................................................... 10
2.2.3. Switch case” statement function........................................................................ 11
2.3. Loop statement........................................................................................................ 14
2.3.1. “For” statement function .................................................................................... 14
2.3.2. “Do – while” statement function ........................................................................ 14
2.4. Functions ................................................................................................................. 15
Chapter 3: Design the solution to the problem(P3, M2) ............................................................ 16
3.1 USE Case ................................................................................................................... 16
3.2 Flowcharts .................................................................................................................. 17
3.2.2 Input and Print name and grade of students .............................................................. 18
3.2.3 Menu Control. ...................................................................................................... 18
3.2.4 Student Rankings. ................................................................................................. 19
3.2.5 Find Max Grade. ................................................................................................... 20
3.2.6 Find Min Grade. .................................................................................................... 21
Chapter 4: Evaluate Problem (D1) .......................................................................................... 22
Conclusion .......................................................................................................................... 22
References ........................................................................................................................... 23
Document Page
2
Table Of Figure
Figure 1- Programming Language ........................................................................................... 3
Figure 2-ENIAC ..................................................................................................................... 4
Figure 3- Programming Languages Ranking (Source: www.tiobe.com) ........................................ 4
Figure 4 - Code Python ........................................................................................................... 5
Figure 5- Example of Procedural Programming ......................................................................... 5
Figure 6- Hello Word in C language ......................................................................................... 6
Figure 7- Global Variable and Local Variable ........................................................................... 7
Figure 8- Another Libraries ..................................................................................................... 7
Figure 9 - : Data types in C language (Mishra, 2021) .................................................................. 9
Figure 10 - Variables and Data types in this program ............................................................... 10
Figure 11 - Example for using "if" statement function ............................................................. 10
Figure 12 - Example of using "if-else" statement functio.......................................................... 11
Figure 13 - Hierarchy diagram program ............................................................................. 12
Figure 14 - Example of using "switch case" statement function ......................................... 13
Figure 15 - Example of using "for" statement function ....................................................... 14
Figure 16 - Example of using "Do-while" statement function ............................................. 15
Table Of Diagram
Diagram 1 - Use Case Diagram .............................................................................................. 16
Diagram 2- Input Students ..................................................................................................... 17
Diagram 3- Menu control ...................................................................................................... 18
Diagram 4-Student Rankings ................................................................................................. 19
Diagram 5-Find Max Grade ................................................................................................... 20
Diagram 6- Find Min Grade .................................................................................................. 21
Introduction
This is the first time I doing an assignment but I will try my best to get an M grade. With the
development of social, nowadays, the application of technology is becoming more and more
popular. Therefore, it requires students of information technology to improve their knowledge even
more. However, to build a solid house, you need a solid foundation. That's why Procedural
Programming (PROG102) is a very important subject for an information technology student like
me. This course has helped me to understand more deeply about the components of the computer
such as CPU, RAM, ROM; Learn more about system numbers like Octal, Hexadecimal and how to
convert between system numbers. Also, I know more about how an operating system works. The
most special is the C programming language. Although it is an old language, it has helped me
understand the steps to solve problems, the syntax, and loops in programming, ... Here It's a huge
step for me to learn more about programming in the future.
In assignment, I will perform 3 chapter
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
3
Chapter 1: I will introduce programming languages, procedural programming. And the main
functions of procedural programming.
Chapter 2: I will present the libraries, variables, statements, and loops that I plan to use in the
program and explain how I intend to use them.
Chapter 3: I will present the flowchart, work breakdown structure and use case diagram I will use in
the program about interpreting them with Pseudo code.
Chapter 1: Procedural Programming and Programming Languages
(P1, M1)
1.1 What is Programming Language?
From time immemorial, when humans first appeared on earth, they created language to
communicate with each other. Language is used to express one's meaning and feelings
towards
others, through which people understand each other. As people developed, they also began to
create languages that were not used for normal communication, but a way for them to
"communicate" with computers. Programming language is a tool we use to create a program
for the computer so that the computer follows instructions and produces the results that the
programmer wants. The computer will process the programming language in binary form and
output the result in the same form. Programming languages will help us translate from binary
code to an output that we humans can understand. A programming language is made up of
lots of statements, loops, functions, strings, arrays, external libraries and symbols that act as
connectors that allow humans to translate our thoughts into instructions that the computer can
understand. (Team, 2021)
Figure 1- Programming Language
The year 1946 when the first computer ENIAC (Electronic Numerical Integrator and Computer)
was also a big turning point in the history of human development. Soon after, a series of
programming languages were born. Up to now, when people are entering the era of computers, of
the 4.0 era with technology being a great driving force to boost the economy. Programming
languages. Concepts like blockchain bigdata or artificial intelligence were also born to serve that
purpose. To meet those needs, programming languages must increasingly be easier to understand so
that programmers can use them fluently, but also need to meet the complex requirements of the
digital economy.
Document Page
4
The first question most programmers ask is: “What language should we learn first”. But as I
mentioned above, a programming language is just a tool to help people and computers understand
each other better. Up to now, there are more than 700 different programming languages. It can be
mentioned as C, Java, Python, Ruby, C#,...
Figure 3- Programming Languages Ranking (Source: www.tiobe.com)
Each language has its own strengths and weaknesses. Programming languages are used depending
on the needs of society. For example, in an era where machines are gradually replacing humans like
now, concise and easy-to-understand languages like Python are used a lot because of this language,
the rising trend of Machine Learning becomes a booming development. Even big companies like
Google or Facebook are creating chatbots and virtual assistants to replace humans.
Figure 2-ENIAC
Document Page
5
1.2 Procedural Programing
1.2.1 What is procedural programming and why is it so important?
Procedural Programming (POP) is the first basic programming paradigm a new programmer will
learn. Essentially, procedural programming is code that directly instructs a device how to complete
a task in sequential order. Flowchart of the program's control flow organization. Procedural
programming divides the program into functions if the program is too large. A function is simply a
subroutine containing a series of steps to be performed. In a nutshell, Procedural Programming is
writing a list of instructions for the computer to understand what it must do to complete the task
required by the programmer. (Bhatia, 2021)
Figure 5- Example of Procedural Programming
Figure 4 - Code Python
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
6
1.2.2 Characteristics of procedural programming language
Procedural or Procedure Oriented Programming (POP):
As the name implies, Procedure Oriented Programming contains step by step procedure to execute.
Here, the problems get decomposed into small parts and then to solve each part one or more
functions are used. Thus in POP approach, the problem is viewed as a sequence of things to be
done, such as, input taking, calculating and displaying. The primary focus stays on functions which
will be used to accomplish each task.
Main Characteristics of POP:
Following are the found main characteristics of POP,
1. Puts much importance on Things to be Done.
2. Large problems are divided into smaller programs known as functions.
3. Most of the functions share global data.
4. Data move openly around the system from function to function.
5. Functions transfer data from one form to another.
6. Employs top-down approach in program designing.
7. In the cases of large program, bringing change is difficult and time consuming.
8. Appropriate and effective techniques are unavailable to secure data of a function from others.
1.2.3 Key features of procedural programming
a) Predefined functions
Predefined functions are methods that are already defined in the library of the program you are
using. However, you can only use statements once you have declared the library. For example, in C
language. When you want to print the text "Hello world" to the screen, you need to declare the
library “include<stdio.h>”.(Anon.,2014) The sample code would look like this:
b) Local Variable
A local variable is a variable declared in the main structure of a method and limited to the
local scope to which it is provided. A local variable can only be used within the method in
which it is defined, and if it is used outside of the defined method, the code will stop working.
(Bhatia, 2021)
c) Global Variable
Figure 6- Hello Word in C language
Document Page
7
A global variable is a variable that is declared outside of any other function defined in the code.
Therefore, global variables can be used in all functions, unlike local variables. (Bhatia, 2021)
Figure 7- Global Variable and Local Variable
d) Programming libraries
In procedural programming, program libraries contain a set of pre-built syntax and
subroutines that the user can freely use the functions in the library. declared by the user.
(Wiggins, 2017) For example:
#include <stdio.h>: The basic library of every program in C
#include <ctype.h>: Library used to check the characters in the student's name
#include <string.h>: Library used to use string statements in C such as measuring string
length, copy string,...
#include <stdlib.h>: Library to avoid warnings for exit() statements
#include<string.h>: Library to use Boolean function
Figure 8- Another Libraries
Chapter 2: Analysis (P2)
Scenario: A math teacher wants to manage grades of a class. He asks you to help him to write a
small application to do that. He needs to enter student IDs, student’s grades and store these
information into 2 separate arrays (integer array for IDs and float array for grades). Then he needs
Document Page
8
to print all student IDs together with their grades. Finally, he needs to know which student has
highest grade and lowest grade. Your program should be menu based with the options above.
When an option is done, the program should go back to the main menu so he can choose another
option. There should be an option to quit program.
First, we need to generalize the requirements of the scenario as follows:
1. Enter student ID, student grades and store these in 2 separate arrays.
2. Print all student IDs along with their grades.
3. Know which student has the highest score and the lowest score.
4. There needs to be an option menu of the above features and need to return to the
menu when an option is made.
5. There should be an option to exit the program.
2.1 Variables and data types
2.1.1 Variables
Variables are used to store information that is referenced and manipulated in computer programs.
It also provides a way to label data with descriptive names so that readers and ourselves can
understand the) program more clearly. It is convenient to think of variables as containers that hold
information. Its sole purpose is to store labels in data in memory. This data is available throughout
the program.
Source: (Launch school, 2021)
Name Size
(byte)
Description
Char 1 Store single character information
Int 4 Stores numeric data
Float 4 Stores values containing decimal places (precision
of
up to 6 digits)
Double 8 Stores values containing decimal places (precision
of
up to 10 digits)
Void This is used to indicate the compiler that there is
nothing to expect
2.1.2 Data types
The data type of a value (or variable in some context) is an attribute that indicates the type of data a
value can have. In most cases, the term is used in programming languages such as C/C++, Java and C#
in connection with static typing of variables, where variable types are notified at compile time. Data
types include storage classifications such as integers, floating point values, strings, and characters etc.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
9
A data type defines certain characteristics of data used in a software program and tells the compiler
about predefined properties required for a particular variable or related data object. (Techopedia, 2021)
Figure 9 - : Data types in C language (Mishra, 2021)
Names Data Types Description
IDs Int ID of student
Grades Float The grades of student
N Int The maximum students input in
program
Current Int The number of student current
Choices Int Reporting options that users choose
Max Float The highest grades of student
Min Float The lowest grades of student
The following table shows data about these variables, which I will use this program, including their
names, data types and its description.
Document Page
10
Figure 10 - Variables and Data types in this program
2.2 Conditional statements and loop statement needed in the problem
2.2.1. If” statement function
- Let us make the decisions in the programs. Allows programs to check for certain conditions and
make decisions about which blocks of code to run
- In this program, “if” statement is used for finding the highest or the lowest grades in memory that
user input.
Figure 11 - Example for using "if" statement function
2.2.2 “If – Else” statement function
- In this function, the program will check the condition inside “if” first, if that’s true, statements
inside “if” are executed and statements inside “else” are skipped. However, if the first condition
is false, the first statement is skipped and statements in the body of “else” are executed.
Document shared on www.docsity.com
Downloaded by: gac-mai (domcute270401@gmail.com)
chevron_up_icon
1 out of 25
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]