Professional Documents
Culture Documents
Learner’s name:
ID:
Class:
Subject code:
Assessor name:
Unit number and title Unit 0: Analysis and Design a solution for procedural programming problem
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
Grading grid
P1 P2 P3 M1 M2 D1
❒ Summative Feedback: ❒ Resubmission Feedback:
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.
Table of Contents
P2 Identify the program units and data and file structures required to implement a
given design
Reference...................................................................................................................18
STUDENT’S ANSWERS
A computer is a device can meet the needs of users through processing the data which is input
by us. However, the computer can not understand languages of human so computer
programming languagues are an important thing to connect the computer and users. There are
2 types of computer languages are low level languages and high level languages. The low
language or machine language are not nearly the human languages so it is hard to understand
clearly like Pascal,C,etc. On the other hand, high level languages are easy to comprehend and
present in many different computer languages. Like human has a lot of languages to
communicate with each other, likewise, the computer have many applications to communicate
with human like PHP,C#,Java,etc. Neither of which languages are the most useful and optimal
so each language has each own adventages and disadventages. For example, C# is a easy
language to study and use, it is fully supported by Window and IDE Visual Studio. However, it
only achieve the best effect on Window and users need to pay for IDE. Different from C#, PHP
can be used on a lot of operating systems like Linux and IIS-Window, with high processing
speed and high security so it is more popular than ASP but source code is not completed and it
only can be used on website.
Procedural Programming is a procession of input, handle and output the information which is
written by computer programmers. The method of developing programming is called an
application which keeps the code as consise as possible then performs the information which
programmers want.The procedural programming includes a series of computational steps to
be carried out by the application like Pascal, C, FORTAN, BASIC. This programming focuses on
processes, data and functions which are input and handled will be stored in same location. To
Page |1
complete a program, the programmers will code directly and test separately then gathered to
a form.
P2 Identify the program units and data and file structures required to
implement a given design
2.1 if-else
Page |2
"if" structure is single selection structure; it selects or ignores a single action; if the condition is
true, the statement is executed; if the condition is false, the statement is skipped (indention is
optional but improves readability of program)
if (condition)
statement;
if (condition)
statement1;
else
statement2;
Page |3
switch (selection statement)
The switch statement allow us to select one from multiple options. It is especially useful when
we want to write a code that makes a selection based on an expression or a
variable. switch selection structure consists of a series of case labels and optional default case.
Page |4
while LOOP
while loop allows the repetition of a set of statements execution to continue for as long as a
specified expression (condition) is true. When the condition becomes false, the repetition
terminates and the first statement after the repetition structure is executed. Basically while
loop is similar to if selection in the sense that their set of statements are executed if the
condition is true. The different is while loop repeats the statement execution as long as the
condition is true and if selection does not have the repetition feature.
do while Loop
The do while loop is similar to the while loop. In the while loop, the loop condition is tested at
the beginning of the loop. The do while loop tests the loop condition at the end of the loop
structure or after the body of the loop is executed. Thus in do while loop, the compounded
statement will be executed at least once.
Page |5
for Loop Statement
Unlike while and do while statement, for statement handles all the details such as variable
initialisation, variable update and loop condition within single parantheses.
The statements to control the loop operation are separated. In the for statement, these
statements are combined together.
for statement structure has three (3) fields which are variable initialisation, loop condition and
variable update. These fields in the for statement are optional. we may omit variable
initialisation and place it elsewhere in the program for example before for statement. If loop
condition is omitted, C will assume that the condition is true thus resulting an indefinite loop.
Variable update may be ommited if we want to place it in the body of for statement.
The operation of the loop is controlled by the three expression between the for statement
parantheses.
Page |6
2.2 External modules/functions required (stdio.h, string.h,etc., scanf,
printf, etc.)
These will typically include the low level functionality being implemented and the MicroPython
binding functions to expose the functions and module(s).
Input means to provide the program with some data to be used in the program
and Output means to display data on screen or write the data to a printer or a file.
C programming language provides many built-in functions to read any given input and to
display data on screen when there is a need to output the result.
In this tutorial, we will learn about such functions, which can be used in our program to take
input from user and to output the result on screen.
Page |7
All these built-in functions are present in C header files, we will also specify the name of header
files in which a particular function is defined while discussing about it.
scanf() and printf() functions
When you will compile the above code, it will ask you to enter a value. When you will enter the
value, it will display the value you have entered on screen.
Ex:
#include <stdio.h>
int main()
{
int n;
printf("Input an integer\n");
scanf("%d", &n);
if (n%2 == 0)
printf("It is an even number\n");
else
printf("It is an odd number\n");
return 0;
}
Page |8
P3.
Page |9
3.2 Flowchart(s) for the program design
P a g e | 10
- Print all student information
P a g e | 11
- Print highest grade
P a g e | 12
- Print lowest grade
P a g e | 13
- Exit the program
P a g e | 14
3.3 Provide pseudo code listing(s) for this program
char option;
Display Menu:
0. Exit
End
Begin
Input number_student;
Begin
input ID,grade;
End
End
Begin
Input number_student;
input ID,grade;
End
End
Begin
i=1;
highest_grade =array[0];
while (i<numberOfGrade)
Begin
if(highest_grade< array[i])
Begin
highest_grade = array[i]
End
End
Display highest_grade;
End
Begin
i=1;
P a g e | 17
lowest =array[0];
while (i<numberOfGrade)
Begin
if(lowest> array[i])
Begin
lowest = array[i]
End
End
Display highest_grade;
End
REFERENCES
P a g e | 18
procedural3.blogspot.com (2014). Key features of procedural programming. [online] Available
at: http://procedural3.blogspot.com/2014/11/key-features-of-procedural-programming.html
[ Accessed 17 Oct. 2020]
sciencehq.com (2013). Procedural oriented programming. [online] Available at:
https://www.sciencehq.com/computing-technology/procedural-oriented-programming.html
[ Accessed 17 Oct. 2020]
myassignmenthelp.info (2014). Procedural programming Assignment. [online] Available at:
http://myassignmenthelp.info/assignments/procedural-programming-assignment-115664/
[ Accessed 17 Oct. 2020]
locusassignments.com (2016). Procedural programming Assignment Sample. [online] Available
at: https://www.locusassignments.com/solution/unit-18-procedural-programming-assignment-
sample[ Accessed 17 Oct. 2020]
P a g e | 19