PROG102 GCS210085 LeThaiTrungTin Assignment 1 Full (AutoRecovered)

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

Higher Nationals in Computing

Unit 0: Procedural Programming


ASSIGNMENT 1

Learner’s name: Lê Thái Trung Tín


ID: GCS210085
Class: GCS1005A
Subject code: PROG102
Assessor name: PHAN MINH TAM

Assignment due: Assignment submitted:


ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title Unit 0: IT Fundamental & Procedural Programming

Submission date Date Received 1st submission

Re-submission Date Date Received 2nd submission

Student Name Lê Thái Trung Tín Student ID GCS210085

Class GCS1005A Assessor name Phan Minh Tam

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:

Grade: Assessor Signature: Date:


Signature & Date:
ASSIGNMENT 1 BRIEF

Unit Number and Title Unit 0: IT Fundamental & Procedural Programming


Academic Year 2022
Unit Tutor
Assignment Title Assignment 1: 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 to M1 Discuss on characteristics D1 Critically evaluate the design of


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

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

Unit 0: Procedural Programming ASSIGNMENT 1 ...................................................................................... 1


• Identify the variables and data types required in the program. .................................................................. 4
• 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. ............................................................ 4
• Identify and describe any iteration constructs. ............................................................................................ 4
• Split the program into functions (sub-functions) and draw a hierarchy diagram to illustrate the structure
of your program. ................................................................................................................................................... 4
• A use case diagram for actions required ...................................................................................................... 4
• Flow chart diagrams for: menu operation, printing IDs and grades, finding max grade and finding min
grade. .................................................................................................................................................................... 4
• Review / evaluate your design, state clearly pros vs cons and which needs to improve, using
characteristics of procedural programming as bases to discuss. ......................................................................... 4
P1 Provide an introduction to procedural programming .......................................................................... 1
Introduction to computer programming languages .................................................................................. 1
1.1 Definition A programming language is a formal language consisting of a set of instructions that
produce various types of output. Programming languages are used in computer programming to implement
algorithms. Most programming languages include commands for computers. .................................................. 1
1.2 High level programming A high leve language is a programming language that is meant to make
computer programming easier. The term ”high level” refers to the separation of the numerous processor
operations from the actual application. ............................................................................................................... 1
.............................................................................................................................................................................. 1
1.3 Low level programming ................................................................................................................................. 1
A low-level programming language is a programming language that provides little or no abstraction from a
computer's instruction set architecture—commands or functions in the language map that are structurally
similar to processor's instructions. Generally, this refers to either machine code or assembly language. ......... 1
.............................................................................................................................................................................. 1
2 Introduction to procedural program ....................................................................................................... 1
2.1. Definition ....................................................................................................................................................... 1
Procedural Programming can be defined as a programming model which is derived from structured
programming, based upon the concept of calling procedure. Procedures, also known as routines, subroutines
or functions, simply consist of a series of computational steps to be carried out. .............................................. 1
.............................................................................................................................................................................. 2
2.2. Introduction to C Programming Language ................................................................................................... 2
3. Criteria to select a programming language to use ................................................................................. 2
Factors to Consider ............................................................................................................................................... 2
The Elasticity of a Language ................................................................................................................................ 3
The Time to Production ........................................................................................................................................ 4
Performance ......................................................................................................................................................... 4
Support and Community ...................................................................................................................................... 4
Other Factors to Consider .................................................................................................................................... 4
Purpose ................................................................................................................................................................. 4
Programmer Experience....................................................................................................................................... 5
Ease of Development and Maintenance ............................................................................................................. 5
Efficiency............................................................................................................................................................... 5
Availability of an IDE ............................................................................................................................................ 5
Error Checking and Diagnosis ..................................................................................................................... 5
The Takeaway ............................................................................................................................................. 6
P2. Identify the program units and data and file structures required to implement a given design ........ 6
1. Variables ................................................................................................................................................. 6
1.1. Definition: ............................................................................................................................................ 6
1.2. Rules for naming a variable ................................................................................................................. 6
• A variable name can only have letters (both uppercase and lowercase letters), digits and underscore.
The first letter of a variable should be either a letter or an underscore. ............................................................. 6
• There is no rule on how long a variable name (identifier) can be. However, you may run into problems in
some compilers if the variable name is longer than 31 characters. ..................................................................... 6
• //{Note: You should always try to give meaningful names to variables. For example: firstName is a
better variable name than fn. }; ........................................................................................................................... 6
• Examples: ...................................................................................................................................................... 6
//{C is a strongly typed language. This means that the variable type cannot be changed once it is declared. For
example: ............................................................................................................................................................... 6

Here, the type of number variable is int. You cannot assign a floating-point (decimal) value 5.5 to this
variable. Also, you cannot redefine the data type of the variable to double. By the way, to store the decimal
values in C, you need to declare its type to either double or float.}; .................................................................. 7
2. Datatypes ............................................................................................................................................... 7
2.1. Definition ............................................................................................................................................. 7
• C data types are defined as the data storage format that a variable can store a data to perform a specific
operation. ............................................................................................................................................................. 7
• C divides the data into different groups which is the data type................................................................... 7
2.2. Types of data types in C ...................................................................................................................... 8
Int : for storing Student’s ID. Instead of using other data for this solution, integer is the best option ............... 8
because I just want to be familiar with best practices and standard coding conventions................................... 8
Char : for storing Student’s Name. ....................................................................................................................... 8
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............................................................................................................. 8
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. ......................................................................................................................................... 8
3. Selection structures (Conditional Statements) ............................................................................................... 8
- Alternatively known as a conditional expression, conditional flow statement, and conditional ...................... 8
processing, a conditional statement is a set of rules performed if a certain condition is met. It is..................... 8
sometimes referred to as an If-Then statement, because IF a condition is met, THEN an action is .................... 8
performed. ............................................................................................................................................................ 8
3.1. If statement ......................................................................................................................................... 8
The IF statement is a decision-making statement that guides a program to make decisions based on
specified criteria. The IF statement executes one set of code if a specified condition is met (TRUE) or another
set of code evaluates to FALSE. ............................................................................................................................ 8
3.1.1. Syntax ......................................................................................................................................................... 8
Syntax.................................................................................................................................................................... 8
if (Condition) ......................................................................................................................................................... 8
{ ............................................................................................................................................................................. 8
…............................................................................................................................................................................ 8
block of statements; … ......................................................................................................................................... 8
} ............................................................................................................................................................................. 8
Excution flow diagram .......................................................................................................................................... 8
3.2. If .. else ................................................................................................................................................ 9
3.3 If...else if ............................................................................................................................................. 10
3.4 Switch...case ....................................................................................................................................... 11
4.Iteration structures ............................................................................................................................... 12
4.1 For statement ..................................................................................................................................... 12
4.2 While statement ................................................................................................................................. 13
4.3 Prosedure code .................................................................................................................................. 15
P3. Design a procedural programming solution for a given problem 5 Design ....................................... 17
5.1 What’s WBS .................................................................................................................................................. 17
.................................................................................................................................................................. 17
5.2 What’s flowchart ? ....................................................................................................................................... 17
5.2.1 Organizational chart.................................................................................................................................. 17
5.2.2 Flowchart the menu application : ............................................................................................................ 18
5.2.3 Input student’s id, name and grades ........................................................................................................ 19
5.2.4 Find the student with lowest grade : ....................................................................................................... 19
5.2.5 Find the student with highest grades : ..................................................................................................... 20
5.2.6 Display the list of student : ....................................................................................................................... 20
REFERENCES ............................................................................................................................................. 21
ASSIGNMENT 1 ANSWERS
P1 Provide an introduction to procedural programming
Introduction to computer programming languages
1.1 Definition
A programming language is a formal language consisting of a set of instructions that
produce various types of output. Programming languages are used in computer
programming to implement algorithms. Most programming languages include commands
for computers.
1.2 High level programming
A high leve language is a programming language that is meant to make computer
programming easier.
The term ”high level” refers to the separation of the numerous processor operations from
the actual application.

1.3 Low level programming


A low-level programming language is a programming language that provides little or no
abstraction from a computer's instruction set architecture—commands or functions in the
language map that are structurally similar to processor's instructions. Generally, this refers
to either machine code or assembly language.

2 Introduction to procedural program


2.1. Definition
Procedural Programming can be defined as a programming model which is derived from
structured programming, based upon the concept of calling procedure. Procedures, also
known as routines, subroutines or functions, simply consist of a series of computational steps
Page |1
to be carried out.

2.2. Introduction to C Programming Language


C is a high-level, general-purpose programming language that's perfect for creating firmware
and portable apps. Dennis Ritchie created C for the Unix Operating System in the early 1970s
at Bell Labs, with the intention of creating system software.
3. Criteria to select a programming language to use
Factors to Consider

There are several factors to consider when choosing a web programming language. Say, for example,
in developing a dynamic web page, one might consider Java Server Pages (JSP) as the best option,
while another might consider using PHP or a similar scripting language.

No single language is the best choice for any given project. Although preference might be given to
certain factors like performance, security in enterprise applications, fewer lines of code among other
factors.

For personal projects, the selection of a programming language may be as simple as picking a personal
favorite. Here the brevity of the lines of code is important. The fewer the lines necessary to develop
the project, the better. The idea is to get the solution out first, then worry about the neatness or
performance later.

However, for large organizational projects, things are different. Different developer teams are going to
build components that are meant to interact and interconnect with each other to solve a particular
problem. In this case, the choice of language might involve the ease of portability of the program to
different platforms or the availability of resources.

Page |2
The right selection of a programming language yields solutions that are concise, easy to debug, easy to
extend, easy to document, and easy to fix.

The following are the factors to be considered:

> The targeted platform

> The elasticity of a language

> The time to production

> The performance

> The support and community.

The Targeted Platform

It is very important to consider the platform on which the program will run. Say you have two
languages, Java and C. If a program is written in C and needs to be run on Windows and Linux
platforms, it would require platform compilers and two different executables. On the other hand, with
Java development, the program can run on any machine provided a Java Virtual Machine (JVM) is
installed.

The same goes for web pages. They should all look and work the same across all browsers. However,
using CSS3 tags and HTML 5 without checking browser compatibility will cause the site to look and
behave differently across different browsers.

The Elasticity of a Language

This is the ease with which new features can be added to an existing program. It can involve the
addition of a new set of functions or the use of an existing library to add a new feature. Some of the
questions to be considered are:

Can one use a capability of the language without the inclusion of a new library?

If not, is the capability available in the language library?

If the capability is neither native nor available as a library, what is the effort to build the features from
scratch?

It is important to know the program design and the features set aside for future improvement before
Page |3
making a decision to adopt the considered language(s).

The Time to Production

This is the time taken to make the program go live, when the code is production-ready and works as
intended. It is highly dependent on the size of code. In theory, the easier it is to learn a language, the
smaller the code and thus less time taken to go live.

Take for example, in development of a content management website, it is possible to take days using
PHP development scripts while the use of servlets code can take months. This is going by the
assumption that you are learning both languages from scratch.

Performance

Only so much of performance can be squeezed out of a program and a platform, with the
programming language used in the program development affecting performance. Numerous studies
have been conducted comparing how fast programming languages are in the same environment. This
has led to the development of various benchmarks which can be used as a reference. The figures
however are not for concrete assessment of the performance of any language.

Language performance should matter when the target environment doesn’t offer much scope for
scaling. A good example of such an environment are handheld devices.

Support and Community

Programming languages and good software are similar in that they both need a community following
to help them grow. Languages with active forums are likely to be more popular than even greater
languages without similar forums. Some of the offerings of community support include wikis, forums,
tutorials and most importantly additional libraries, all of which help the language to grow.

Other Factors to Consider

Purpose

What is the objective of the programming language? It specifies the objective for which a program is
being developed. In the event that one needs to develop commercial applications, then a business
oriented programming language like COBOL is the best candidate. For development of scientific
applications, it is best to use a scientific oriented language like FORTRAN.

Page |4
Similarly, if one is interested in developing programs related to Artificial Intelligence, then he or she
should be comfortable using the LISP or ProLog languages. Object oriented languages are best suited
for development of web-based applications. As for the development of system programs, a middle
level language like C should be chosen.

Programmer Experience

Where more than one programming language is available for the development of the same program, a
programmer should choose the language he is more conversant with. Generally, one should go for the
language for which he is more experienced.

Ease of Development and Maintenance

Programmers develop programs using the language they are most comfortable in. Generally, there is a
preference for object-oriented languages over the procedural oriented languages. The reason for this
is that, code developed in object-oriented languages can be reused and maintained with great ease.

Efficiency

Efficiency is an important factor which need be considered before choosing a programming language
for software development. One should consider the language in which the programs can be developed
and executed rapidly. Additionally, the language which requires less amount of memory for the
storage of programs should be selected.

Availability of an IDE

A powerful Integrated Development Environment goes a long way in increasing the productivity of a
programmer. The language with an IDE of well supported development, debugging and compilation
tools should be selected.

Error Checking and Diagnosis

These factors involve finding the errors in a program and their causes. Programmers should choose
programming languages which contain efficient error handling features. Error checking and diagnosis
is very important and crucial in the development of quality and error-free programs. The task of code
development and testing is easier when undertaken with a programming language with efficient and
robust error detection and correction mechanisms.

Page |5
A good example is Java. This language provides an efficient error handling mechanism of try/catch
block. This feature in Java programs can be used to handle the unexpected errors that may occur
during the execution of a program.

The Takeaway

As an aspiring developer who’s read the factors here explained, you might wonder where to begin.
The answer largely depends on which direction you intend to take; web development or software
development. Whichever the direction, there are multiple resources online to help you in your coding
journey.

P2. Identify the program units and data and file structures required to implement a given
design
1. Variables
1.1. Definition:
.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 andcan be used by any piece of code. Unlike local variables, global variables
retain their values between function calls and throughout the program execution.
1.2. Rules for naming a variable

• A variable name can only have letters (both uppercase and lowercase letters), digits
and underscore. The first letter of a variable should be either a letter or an underscore.
• There is no rule on how long a variable name (identifier) can be. However, you may run
into problems in some compilers if the variable name is longer than 31 characters.
• //{Note: You should always try to give meaningful names to variables. For
example: firstName is a better variable name than fn. };

• Examples:

//{C is a strongly typed language. This means that the variable type cannot be changed
once it is declared. For example:

• int number = 5; // integer variable

Page |6
• number = 5.5; // error
• double number; // error

Here, the type of number variable is int. You cannot assign a floating-point (decimal)
value 5.5 to this variable. Also, you cannot redefine the data type of the variable
to double. By the way, to store the decimal values in C, you need to declare its type to
either double or float.};

2. Datatypes
2.1. Definition

• C data types are defined as the data storage format that a variable can store a data to
perform a specific operation.
• C divides the data into different groups which is the data type.

Page |7
2.2. Types of data types in C
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.

3. Selection structures (Conditional 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.

3.1. If statement
The IF statement is a decision-making statement that guides a program to make
decisions based on specified criteria. The IF statement executes one set of code if a specified
condition is met (TRUE) or another set of code evaluates to FALSE.
3.1.1. Syntax
Syntax
if (Condition)
{

block of statements;

}
Excution flow diagram
Page |8
3.1.2. Example

3.2. If .. else
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.
3.2.1 Syntax
if (test expression)
{
// code
}
3.2.2 Example
1.#include<stdio.h>
2.int main(){
3.int number=0;
4.printf("enter a number:");
5.scanf("%d",&number);
6.if(number%2==0){
7.printf("%d is even number",number);
8.}
9.else{
10.printf("%d is odd number",number);
Page |9
11.}
12.return 0;
13.}
3.3 If...else if

The if...else statement is used to execute a block of code among two alternatives. However, if
we need to make a choice between more than two alternatives, we use the if...else
if...else statement.The syntax of the if...else if...else statement is:

3.3.1 Syntax
if (condition1) {
// block of code to be executed if condition1 is true
} else if (condition2) {
// block of code to be executed if the condition1 is false and condition2 is true
} else {
// block of code to be executed if the condition1 is false and condition2 is false
}
3.3.2 Example
int time = 22;
if (time < 10) {
printf("Good morning.");
} else if (time < 20) {

P a g e | 10
printf("Good day.");
} else {
printf("Good evening.");
}
// Outputs "Good evening."

3.4 Switch...case
- Switch-case structures use to design a menu options for user to help them determined what
functionin 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.

P a g e | 11
3.4.1 Syntax
switch (expression)
{ case constant1:
// statements
break;
case constant2:
// statements
break;
.
.
.
default:
// default statements
}
3.4.2 Example
4.Iteration structures
The iteration structure executes a sequence of statements repeatedly as long as a
condition holds true. The sequence structure simply executes a sequence of statements in
the order in which they occur.
4.1 For statement
- 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

4.1.1 Syntax

P a g e | 12
for (initial value; condition; incrementation or decrementation )
{
statements;
}

4.1.2 Example
#include<stdio.h>
int main()
{
int number;
for(number=1;number<=10;number++) //for loop to print 1-10 numbers
{
printf("%d\n",number); //to print the number
}
return 0;
}

4.2 While statement


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

- 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

P a g e | 13
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.

4.2.1. Syntax

while (condition) {
statements;
}
4.2.2 Example

P a g e | 14
#include<stdio.h>
#include<conio.h>
int main()
{
int num=1; //initializing the variable
while(num<=10) //while loop with condition
{
printf("%d\n",num);
num++; //incrementing operation
}
return 0;
}

4.3 Prosedure code


Procedure codes are a sub-type of medical classification used to identify specific
surgical, medical, or diagnostic interventions. The structure of the codes will depend on the
classification; for example some use a numerical system, others alphanumeric.
4.3.1 Syntax
/*procedure name.*/
4.3.2 Example
#include <stdio.h>

/*this function computes the absolute value of a whole number.*/


int abs(int x)
{
if (x>=0) return x;
else return -x;
}

/*this program calls the abs() function defined above twice.*/


int main()
{

P a g e | 15
int x, y;

printf("Type the coordinates of a point in 2-plane, say P = (x,y). First x=");


scanf("%d", &x);
printf("Second y=");
scanf("%d", &y);

printf("The distance of the P point to the x-axis is %d. \n Its distance to the y-axis is %d.
\n", abs(y), abs(x));

return 0;
}

P a g e | 16
P3. Design a procedural programming solution for a given problem
5 Design
5.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.

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

P a g e | 17
- 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
5.2.2 Flowchart the menu application :

- As I said above about using the switch-case statement to design the selection menu for the program
P a g e | 18
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
5.2.3 Input student’s id, name and grades

- 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.
5.2.4 Find the student with lowest grade :

P a g e | 19
- 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

5.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 ).

5.2.6 Display the list of student :

P a g e | 20
- 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.

REFERENCES

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


Available at: https://en.wikipedia.org/wiki/Procedural_programming
[Accessed 5 June 2022]

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


[online]

Available at: https://www.knowledgeboat.com/question/what-are-the-characteristics-ofprocedural-


programming- - 28311496451138200
[Accessed 5 June 2022]

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


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

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

P a g e | 21
Available at: https://docs.microsoft.com/en-us/cpp/c-language/overview-of-c-
statements?view=msvc170#:~:text=C%20statements%20consist%20of%20tokens,is%20discussed%20i
n%20this%20section.
[Accessed 5 June 2022].
Programiz.com. 2022. C for Loop (With Examples). [online]
Available at: https://www.programiz.com/c-programming/c-for-loop
[Accessed 5 June 2022].
En.wikipedia.org. 2022. Work breakdown structure - Wikipedia. [online]
Available at: https://en.wikipedia.org/wiki/Work_breakdown_structure
[Accessed 5 June 2022].
En.wikipedia.org. 2022. Flowchart - Wikipedia. [online]
Available at: https://en.wikipedia.org/wiki/Flowchart
[Accessed 5 June 2022].
Cuemath. 2022. Conditional Statement - Cuemath. [online]
Available at: https://www.cuemath.com/data/conditional-statement/
[Accessed 5 June 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%20view.
[Accessed 5 June 2022].
Programiz.com. 2022. C while and do...while Loop. [online]
Available at: https://www.programiz.com/c-programming/c-do-while-loops
[Accessed 5 June 2022]

P a g e | 22

You might also like