Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Procedural Programming: Managing Student Grades, Study Guides, Projects, Research of Computer Science

Programming LanguagesData StructuresAlgorithms

The application of procedural programming in managing student grades. It covers the problem statement, analysis, design, and evaluation of the program. Procedural programming, a programming paradigm that uses procedures or functions, is used to enter, store, and retrieve student information, calculate grades, and determine the highest and lowest grades. The document also discusses the advantages and disadvantages of using procedural programming for this problem.

What you will learn

  • What are the advantages and disadvantages of using procedural programming for student grade management?
  • What is procedural programming and how does it work?
  • What functions are used in the student grade management program?
  • What data types and structures are needed for the student grade management problem?
  • How is procedural programming used to manage student grades?

Typology: Study Guides, Projects, Research

2021/2022

Uploaded on 12/07/2022

Phamdung
Phamdung 🇻🇳

12 documents

1 / 22

Toggle sidebar

Related documents


Partial preview of the text

Download Procedural Programming: Managing Student Grades and more Study Guides, Projects, Research Computer Science in PDF only on Docsity! ASSIGNMENT 1 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 Pham Minh Dung Student ID GCH210642 Class GCH1103 Assessor name Lai Manh Dung 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 D1  Summative Feedback:  Resubmission Feedback: Grade: Assessor Signature: Date: Lecturer Signature: • Procedure: Procedures are one-by-one instructions that are carried out in programming. They flow from one to the next in a sequential manner, so after the one above is finished, it will move on to the next unless the one above tells it not to (Moore, 2014). • Programming paradigms: Procedural programming, object-oriented programming, and flow programming. • There are many types of code samples: condition (if, if else), loop (for, do while), data type (int, double, char). For example: Problem using comparison: If (a>b) printf(“True”) else printf(“false”); Or import array from keyboard: It help us many difficult problems. We can use many data type for data, int for integer, char for name,characters, … 1.2 Problem statement 1.2.1 Problem and solution Scenario: A math teacher wants to manage grades of a class. He asksyou 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. Problem: The problem of student information management is a difficult problem. Manual management method has many disadvantages such as: • Time consuming, complicated. • Information may be wrong and difficult to correct. • If the time is long, the document may be damaged. • Difficult for searching, statistics. calculation. We need to find a solution to this problem. Solution: I think a student management program is a good choice.Input information: name, ID, gender, score, … Output information: Name, ID, age, gender, score of all students, maximum score, minimum score, average score, result, grade, rank, … Advantages: • Enter information quickly and accurately. • Information is stored for a long time. • Easy search, calculation, statistics. 1.2.2 Apply procedural programming for this problem Procedural programming is a good way to create this program. To use many functions, I need to declare some necessary libraries such as,… It helps me with calculations, data entry, … Next, I will declare a structure to collect all the required input information of a student, type int, float, char will be used for name, ID, points. An interface would be necessary for any program but I need to get the number of students before I get started with the interface, initializing a variable with printf and scan will do the job. The while-do loop will be used, further initializing an array with the number of elements as the number of students. Using multiple printf statement to print a menu of functions and use switch-case to select them. The functions will be written below the main part, then they will be declared before the main section and used in each case to write the corresponding function. Import and export functions: using for loop in combination with scanf, printf, gets statements. Point functions: Using a for loop to “call” the combined values along with if, if-else conditionals to compare, swap and printf to print the result. 2 Analysis (P2) 2.1 List data types, data structures needed in the problem Each variable in C has an associated data type. Each data type requires different amounts of memory and has some specific operations which can be performed over it. Let us briefly describe them one by one: Following are the examples of some very common data types used in C: • Char: The most basic data type in C. It stores a single character and requires a single byte of memory in almost all compilers. • int: Int is used to store an integer And, it can take 232 distinct states from - 2147483648 to 2147483647. • Float: It is used to store decimal numbers (numbers with floating point value) with single precision. • Double: It is used to store decimal numbers (numbers with floating point value) with double precision. Different data types also have different ranges upto which they can store numbers. These ranges may vary from compiler to compiler. Below is list of ranges along with the memory requirement and format specifiers on 32 bit gcc compiler. 2.3 Loop statement needed in the problem 2.3.1 FOR For loop operation sequence:  Step 1: Initialize the iterator value, only do it once  Step 2: Check the loop condition, if the condition is false => Go to step 5  Step 3: Execute the loop content inside the loop body  Step 4: Update the iterator value => Go back to Step 2  Step 5: End the loop. The situation is currently being re-evaluated. If it’s true, the loop will run and the procedure will repeat (body of the loop, then increment step, and then again condition). The ‘for’ loop ends when the condition becomes false. we use a for loop in the scenario to accept numberOfStudent inputs from the array. In the body of the loop, it will include the if statement. the for loop will continue to run false True Initialize the iterator value Loop condition Loop body Update the iterator value End (numberOfStudent -1) times to find the highest and lowest grade. Then we will use a for loop to find out who the students with the highest or lowest grade are. By putting the if statement inside this loop. If grade = max Grade or grade = min Grade then print the student's ID. So we have found the people with the highest grade and those with the lowest grade. 2.3.2 DO-WHILE Unlike for and while loops, which verify the loop condition at the top, the do-while loop in C programming checks it at the bottom. A do-while loop is similar to a while loop, except it guarantees that it will be executed at least once. Two statement actions are available in the program: one for input variables and the other for scanning variable values. When the do-while command is executed, it begins processing the S grade values at the end. The loop condition is then used; if true, the loop will return to the start and the loop's body will be run once more. This procedure repeats itself until the condition no longer exists. The do-while loop is responsible for verifying the state of variables as they are typed in. 2.3.3 WHILE In while loop, a condition is evaluated before processing a body of the loop. If a condition is true then and only then the body of a loop is executed. Here, statement(s) may be a single statement or a block of statements. The condition may be any expression, and true is any nonzero value. The loop iterates while the condition is true. When the condition becomes false, the program control passes to the line immediately following the loop. 3 Design (P3, M2) 3.1 WBS WBS is a concept to describe the division of work objects with the aim ofmaking work content transparent, identifying necessary tasks to achievegoals. (Cohen, 2018). • I built a WBS for this problem: My WBS has a few parts: - Enter information: Enter all the necessary student information such as ID, name, age, gender, scores. For the functions to work properly, all information must be entered. - Show information: Print ID, name, age, gender, scores of students. - Find min, max, average of scores: It consists of lines of code that perform the main function of the program: 1. Find the highest and lowest scores -> Print them. 2. Calculate average of students -> Print them. - Find result, rank, rating: Find and print them. 3.2 FLOWCHARTS According to Ned Chapin, a graphical means of recording a sequence of activities is called a flowchart (Chapin, 2003). In IT, it is often called to rewrite the sequence and the way the program works. I will draw and analyze this program as a flowchart. Function 2: Show all information of students.  Start with the value i=0.  Compare i<n. If False is returned, the program terminates. If True is returned, go to the next step.  Print information of a[i].  Increase the value of i by 1.  Return to the i<n comparison step. Function 3:Max, Min, Average.  Start with i=0 and max=a[i].  Compare i<n.  If i<n is True, compare max < a[i]. If True, max= a[i] and increase value i by 1. If False, increase value i by 1  Go back step: compare i<n  If i<n is False, print max and finishes program.  Start with i=0 and min=a[i].  Compare i<n.  if i<n is True, compare min> a[i]. If True, min= a[i] and increase value i by 1. If False, increase value i by 1.  Go back step: compare i<n.  If i<n is False, print max and finishes program. Function 5: Rank of students.  Start with i=0, y=0, sum=0, value array HD.  Compare i<n-1; - If True, compare y<n; 1. If True, compare a[i].average < a[y].average. 1.1. If True, perform HD=a[i], a[i]=a[y], a[y]=HD, increase value y and i by 1 and go back step i<n-1. 1.2. If False, increase value i and y by 1 and go back step i<n-1 2. If i<n-1 or y<n False, compare i<n; 2.1. If True print rank of student is i+1 and the program terminates. 2.2. If False, the program terminates. 4 Evaluation (D1) 4.1 Evaluate your solution • About analysis: Advantages: I have used a table to describe the data type, the loop in the most intuitive way, making it easy for the reader to understand the definition and why I use it. I also added illustrations for the explanation. Each individual function will have a different picture. Disadvantages: All its benefits have not been thoroughly analyzed. • About WBS: Advantages: Defined, draw WBS with full main functions of the program. All functions explained below. Disadvantages: Lack of extra function is Exit. • Flowchart: Advantages: Defined, draw flowcharts for all program functions and main interface, explain in detail the steps. Disadvantages: Flowchart drawn 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 are built-in functions for printing and importing. There are library declarations needed for calculations or arrays. Data types like int, float, char are for the specific objects I need like name, grades, … Gather all the necessary information in one place using a struct. Loops, switch- case and conditional statement are suitable for calculating, comparing and retrieving information in arrays. Functions are in separate places but can come together to form a perfect function. All are broken down, so it’s easy to check, repair, optimize the program. • Disadvantages: Must use a lot of functions: min, max functions are not much different but have to reprogram a lot of commands => can’s inherit command line. The entered parameter data is not cleared causing the screen to fill up. It takes many steps to implement a simple algorithm like swapping positions. • Difficulties: If there is more input, more variables and more complex algorithms are needed. If you want to optimize the algorithm, you have to revise the whole program because the functions have some association with each other => optimization is difficult.
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved