0% found this document useful (0 votes)
74 views18 pages

Assignment 1

The document provides an assignment brief for a procedural programming problem. The student is asked to design a program to manage student grades for a math teacher. The tasks include: (1) providing an introduction to procedural programming; (2) analyzing the problem by identifying variables, data types, selection structures, and functions; and (3) designing the program using diagrams. The student must submit a report in PDF format covering the three tasks and their solution to the assignment.

Uploaded by

Duy Trung
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views18 pages

Assignment 1

The document provides an assignment brief for a procedural programming problem. The student is asked to design a program to manage student grades for a math teacher. The tasks include: (1) providing an introduction to procedural programming; (2) analyzing the problem by identifying variables, data types, selection structures, and functions; and (3) designing the program using diagrams. The student must submit a report in PDF format covering the three tasks and their solution to the assignment.

Uploaded by

Duy Trung
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Assignment 1 : Analysis and Design a

solution for procedural programming

problem

Student’s name : Bui Duy Trung


Id : GCS210515
Class : GCS1003B
Instructor : Le Ngoc Thanh

1
ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title Prog102: Procedural Programming

Submission date 23/2/2022 Date Received 1st submission 25/2/2022

Re-submission Date 26/2/2022 Date Received 2nd submission

Student Name Bui Duy Trung Student ID GCS210515

Class GCS1003B Assessor name Le Ngoc Thanh

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 trung

Grading grid
P1 P2 P3 M1 M2 D1

2
 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date:


Lecturer Signature:

3
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
Assignment Title Analysis and Design a solution for procedural programming problem
Issue Date
Submission Date
IV Name & Date

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 M1 Discuss on D1 Critically evaluate


to procedural characteristics and the design of your
programming features of procedural solution against the
programming characteristics and
features of procedural
P2 Identify the program M2 Review the design of a programming.
units and data and file procedural programming
structures required to solution.
implement a given design

P3. Design a procedural


programming solution for
a given problem

4
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 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.

5
Catalog
Assignment 1 : Analysis and Design a solution for procedural programming problem................... 1
ASSIGNMENT 1 FRONT SHEET........................................................................................................ 2
Assignment Brief 1 (RQF).......................................................................................................................4
P1 , M1...................................................................................................................................................... 7
1 Introduction :.........................................................................................................................................7
1.1 What is procedural programming ? ( P1 )....................................................................................7
1.2 Key Features of Procedural Programming ( M1 )........................................................................7
1.3 Application...................................................................................................................................7
2 Analyse :.................................................................................................................................................8
2.1 Data types.....................................................................................................................................8
2.2 Local variables and global :......................................................................................................... 8
2.4 Statements.................................................................................................................................... 8
P3, M2..................................................................................................................................................... 11
3 Design................................................................................................................................................... 11
3.1 What’s WBS.............................................................................................................................. 11
3.2 What’s flowchart ?..................................................................................................................... 12
D1.............................................................................................................................................................17
4 Evaluation............................................................................................................................................ 17
4.1 Overview my solution :..............................................................................................................17
4.2 Advantages and disadvantages :................................................................................................ 17
5 References............................................................................................................................................ 17

6
P1 , M1

1 Introduction :

1.1 What is procedural programming ? ( P1 )


According to Wikipedia, procedural programming is possibly the first programming paradigm a new
developer will learn. Essentially, procedural code is code that directly instructs a device how to
complete a task in logical steps. This model uses a top-down linear approach and treats data and
procedures as two different entities. Based on the concept of a procedure call, Procedural
Programming divides the program into procedures, also known as routines or functions, which simply
contain a series of steps to be performed.

Simply put, Procedural Programming involves writing down a list of instructions to tell the computer
what to do step by step to complete the task at hand.

1.2 Key Features of Procedural Programming ( M1 )


- Procedural programming follows a top-down approach.
- The program is divided into blocks of codes called functions, where each function performs a specific
task.
- Procedural programs model real-world processes as 'procedures' operating on 'data'.
- The data and functions are detached from each other.
- The data moves freely in a program.
- It is easy to follow the logic of a program.
- A function can access other function's data by calling that function.

1.3 Application
- Procedural programming languages break up the programming task into a number of procedures
(also sub-routines or functions). Each procedure carries out a specific task and is called from the main
program. The procedural approach is relatively easy to understand and is therefore often used when
first learning programming. It is also suitable for systems that are fairly straightforward and don’t
involve many different interacting sub-systems.
- Procedural programming is specific to calculating scientific and engineering uses. It is used for
calculations. It consists of a fluid movement throughout the program as it runs.
This is great for straightforward systems which don’t involve many different interacting sub-systems.

* Based on the scenario given above, the reason why procedural programming can be applied is :
- The above problem needs to use declared variables to work logically, step by step in a predefined
sequence, such as declaring, updating scores, having the option of scanning out students with highest
or lowest scores number. That makes procedural programming one of the best iterative style choices
over other programming styles like object-oriented programming and more.

7
P2
2 Analyse :
2.1 Data types

C divides the data into different groups which is the data type.

2.2 Local variables and global :


.A local variable is declared inside a function. A local variable is visible only inside their function, only
statements inside a function can access that local variable.
.Global variables are declared outside of any function. A global variable is visible to every function and
can be used by any piece of code. Unlike local variables, global variables retain their values between
function calls and throughout the program execution.
2.3 Types of data that’s needed in the problem in the scenario are :
Int : for storing Student’s ID. Instead of using other data for this solution, integer is the best option
because I just want to be familiar with best practices and standard coding conventions.
Char : for storing Student’s Name.
Float or Double : for storing Student’s Grade. Using this data for storing grades because float or
double for the exactly decimal number of the grade
And I will be using ARRAY for storing multiple values in a single variable such as the id, the name and
the grades of the students.
2.4 Statements
- Alternatively known as a conditional expression, conditional flow statement, and conditional
processing, a conditional statement is a set of rules performed if a certain condition is met. It is
sometimes referred to as an If-Then statement, because IF a condition is met, THEN an action is
performed.
The required construction for the solution :
- If-else structures means conditional for statements, expression and constructs. Specifically,
conditionals perform different computations or actions depending on whether a programmer-defined
condition evaluates to true or false. If-else Structures use to test in certain condition and make
decision about which code block need to be executed. If-else Structures to find the student have
lowest grade the same with student have highest grade with the condition is : the student in the
current loop have grade lower than the grade of student in the previous loop, then returns the
student with the lower grade in current loop.

8
- Switch-case statement, switch statements function somewhat similarly to the if statement, exists in
most high-level imperative programming languages.

- Switch-case structures use to design a menu options for user to help them determined what
function in program they want to use. The switch case is used when we have multiple options and we
want to compared the input value with all the cases inside the switch..case block to execute different
options.
- The for statement lets you repeat a statement or compound statement a specified number of times.
The body of a for statement is executed zero or more times until an optional condition becomes false.
You can use optional expressions within the for statement to initialize and change values during
the for statement's execution. For helps us to display all student user add and find the students with
the highest and lowest scores. The initialization statement is executed three times.
- A while loop in C programming repeatedly executes a target statement as long as a given condition
is true.
Here, statements may be a single statement or a block of statements. The condition may be any
expression, and true is any nonzero value. The loop iterates while the condition is true.
When the condition becomes false, the program control passes to the line immediately following the
loop.

9
- A while loop in C programming repeatedly executes a target statement as long as a given condition is
true.
Here, statements may be a single statement or a block of statements. The condition may be any
expression, and true is any nonzero value. The loop iterates while the condition is true.
When the condition becomes false, the program control passes to the line immediately following the
loop.

- Unlike for and while loops, which test the loop condition at the top of the loop, the do-while loop in
C programming checks its condition at the bottom of the loop.

10
P3, M2

3 Design
3.1 What’s WBS
- Arcording to Wikipedia, “Use Case Diagram is a representation of a user's interaction with the
system that show the relationship between the use and the different use cases in which the user is
involved” (Anon.).

- The benefits of creating a WBS include: it defines and organizes the work required. it facilitates the
quick development of a schedule by allocating effort estimates to specific sections of the WBS. it can
be used to identify potential scope risks if it has a branch that is not well defined.

11
3.2 What’s flowchart ?

- A flowchart is a diagram that depicts a process, system or computer algorithm. They are widely used
in multiple fields to document, study, plan, improve and communicate often complex processes in
clear, easy-to-understand diagrams.

3.2.1 Organizational chart

- A diagram that shows the structure of an organization and the relationships and relative ranks of its
parts and positions/jobs. The term is also used for similar diagrams, for example ones showing the
different elements of a field of knowledge or a group of languages

- The diagram above take the work of breaking down the pieces of work that the program needs to do
in an easy to understand, logical way by WBS

12
3.2.2 Flowchart the menu application :

- As I said above about using the switch-case statement to design the selection menu for the program
because in this case, the switch-case statement becomes very convenient in dividing the work into
many pieces. section, many choices (cases) for the program to work

3.2.3 Input student’s id, name and grades

13
- Flowchart above illustrate step-by-step how to input variables in to arrays using loop. First, we start
a loop that brings the input statement into the previously created information arrays until the
number of times the loop is equal to the number of students we need to enter the information.

3.2.4 Find the student with lowest grade :

- I give the first value in the array equals min, start the loop with conditional statement to find the
smaller value in the array, the loop will be stopped when the minimum value is found and print it

14
3.2.5 Find the student with highest grades :

- The same to the way to find the student with lowest grades, but with a little bit different with the
condition of the loop, find the greater value in the array then print it out ( Display on the screen ).

3.2.6 Display the list of student :

15
- I start a loop with a conditional statement that outputs the values in the arrays one by one until the
number of iterations equals the number of students.

16
D1
4 Evaluation
4.1 Overview my solution :

- Looking at the design direction, the way to solve the problem transmitted through the above
diagram is relatively acceptable, it is not perfect because in my opinion during the programming
phase there can be a lot of confusing problems. But my approach succeeds in solving the problem
relatively stable

4.2 Advantages and Disadvantages :

- Procedural programming helps me to solve the problem relatively easily because it possesses basic
features such as the operation of the program in a top-down sequence, which makes it easy and
convenient to control the source of information. benefits in breaking down program parts into
functions to solve problems
- My program still missing a lot of things, it will be very inconvenient if this program is used for a class
with too many students, making the declaration take a lot of time. Your program can still be upgraded
such as creating accounts, passwords for users, storing personal information, notifications of each
account

5 References

En.wikipedia.org. 2022. Procedural programming - Wikipedia. [online]


Available at: https://en.wikipedia.org/wiki/Procedural_programming
[Accessed 20 February 2022]

KnowledgeBoat. 2022. What are the characteristics of procedural programming?|KnowledgeBoat.


[online]
Available at: https://www.knowledgeboat.com/question/what-are-the-characteristics-of-
procedural-programming--28311496451138200
[Accessed 20 February 2022]

Tutorialspoint.com. 2022. C - Data Types. [online]


Available at: https://www.tutorialspoint.com/cprogramming/c_data_types.htm
[Accessed 20 February 2022]

Docs.microsoft.com. 2022. Overview of C Statements. [online]


Available at: https://docs.microsoft.com/en-us/cpp/c-language/overview-of-c-
statements?view=msvc-
170#:~:text=C%20statements%20consist%20of%20tokens,is%20discussed%20in%20this%20section.
[Accessed 20 February 2022].

Programiz.com. 2022. C for Loop (With Examples). [online]


Available at: https://www.programiz.com/c-programming/c-for-loop
[Accessed 20 February 2022].

En.wikipedia.org. 2022. Work breakdown structure - Wikipedia. [online]

17
Available at: https://en.wikipedia.org/wiki/Work_breakdown_structure
[Accessed 20 February 2022].

En.wikipedia.org. 2022. Flowchart - Wikipedia. [online]


Available at: https://en.wikipedia.org/wiki/Flowchart
[Accessed 20 February 2022].

Cuemath. 2022. Conditional Statement - Cuemath. [online]


Available at: https://www.cuemath.com/data/conditional-statement/
[Accessed 20 February 2022].

Career Karma. 2022. What is Procedural Programming, and When Should You Use It?. [online]
Available at: https://careerkarma.com/blog/procedural-
programming/#:~:text=When%20you%20use%20a%20procedural,from%20a%20top%2Ddown%20vie
w.
[Accessed 20 February 2022].

Programiz.com. 2022. C while and do...while Loop. [online]


Available at: https://www.programiz.com/c-programming/c-do-while-loops
[Accessed 20 February 2022].

18

You might also like