Assignment1 Procedural Programming

16 0 0
Assignment1 Procedural Programming

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

TABLE OF CONTENTS Contents Assignment Brief 1 (RQF) 5 Higher National CertificateDiploma in Computing 5 1 Introduction to procedural programming (P1, M1) 7 1 1 Introduction (P1) 7 1 2 Key features of.

TABLE OF CONTENTS Contents Assignment Brief (RQF) .5 Higher National Certificate/Diploma in Computing .5 Introduction to procedural programming (P1, M1) 1.1 Introduction (P1) .7 1.2 Key features of procedural programming (M1) 1.3 Characteristics of procedural programming (M1) .8 Analysis (P2) .8 2.1 Data types and data structure 2.2 Conditional sentences 2.3 Loop 2.4 Switch - Case 10 Design diagrams for the program (P3) .12 3.1 Use-case diagram 12 3.2 WBS (Work Breakdown Structure) 12 3.3 Flowcharts 13 Review the design of procedural programming solution (M2) 17 Evaluate the design of my solution (D1) 18 References 19 ASSIGNMENT FRONT SHEET Qualification BTEC Level 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 Student ID Class Assessor name 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 of malpractice Student’s signature Grading grid P1 P2 P3 M1 M2 D1  Summative Feedback: Grade:  Resubmission Feedback: Assessor Signature: Date: Lecturer Signature: Introduction to procedural programming (P1, M1) 1.1 Introduction (P1) - A programming language is a vocabulary and set of grammatical rules for instructing a computer or computing device to perform specific tasks Each programming language has a unique set of keywords (words that it understands) and a special syntax for organizing program instructions  There are two main types of programming languages: low level languages (closeness to machine code (0s and 1s) Such as: machine language, assembly language,.) and high level languages (closeness to the human-language Such as: C, FORTRAN, or Pascal, ) - Procedural programming is a programming paradigm built around the idea that programs are sequences of instructions to be executed - Procedural programming focus heavily on splitting up programs into named sets of instructions called procedures, analogous to functions The basic idea is to have a program specify the sequence of steps that implements a particular algorithm 1.2 Key features of procedural programming (M1) - 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 predefined function is ‘charAt()’, which searches for a character position in - - - 1.3 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 Modularity: Modularity is when two dissimilar systems have two different tasks at hand but are grouped together to conclude a larger task first Every group of systems then would have its own tasks finished one after the other until all tasks are complete Parameter Passing: Parameter Passing is a mechanism used to pass parameters to functions, subroutines, or procedures Parameter Passing can be done through ‘pass by value’, ‘pass by reference’, ‘pass by result’, ‘pass by value-result’ and ‘pass by the name’ Characteristics of procedural programming (M1) The characteristics of procedural programming are: • Procedural programming follows a top-down approach • The program is divided into blocks of codes called functions, where each function performs a specific task • Procedural programs model real-world processes as 'procedures' operating on 'data' • The data and functions are detached from each other • The data moves freely in a program • It is easy to follow the logic of a program • A function can access other function's data by calling that function The analysis for the program (P2) 2.1 Explain wants to manage grades of a class problem: - A function enters student IDs, student’s grades and store these information into separate arrays (integer array for IDs and float array for grades) -A function to print all student IDs together with their grades -A function to know which student has highest grade and lowest grade -A menu creation function for the user to choose from -A function to make a loop back to the menu for the user to choose from other options, there is an exit option so the user can exit the loop 2.2 Variables and data types required in the program ❒ arrays:  studentID (type integer): store ID of the student(s)  studentGrade (type float): store grade of the student(s) ❒ choice (type integer): store option of the teacher’s choice ❒ total (type integer): store number of students in the class ❒ (type float): store the lowest grade of the class ❒ max (type float): store the highest grade of the class 2.3 Selection structures in the program (if, else, switch )  If: use for comparison between numbers to figure out the highest and the lowest grade In the context of the scenario, if statements use in functions in the program: Find the highest grade, and find the lowest grade  Find the highest and the lowest grade function: if statements use to compare numbers in the array of grade Thus, program can figure out the highest grade and the lowest grade of the class  The position of these if statements can be used in the iteration constructs  Switch: use to control statement that allows some group of statements to be chosen from several available functions  In the context of the scenario, switch statements use to allow function variable to be compared with several possible case labels, which are represented by constant values If the function variable matches with one of the constants, then an execution jump is made to that point A case label cannot appear more than once and there can only be one default expression  The position of switch statement can be used in the menu part 2.4 Iteration constructs in the program (for, while, while)  Iteration constructs used to repeat a statement or a set of statements for a specified number of times or until a condition satisfied • In the program, for statements used to:  Get the value of ID(s) or grade(s) and print to the screen  Repeat if statements to check the value which is higher or lower grade • In the program, the do… while construct executes its sequence at least once and continues executing it as long as the test condition is true do… while statement used in the menu section to repeat checking the value which is enter from user and collaborate with switch statement to choose the function that user wants • In the program, the while construct executes its sequence as long as the test condition is true While statements used in input function in order to check the number of student in class (make sure it is greater than 0), check ID (make sure it is greater than 0), and check grade (make sure it is in the range 0-10) 2.5 Split the program into functions (sub-functions) and hierarchy diagram Functions:  main(): To print menu to the screen and controls program execution by directing the calls to other functions in the program  inputStudentID(): To enter ID of student(s) from user keyboard  InputStudentGrade(): To enter grade of student(s) from user keyboard  max(): To find the student ID which has the highest grade from the ID list  min(): To find the student ID which has the lowest grade from the ID list 2.6 Testing and Debugging - Testing is the process of verifying and validating that a software or application is bug free, meets the technical requirements as guided by its design and development and meets the user requirements effectively and efficiently with handling all the exceptional and boundary cases - Debugging is the process of fixing a bug in the software It can be defined as the identifying, analyzing and removing errors This activity begins after the software fails to execute properly and concludes by solving the problem and successfully testing the software It is considered to be an extremely complex and tedious task because errors need to be resolved at all stages of debugging 2.7 Maintenance  Program maintenance is the process of modifying a software or program after delivery to achieve any of these outcomes:     Correct errors Improve performance Add functionalities Remove obsolete portions Design 3.1 Use-case 3.1 Use-case diagram Explain: There are four function that user (exactly is teacher) can approach to in the program In the program, input student ID(s), input student name(s), and input grade(s) function will be used for storing the values that user input Coupled with that, first-two functions will be used to linked with two other functions to get the value from these functions and show the results that user want 3.2 WBS (Work Breakdown Structure)  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 A Deliverable-Based Work Breakdown Structure clearly demonstrates the relationship between the project deliverables) and the scope 3.3 Flowcharts ⚫ Menu operation Explain: The user will choose one of these choices, after that, the program will read the value that user input to “choice” variable, if the choice - variable of selection - equal with a number that link to a function, the user will get their expected Input ID(s), Grade(s) • Explain: • Start with the value i=0 • Compare i optimization is difficult Conclusion After completing this exercise, I have grasped the basic theoretical knowledge about procedural programming along with the effects of statements and functions in the program, explaining the reasons for using statements, structures, etc that bamboo I already know how to build flowcharts, use cases, WBS, I also know how to divide them by functions and clear analysis on how it works, conditions of occurrence, return values, Besides In addition, some better solutions for the program are given by me, which will help the program work better The assessment is carefully analyzed on the advantages, disadvantages, difficulties encountered Finally, the assignment was combined with full information and citations I think it will help me to complete my next assignments in the future Reference list Kumar, K and Dahiya, S., 2017 Programming languages: A survey International Journal on Recent and Innovation Trends in Computing and Communication, 5(5), pp.307-313 Moore, S., 2014 Key Features Of Procedural Programming [online] Available at: [Accessed July 2021] Cohen, E., 2018 What is WBS (Work Breakdown Structure) in Project Management? [online] Workamajjg blog Available at: [Accessed July 2021 Loshin, D and Lewis, S., 2021 data structures [online] Techtarget Available at: [Accessed July 2021] Chapin, N., 2003 Flowchart Encyclopedia of Computer Science, pp.714– 716 ... value-result’ and ‘pass by the name’ Characteristics of procedural programming (M1) The characteristics of procedural programming are: • Procedural programming follows a top-down approach • The program... FORTRAN, or Pascal, ) - Procedural programming is a programming paradigm built around the idea that programs are sequences of instructions to be executed - Procedural programming focus heavily... is not intuitive, the size is not uniform 4.2 Evaluate how procedural programming is applied to your problem Advantages: Procedural programming has optimal statements for specific functions There

Ngày đăng: 28/02/2023, 19:35

Tài liệu cùng người dùng

Tài liệu liên quan