Download Analysis and Design of Procedural Programming Solutions: A Guide for Computing Students - and more Assignments C programming in PDF only on Docsity!
Assignment Brief 1 (RQF)
Higher National Certificate/Diploma in Computing
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 P2 Identify the program units^ programming. 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 the grades of a class. He asks you to help him to write a small application to do that. He needs to enter student IDs, students’ grades and store this 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 the highest grade and lowest grade. Your program should be menu based on 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 the 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 an introduction to computer programming languages and discuss key features of procedural programming. Task 2 Your next task is to analyze 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.
ASSIGNMENT 1 FRONT SHEET
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 Nguyen Dang Gia Huy Student ID GCS Class GCS1003B Assessor name Lê Ngọc Thành Student declaration I certify that the assignment submission is entirely my 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
Summative Feedback: Resubmission Feedback:
Grade: Assessor Signature: Date: Lecturer Signature:
Introduction
- Technology is now widely used around the world as a result of the advancement of contemporary technology. As a result, as an information technology student, I need to keep my knowledge up to date regularly. This means procedural programming will be the first programming paradigm I learn as a new developer. I will complete four chapters in this assignment: Chapter 1: I will present a programming language, C, and procedural programming, as well as procedural programming features. Chapter 2: I will introduce variables, data types, condition statements, loop statements, and functions to investigate the problem presented in assignment 1. Chapter III: I'll create flowcharts for each little algorithm, a use-case diagram, and a WBS to split an issue down into sub-problems for the software. Chapter IV: I'll discuss the program's evaluation and conclusion.
Chapter I: Programming language and procedural language. 1/ Programming language 1.1. Definition.
- Programming language is a set of rules or instructions given to the computer to perform specific tasks. Moreover, it's well-known as a computer language that helps people can communicate with their computers through binary. By programming language, developers can make the program for their computer by creating a set of instructions in a programming language to receive the results that developers want.. The structure of a program includes libraries, strings, arrays, loops, functions, and statements. Based on them, developers can translate their thought into instructions that computers can understand.
B, Advantages, and disadvantages of low-level programming languages.
- It doesn't require a compiler or interpreter, thus programs are quick and memory efficient. + It can interface directly with hardware devices, reducing compilation and interpretation time. Advantages: + Programs are machine dependant and not portable; + they are harder to maintain, create, and debug; + they are more mistake-prone. 1.2.2. High-level programming language. A definition and types.
- A high-level programming language is a programming language that is meant to create user-friendly software applications and has a high level of abstraction. This programming language necessitates the use of a compiler to convert the program into machine code. There are several high-level programming languages available nowadays, including Python, C++, C#, Java, and JavaScript. Numerical languages, Business languages, Artificial Intelligence languages, and Systems languages are the four types of high-level languages.
1.2.3. Advantages and disadvantages of high-level programming language a Advantages :
- Because of the machine's independence, programs may be performed on any type of computer without change, making it simple for developers to use and comprehend. It's simple to debug and manage since faults are simply identified and located. b, Disadvantages :
- The programmer is unable to directly connect to and operate the hardware. Because programs must be translated into machine language, they take longer to run.
- Extensive: it can readily adapt to new features and operations + Mid-level programming language: it can be used to create both low-level and high-level programming.
- Rich library: There are several built-in functions that aid programmers in writing code quickly.
- Quick and efficient: in comparison to other high-level languages, C has fewer functions. As a result, the execution and compilation times are reduced.
3. Procedural programming 3.1what is procedural programming.
- The first programming paradigm that a new programmer will learn is procedural programming. This technique is top-down and linear, and data and procedures are treated as independent entities. Procedural code, in most cases, will tell the computer how to accomplish a task in logical stages. If a program is too huge, procedural programming will be used to break it down into smaller functions. subroutines that include a set of instructions to be followed. Overall, procedural programming entails defining a set of rules for the computer to follow for it to execute tasks that programmers have assigned to it. 3.2. Characteristics of procedural programming. 3.2.1. Predefined functions: predefined functions are methods that are already defined in the library of the program you are using. Therefore, programmers can re-use the already present code in the system library. One example of a predefined function is the sqrt()
function which is available in math.h library 3.2.2 library
- In procedural programming, many libraries contain a set of pre-built syntax and subroutines. Therefore, programmers can freely use the functions in these libraries by declaring before. Some examples of libraries: #include: The basic library of every program in C #include: Define various mathematical functions #include: Library used to check the characters 3.2.3 Local variables:
- A local variable is defined in the main structure of a method, a block, or a constructor and has a restricted scope. The local variable works just in the method in which it is declared, and it will stop working if it is used outside of that method. 3.2.4 Global variables
- Every other function is declared outside of a global variable. As a result, it may be used in any function that does not require local variables.
by the name.'
- Because of its benefits, parameter passing is now frequently utilized in C and C++ systems. If we don't utilize passing by reference in a program, for example, the program
must create memory space for formal parameters (which is resource-intensive), then it must assign actual parameters to formal parameters, which is time costly. Using parameter passing will help you save memory in general. 3.2.7 procedures
- When procedures are utilized in programming, the software will walk through the procedures from top to bottom. The software does precisely what the programmer instructs it to do in the order that the programmer specifies. 3.3. Advantages and Disadvantages of Procedural Programming Advantages: +Because source code is portable, it may be repurposed to target a different processor. +The code may be reused in multiple parts of the program, so it is not required to duplicate it. +The Procedural Programming method also reduces the amount of memory required. For general-purpose programming, procedural programming is ideal. Disadvantages: +Programmers must have an extensive and detailed understanding of program instructions. +It is tough to determine where global data belongs in a huge software. +Procedural Programming makes data exposed to the whole program, making it less secure. +Due to global data, maintaining and developing code in larger applications is more difficult.
.) Solution use in these problems
- To fix the problem, I'll declare appropriate variables using two types of data: integer and float. Because these variables only store integer values, I'll use an integer to declare the number of students, the ID of students, MaxID, mind, and the choice in the menu. Because these variables contain both integer and real values, the float will be used to declare the highest grade of a student, the lowest grade of a student, and the grade of students. The table below will help you understand my solution. 2) What is the conditional statement
- If a given condition is satisfied, a conditional statement is a set of rules that will be followed. The if-else statement and the switch-case statement are two forms of conditional statements. 2.1. If-else statement The if statement is used to examine the validity of a specified condition and take actions based on that condition. It's most commonly utilized in scenarios when we need to conduct many operations for various situations. If the condition returns true, the words in the body of the if-else statement are executed. will be executed, and statements within else's body will be ignored. If, on the other hand, the circumstance If the statement in the body of if returns false, the statements in the body of else will be skipped. will be carried out
2.2. Switch-case statement A switch-case statement allows us to do numerous actions by comparing the values of variables. a single variable known as the switch variable, with each value referred to as a case