



























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!




























Learner’s name: Tran Quang Hien ID: GCS Class: GCS1003A Subject code: PROG Assignment due: Assignment submitted:
ASSIGNMENT 1 FRONT SHEET Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Prog102: Procedural Programming Submission date 22/02/2022 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Tran Quang Hien Student ID GCS Class GCS1003A 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 Grading grid P1 P2 P3 M1 M2 D
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 to procedural programming M1 Discuss on characteristics and features of procedural programming D 1 Critically evaluate the design of your solution against the characteristics and features of procedural programming. P2 Identify the program units and data and file structures required to implement a given design M2 Review the design of a procedural programming solution. 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
ASSIGNMENT 1 ANSWER P1, M1. Provide an introduction to procedural programming
1. Introduction to computer programming language A programming language is a formal language that has a collection of instructions that generate a variety of outputs. In computer programming, programming languages are used to execute algorithms. Any of several languages for implementing directly when in the computer manufacturer's numerical form known as machine language, after a simple substitution procedure when expressed in a matching assembly language, or after translation from some "high-level" language. As you may be aware, there are several computer languages available, but only a handful are commonly utilized. Machine and assembly languages are "low-level," requiring a programmer to manage all of a computer's distinctive data storage and operating characteristics manually. High-level languages, on the other hand, alleviate these problems by offering a notation that is easier for programmers to write and read. As you may be aware, there are a variety of computer languages to choose from, but only a few are widely used. Machine and assembly languages are "low-level," which means that a programmer must manually manage all of a computer's unique data storage and operational properties. High-level languages, on the other hand, relieve a programmer of these worries by offering a notation that is easy to write and understand for programmers. C, C++, C#, and other programming languages are examples. Figure 1: Programming Language Illustration(Source: Sylvain Saurel)
1.2 High-level language In computer science, a high-level programming language is one that has a high level of abstraction from the machine's specifics. It may employ natural language components, be easier to use, or automate (or even hide totally) major sections of computer systems (e.g. memory management), making the process of building a program simpler and more clear than when using a low-level programming language. A computer language's level of abstraction determines how "high-level" it is. An autocode was a high-level programming language that used a compiler in the 1960s. COBOL and Fortran are two examples of autocodes. Figure 3: Source: Sandeep Verma
2. Introduction to procedural programming Procedural programming is a programming paradigm, derived from imperative programming, based on the concept of the procedure call. Procedures (a type of routine or subroutine) simply contain a series of computational steps to be carried out. Any given procedure might be called at any point during a program's execution, including by other procedures or itself. The first major procedural programming languages appeared circa 1957–1964, including Fortran, ALGOL, COBOL, PL/I, and BASIC. Pascal and C were published circa 1970–1972. Computer processors provide hardware support for procedural programming through a stack register and instructions for calling procedures and returning from them. Hardware support for other types of programming is possible, but no attempt was commercially successful (for example Lisp machines or Java processors).
Figure 4: Procedural Programming Illustration (Source: fromabacustoi7)
3. Criteria for choosing a programming language to use Professionally, we don’t generally get to choose the language to use. The customer does. However, in the event that we should be given the chance to choose. In my opinion, I think here are the crucial criteria:
1.2.1 Basic types They are arithmetic types and are further classified into (a) Integer types and (b) floating-point types. 1.2.2 Enumerated types They are again arithmetic types and they are used to define variables that can only assign certain discrete integer values throughout the program. 1.2.3 The type void The type specifier void indicates that no value is available. 1.2.4 Derived types They include (a) Pointer types, (b) Array types, (c) Structure types, (d) Union types and (e) Function types. Figure 6: Basic types Illustration(Source: tutorialspoint)
2. There are 5 data types in procedural programming 2.1 Int An integer, in the environment of computer programming, is a data type used to represent real figures that don't have fractional values. Different sorts of integer data types are stored in different ways on computers. An integer is also used to determine an item's position within an array.
3. Selection structures 3.1 If The ability to direct the flow of your program, allowing it to choose which code to run, is extremely beneficial to a programmer. You may use the 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. The if statement allows the computer to choose an action based on the user’s input, which is one of its most significant functions. For example, by checking a user-entered password with an if statement, your application may determine whether a user is given access to the site. Figure 7: Example for structure if Condition statement (s) False True Rest of code
3.2 If else In C++, an if-else statement is a conditional statement. If a condition is satisfied, the C++ of statement executes a block of code. If the condition is not satisfied, an if-else statement performs the same function but executes the second piece of code. It's possible to nest if and if- else statements. Figure 8: Example for if-else Condition If code Else code If condition is true If condition is false
❖ Solutions used in the problem:
grades[i]”, and it will help me compare the grade of the first student with the grades of the next student in the array, and if other students' grades are lower than the grade of the first student, it will display the grade of the first student known as the highest grade with his/her ID. In opposite, it will show the grades of the next student with his/her ID. It’s similar to finding out min grade.
4. Iteration constructs 4.1 For A "For" loop is a programming construct that is used to repeat a block of code (statement) for a specified number of times. The for-loop statement is a highly customized while loop that improves program readability. The for loop has the following syntax.
4.2 While Another name for while loop is pre-tested loop. In general, a while loop allows a portion of code to be repeated several times based on a boolean value. It's a looping if statement, if you will. When the number of iterations is unknown in advance, the while loop is frequently used. Test Expression While Loop Body False True