















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
















Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Prog102: Procedural Programming Submission date Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Tran Van Tuong Student ID GCH Class GCH1107 Assessor name Manhdd 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 Tuong Grading grid P1 P2 P3 M1 M2 D
Grade: Assessor Signature: Date: Lecturer Signature:
I will discuss the principles of procedural programming as well as how to create use case diagrams and flowcharts for the topic at hand in this report, which is a synthesis of both assignments. The software will be designed to assress the problem based on diagrams and graphs.
The first program that a programmer must learn is procedural programming. In essence, procedure code is a code that instructs a device to complete a task in logical steps. This model employs a top-down linear approach and treats data and procedures as distinct entities. Procedural Programming divides a program into procedures, also known as routines or functions, which simply contain a series of steps to be performed. Simply put, Procedural Programming entails writing down a list of instructions to tell the computer what it should do step by step to complete the task at hand.
The first program is procedural programming. It focuses on the process rather than the data. It treats a problem as a series of tasks to be completed, such as reading, measuring, and printing. As a result, a variety of functions are written to solve a problem. Software is divided into a number of functions, each with a specific goal in mind. The majority of roles process global data. Data flows freely across the device from function to component. The disadvantage of process-oriented programming (structure programming) It emphasizes doing things. Even though data is the reason for the program's existence, it is given a second class rank. Because each function has direct access to the global variables, the new programmer will unintentionally corrupt the results by constructing functions. Similarly, if additional data must be inserted, the entire function must be changed to access the data. The functioning of the components and the data structure do not always model the real world, making design difficult.
Problem: 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. Solve: To meet the aforementioned requirements, we'll need to develop a management program with basic functions such as importing and exporting personal information, searching for and editing information, calculating scores, sorting orders, and so on. Using algorithms written in the c programming language, this problem will be solved quickly, simply, and effectively.
A procedural programming language such as C or Pascal is usually the first programming language the most students cone across. However, in most curriculums, the concept of’procedure is introduced to the fruit of the procedural style of programming. A flowchart is a graphic means of documenting a sequence of operations. Flpwcharts serve as a pictorial means of communicating from one person to another the time-ordering of events or actions. As a pictorial format, flowcharts have been the subject of the both an International and an American National Standard. Flowcharts go by many other names, including block diagrams, flow diagrams, system charts, run diagrams, process charts, logic charts, and iteration diagrams.
❖ Integer: In C, the integer data type is used to store whole numbers without decimal points. In C, the int data type can store octal, hexadecimal, and decimal values. In C, we can use the sizeof operator to determine the size of the int data type. The unsigned int data type in C is used to store data values ranging from zero to positive numbers, but it cannot store negative values like the signed int data type. Figure 2 : Example of int ❖ Char A character data type variable can only store one character. The character has a storage capacity of one. It is the most fundamental data type in C. In almost all compilers, it stores a single character and requires a single byte of memory. Figure 3 :Example of char ❖ Float The float data type is used in C programming to store floating-point values. In C, the float variable is used to store decimal and exponential values. It is used to store decimal numbers with single precision (numbers with floating point values). Figure 4 :Example for float
❖ Void When the function return type void is used in computer programming, it indicates that the function does not return a value. The presence of the keyword void in a pointer declaration indicates that the pointer is universal. When the keyword void is used in a function that has no parameters.For example: Figure 5 :Example for void 1.2. Data structure ❖ Structure: In C/C++, a structure is a key word that creates user-defined data types. A structure defines a data type that can be used to combine items of potentially different types into a single type. For example: Figure 6 :Example for structure ❖ Array An array is a collection of data items of the same type that are stored in contiguous memory locations. Arrays are derived data types in the C programming language that can store primitive data types such as int, char, double, float, and so on. It can also store a collection of derived data types such as pointers, structures, and so on. The array is the most basic data structure because each data element can be accessed at random by using its index number.
o Flow chart of the if-else: Figure 9 : If-else flowchart example o Example : Figure 10 :If-else example
❖ For statement: A for loop is a repetition control structure that allows you to write a loop that must be executed a certain number of times in an efficient manner. o Syntax: the syntax of a for loop in C programming language is − Figure 11 :if else syntax The situation is being assessed. If it is true, the loop's body is executed. If it is false, the body of the loop is skipped and control moves to the next statement just after the 'for' loop. The flow of control returns to the increment statement after the body of the 'for' loop has completed. You can use this statement to update any loop control variables. This statement can be left blank as long as the condition is followed by a semicolon. The condition is now re-evaluated. If it is true, the loop is executed and the process is repeated (body of loop, then increment step, and then again condition). The 'for' loop is terminated when the condition becomes false.. o Flowchart Figure 12 :For flowchart example
o Flowchart Figure 15 :Do-while flowchart example o Example: Figure 16 :Example for do-while
❖ Switch-case statement A switch statement allows you to test a variable against a set of values. Each value is referred to as a case, and the variable being toggled is checked for each switch case. ❖ Syntax: Figure 17 : switch case syntax The following rules apply to a switch statement −
III. Design
WBS is an abbreviation for Work Breakdown Structure, which translates roughly as Work Breakdown Structure. The work breakdown structure (WBS) is a hierarchical breakdown of the entire scope of work that will be performed by the project team to achieve the project objectives and produce the required deliverables. The work breakdown structure (WBS) organizes and defines the overall scope of the project and represents the work specified in the current approved project scope statement. Figure 20 :The hierarchy diagram of the program The program is divided into 5 sub-functions: ➢ Function 1: Enter student information ➢ Function 2: Find student ➢ Function 3: Show the students highest grade ➢ Function 4: Show the students lowest grade ➢ Function 0: Exit
Figure 21 :use case diagram
3.2. Print Highest grade Figure 23 :Flowchart for function show the student highest grade
3.3 Print lowest grade Figure 24 :Flowchart for function show the student lowest grade