Procedural Programming Assignment for BTEC Level 5 HND Diploma in Computing: Prog102, Essays (university) of Programming Languages

Information about an assignment for the Prog102 unit of the BTEC Level 5 HND Diploma in Computing, which focuses on Procedural Programming. instructions for the assignment, key features of Procedural Programming, and examples of programming constructs such as if statements, for loops, and switch case statements. The assignment requires students to write a program in C language to manage student data, including entering student IDs and grades, storing the data in arrays, and determining the highest and lowest grades.

Typology: Essays (university)

2020/2021

Uploaded on 08/04/2022

truong-duy-minh-fgw-dn
truong-duy-minh-fgw-dn 🇻🇳

5

(7)

12 documents

1 / 24

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ASSIGNMENT 1 FRONT SHEET
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
Prog102: Procedural Programming
Submission date
June 15th 2022
Date Received 1st submission
Re-submission Date
Date Received 2nd submission
Student Name
Truong Duy Minh
Student ID
GCD210505
Class
PROG102
Assessor name
Phan Thanh Tra
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
M
Grading grid
P3
D1
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18

Partial preview of the text

Download Procedural Programming Assignment for BTEC Level 5 HND Diploma in Computing: Prog102 and more Essays (university) Programming Languages in PDF only on Docsity!

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Prog102: Procedural Programming Submission date June 15th^2022 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Truong Duy Minh Student ID GCD Class PROG102 Assessor name Phan Thanh Tra 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 M Grading grid P1 P2 P3 M1 M2 D

 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date: Lecturer Signature:

  • I. INTRODUCTION
      1. SCENARIO
      1. OVERVIEW ABOUT PROGRAMMING LANGUAGUES
      1. C LANGUAGE
      1. PROCEDURAL PROGRAMMING LANGUAGES
      • a. Definition of Procedural Programming
      • b. Key features of Procedural Programming
      • c. Advantages and disadvantages of Procedural Programming
      1. USER REQUIREMENT........................................................................................................................
  • II. ANALYSIS
      1. Variable:
      1. Data types:.................................................................................................................................
      1. Conditional statement
      • a. If statement
      • b. If…else statement
      • c. Switch case statement
      • d. Do while loop
      • e. While loop
      • f. For loop …………………………………………………………………………………………………………………………………….
      1. Functions
  • III. DESIGN SYSTEM STRUCTURE.............................................................................................................
      1. Work breakdown structure (WBS):
      1. ALGORITHM
  • Figure 1: Scenario Table Of Figures
  • Figure 2: The popularity of some programming language by TIOBE Index
  • Figure 3: Some advantage of C language
  • Figure 4: Procedure Oriented Programming Language
  • Figure 5: Data types
  • Figure 6: Variable name and Data types
  • Figure 7: If statement
  • Figure 8: Example of If statement
  • Figure 9: Syntax of if else statement
  • Figure 10: Example of if else statement
  • Figure 11: Syntax of switch case statement
  • Figure 12: Example of switch case statement
  • Figure 13: Syntax of do while loop
  • Figure 14: Example of do while loop
  • Figure 15: Example of defining a function
  • Figure 16: Example of calling a function
  • Figure 17: WBS of program
  • Figure 18: Use-case................................................................................................................................
  • Figure 19: Flowchart of program
  • Figure 20: Flowchart of viewMenu
  • Figure 21: Flowchart of enterStudentsinfor
  • Figure 22: Flowchart of highestGrade
  • Figure 23: Flowchart of lowestGrade

I. INTRODUCTION

In recent year, management system is popular around the world and familiar with most jobs. Basically, A Management Information System or MIS is a systematic organization and presentation of information that is generally required by the management of an organization for taking better decisions for the organization. Moreover, a management system can help users solve their problem in many major. The effects of this program will be explained and presented in detail so users will understand how a management system work and evaluate the product.

  1. SCENARIO A math teacher wants to manage grades of a class. He asks me to help him to write a small application to do that. He needs to enter student IDs, student’s grades and store 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. My 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. Figure 1: Scenario

3. C LANGUAGE

 C is a general-purpose computer programming language. It was created in the 1970s by Dennis Ritchie, and remains very widely used and influential. By design, C's features cleanly reflect the capabilities of the targeted CPUs. It has found lasting use in operating systems, device drivers, protocol stacks, though decreasingly for application software, and is common in computer architectures that range from the (Anon., n.d.) largest supercomputers to the smallest microcontrollers and embedded systems.  In this program, I will use C language to make the application according to the user’s requirements. Figure 3: Some advantage of C language

4. PROCEDURAL PROGRAMMING LANGUAGES

a. Definition of Procedural Programming

Procedural programming is the one that directly instructs a device on how to finish a task in logical steps. This paradigm uses a linear top-down 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, which are also known as routines or functions, simply containing a series of steps to be carried out. (Anon., n.d.) Figure 4: Procedure Oriented Programming Language

b. Key features of Procedural Programming

Predefined functions: A predefined function is typically an instruction identified by a name. Usually, the predefined functions are built into higher-level programming languages, but they are derived from the library or the registry, rather than the program. One example of a pre-defined function is ‘charAt()’, which searches for a character position in a string.  Local Variable : A local variable is a variable that is declared in the main structure of a method and is limited to the local scope it is given. The local variable can only be used in the method it is defined in, and if it were to be used outside the defined method, the code will cease to work.  Global Variable : A global variable is a variable which is declared outside every other function defined in the code. Due to this, global variables can be used in all functions, unlike a local variable.

II. ANALYSIS

  1. Variable: In programming, a variable is a value that can change, depending on conditions or on information passed to the program. Typically, a program consists of instruction that tell the computer what to do and data that the program uses when it is running. (Anon., n.d.)
  2. Data types:  Data type is an attribute associated with a piece of data that tells a computer system how to interpret its value. Understanding data types ensures that data is collected in the preferred format and the value of each property is as expected.  In C programming, data types are declarations for variables. This determines the type and size of data associated with variables. (Anon., n.d.) Figure 5: Data types
  • In this program, there will be 6 main variable name. Each one would bring own data type that fit with the program.

Variable name Data type NUMBER OF STUDENT IN CLASS numberOfStudents^ Integer STUDENT IDs studentID Integer array STUDENT’S GRADE studentGrade Float array USER’S OPTION MENU optionMenu Integer STUDENT HAS HIGHEST GRADE highestGrade Float STUDENT HAS LOWEST GRADE lowestGrade Float Figure 6: Variable name and Data types

  1. Conditional statement

a. If statement

You can use if statement to control whether or not a program enters a block of code based on whether or not a particular condition is true or false. One of the important functions of the if statement is that it allows the program to select an action based upon the user's input. For example, by using an if statement to check a user-entered password, your program can decide whether a user is allowed access to the program. (Anon., n.d.)

b. If…else statement:

An If else statement in programming is a conditional statement that runs a different set of statement depending on whether an expression is true or false. (Anon., n.d.) Figure 9: Syntax of if else statement Figure 10: Example of if else statement c. Switch case statement  Switch statement in C tests the value of a variable and compares it with multiple cases. Once the case match is found, a block of statements associated with that particular case is executed. (Anon., n.d.)  Each case in a block of a switch has a different name/number which is referred to as an identifier. The value provided by the user is compared with all the cases inside the switch block until the match is found.

Figure 11: Syntax of switch case statement Figure 12: Example of switch case statement

Figure 15: Example of defining a functionCalling a Function: While creating a C function, you give a definition of what the function has to do. To use a function, you will have to call that function to perform the defined task. Figure 16: Example of calling a function

  • In this program:  Function “main()” is the menu option used for outputting choices. When the teacher starts the program, the first thing he/she has to do is enter the numberof students. This function uses “do…while” loop, “if” statement, switch statement and for loop.

 Function “inputInformation()” has function to help the math teacher to enter ID and grade of students and check that if both of them are valid or not via “array” to store them, “for” loop and “do…while” loop.  Function “outputInformation” helps the math teacher to display the grade corresponding to the ID which are stored previously from function “inputInformation” via “do…while” loop.

III. DESIGN SYSTEM STRUCTURE:

  1. Work breakdown structure (WBS): The Work Breakdown Structure (WBS) is the tool that utilizes this technique and is one of the most important project management documents. It singlehandedly integrates scope, cost and schedule baselines ensuring that project plans are in alignment. (Anon., n.d.) Figure 17: WBS of program
  2. ALGORITHM  Step 1: Begin program

Figure 19: Flowchart of program

 Step 3: Figure 20: Flowchart of viewMenu  Case option 1  Enter number of students  Enter information of each student (including ID and grade). If student’s ID exist, the user will receive a re-entry request  When user finishes entering student information, program go back to the main menu  Step 2  Case option 2  All students information will be showed in screen  When the option to has done, program go back the main menu  Step 2  Case option 3  Show the student has highest grade  Program go back the main menu  Step 2  Case option4  Show the student has lowest grade  Program go back the main menu  Step 2  Case option 5  Exit program  Program end