Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (605.88 KB, 22 trang )
<span class="text_page_counter">Trang 3</span><div class="page_container" data-page="3">
<b>Unit number and title</b> Prog102: Procedural Programming
<b>Student declaration</b>
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand thatmaking a false declaration is a form of malpractice.
<b>Student’s signatureGrading grid</b>
</div><span class="text_page_counter">Trang 5</span><div class="page_container" data-page="5"><b>Lecturer Signature:</b>
</div><span class="text_page_counter">Trang 7</span><div class="page_container" data-page="7">Table of Figures ...3
1.Introduction to computer programming languages. ... 4
a. Introduction about an introduction to procedural programming………8
b.Problems statement ... 9
2. Analysis ... 10
a. . List data types, data structures needed in the problem………10
b. Conditional statements needed in the problem ... 11
c. Loop statement needed in the problem ... 11
3. Design ... 11
a. WBS: A WBS to breakdown a probleminto small ones. Explain the WBS ... 11
b.While iteration structure ... 12
c. Flowcharts:Flowcharts of each small algorithm and explaination.Review flowcharts, discuss alternative solution if possible………
4. Evaluation ... 13
a. Evaluate your solution ( ananlysis, wbs, flowcharts) ... 13
b. Evaluate how procedural progamming is applied to your problem ( advantages, disadvantages, difficulties). ... 14
<small>Document shared on www.docsity.comDownloaded by: tran-tien-van-fgw-hn</small>
</div><span class="text_page_counter">Trang 9</span><div class="page_container" data-page="9">The procedural programming method is the implementation of the above function-oriented approach. The procedural approach divides a large program (function) into blocks of functions or functions (procedures) that are small enough to be easy to program and test. Each function has a start and an end point and has its own data and logic. In a program system, variables have certain visible scopes. In a program, functions work independently of each other. Data is converted back and forth through function call parameters. Dividing a program into functions allows multiple people to participate in the program's construction. Each person constructs one or more independent functions
<b>+ </b>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.
<b>+ </b>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.
</div><span class="text_page_counter">Trang 10</span><div class="page_container" data-page="10"><b>+ </b>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.
<b>+</b> 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.
</div><span class="text_page_counter">Trang 11</span><div class="page_container" data-page="11"><b>+ </b>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’.
There are number of bussiness problem, from simple to very complicated. For example, it is very hard to manage all staffs and know if your staff hard working. Therefore, making a small application can help us to indicate who hit hard target in that month. If they have harded full 30 days, they will get bonusmore.
</div><span class="text_page_counter">Trang 13</span><div class="page_container" data-page="13">Explain image of making an application to resolve bussiness problem.
- Simply put, procedural progamming involves writing down a list of intructions to tell the computer what it should do step-by-step to finish the task at hand.
In C programming, data types are just the same what their name suggests. They represent the kind of data to store. They are used to declare several functions as well as variables in aprogram. There are mainly three categories of data types: Basic/Primitive(nguyên thuỷ), Derived( có nguồn gốc), User-Defined ( người dùng xác định).
</div><span class="text_page_counter">Trang 14</span><div class="page_container" data-page="14">In this program I mainly use Basic and Derived types in order to compete my work:
</div><span class="text_page_counter">Trang 15</span><div class="page_container" data-page="15"> Type data Integer with variable n:
Input exactly a number of students I want to manage. Types data Integer with variable i:
Declare and initialize variables for controlling loop. Type data Integer with variable Key:
Select options from the menu and input with variable key allow me to select options from the menu (input student’s information, show all student’s information, find the highest/lowest grade or exit the program).
Type data Integer array with variable ID[]:Input student’s ID and store it.
Type data Float array with variable Grade[]:Input the student’s grades and store it. Function Max:
Show the highest grade of student’s. Function Min:
Show the lowest grade of student’s. Function InputStudentInfo:
Input and store the information of student’s. Function Show:
Show the list of students that I have already input.
</div><span class="text_page_counter">Trang 17</span><div class="page_container" data-page="17">This image Variables and data types needed for this problem.
<b>Conditional statements needed in the problem:</b>
Conditional Statement in C programming are used to make decisions based on the conditions. In this project, conditional statements help me to find the highest and the lowest grade of all students. Located in Function named Max and Function named Min.
<b>Loop statement needed in the problem:</b>
<b>Looping Statements in C execute the sequence of statements many times until the stated </b>
condition becomes false. A loop in C consists of two parts, a body of a loop and a control statement. The control statement is a combination of some conditions that direct the body of the loop to execute until the specified condition becomes false.
</div><span class="text_page_counter">Trang 18</span><div class="page_container" data-page="18">p p
<b>Work breakdown structure.</b>
</div><span class="text_page_counter">Trang 20</span><div class="page_container" data-page="20">Explain: Wbs is very useful with the feature of helping me to separate problem into small ones, which make my project more manageable (quản lý) and approachable (tiếp cận). I know that using this WBS can response the demand of the scenario easily.
A each WBS , the level 1 has five Elements.
1. Provide administrator rights ( input student’s information)2. Display all student’s information ( IDs, grades)
3. Find the highest grade ( by comparing each student’s grades)4. Find the lowest grade ( by comparing each student’s grades)5. Exit the program.
<b>Trích nguồn:</b>
</div><span class="text_page_counter">Trang 21</span><div class="page_container" data-page="21">