Download Procedural Programming Assignment 2: Implementing a Student Management System in C and more Assignments Earth Sciences in PDF only on Docsity!
Higher Nationals in Computing
Unit 0: Procedural Programming
ASSIGNMENT 2
Learner’s name: Duong Trong Qui
ID: GBS
Class: GCS1005A
Subject code: PROG
Assessor name: PHAN MINH TAM
Assignment due: Assignment submitted:
ASSIGNMENT 2 FRONT SHEET
Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 0: IT Fundamental & Procedural Programming Submission date Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Duong Trong Qui Student ID GBS Class GCS1005A Assessor name Phan Minh Tam 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 Qui Grading grid P 4 P 5 M3 M 4 D
ASSIGNMENT 2 BRIEF Unit Number and Title Unit 0: IT Fundamental & Procedural Programming Academic Year 2021 Unit Tutor Assignment Title (^) Assignment 2: Write a program and test Issue Date Submission Date IV Name & Date Learning Outcomes and Assessment Criteria Pass Merit Distinction LO3 Be able to implement procedural programming solutions LO4 Be able to test procedural programming solutions P 4 Write a program that implements the designed solution. M3 Program is written following coding standards, input data are validated D 2 Evaluate your program, state lessons learnt and future improvements. P 5 Test the program with proper test plan. M4 Analyse test results for future maintenance.
Assignment Brief Scenario: Please refer to scenario in Assignment 1. Tasks 1 Your next task is to implement the software that you designed in previous steps. You need to implement the software designed in assignment 1 using C programming language. Your code must make use of programming standards, including file headers and effective code commenting. You need to provide screenshots of your program when running. During the development of your program, if you make any changes to the original design, state them with reasons in report. Your code listings must be included as an appendix. Task 2 Test your program by making a test plan, execute it and log results. Your test plan should include data validation and program operations based on requirements. Test results (passed or failed) should be analysed to help the program in future maintenance. Task 3 Write an evaluation and conclusion of the whole development. The evaluation of your program should be based on its running and its test result. You should mention about lessons learnt and future improvement. A final report of these 3 tasks must be submitted in PDF format to CMS. Submission Format The submission is in the form of a Word document. You are required to make use of appropriate structure, including headings, paragraphs, subsections and illustrations as appropriate, and all work must be supported with research and referenced using the Harvard referencing system.
ASSIGNMENT 2 ANSWERS
I. Solve problem.
- Problem: 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, and student 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 grades and lowest grades. 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.
- Solvable problem: I write a program that is used to manage student information. The main functions of the program are:
- Input student information (Student ID, Student Grades)
- Display all student information (Print to the screen)
- Find the student who has the highest grades
- Find the student who has the lowest grades
- Exit.
- Explanation code : Global variables: Figure 1: Global variables of program
- In this program, I use 3 libraries which are stdio.h, stdlib.h and string.h
- Students for total students, ID[50] for IDs, Grade [10] for Grade. 4. Menu options:
Figure 2 : Menu option
- This menu has 5 options to choose from. If you select <1 or > 5, the input will be invalid and you will have to choose again. For example, enter the student's code and grades, view the student, identify the student with the highest or lowest grades, then exit the software.
- The switch statement is used to check the value of a variable and compare it with some situations. When a match is detected, a set of statements associated with that case are executed. If I enter a number that matches the program, the command is executed and the software moves on to the next item. If I type something else, I get an error and am taken back to the original menu.
- I use the switch case statement to allow us to execute multiple operations for the different possible values of a single variable called switch variable. Here, We can define various statements in the multiple cases for the different values of a single variable.
- Using the do-while loop, we can repeat the execution of several parts of the statements. The do- while loop is mostly used in menu-driven programs where the termination condition depends upon the end-user.
7. Display the highest grades of student: Figure 5 : Display the highest grades of student
- This code will help you to find out which student has the highest grades and display them on the screen.
- I use if conditional to determine if the condition is met or not. If it is within the allowed threshold, the computer will publish the results of the student with the highest grades from the stored list. 8. Display the lowest grades of student: Figure 6 : Display the lowest grades of student
- This code will help you find out which student has the lowest grades and display them on the screen.
- I use if conditional to determine if the condition is met or not. If it is within the allowable threshold,
the computer will publish the results of the student with the lowest grades in the archived list.
II. Result.
1. Result for the case data 1: Figure 7 : Choose the option
- We will input the proper information in this situation. To begin, the system will show you a list of 5 choices. We must choose one of them (from options 1 to 5) and add it to the menu. For example, pressing number 1 will produce a list including all of the students’ IDs and grades.
- Press 3 to see which student has the best grades and student ID in your class. It would be better if you didn't do this. If you want to find all student IDs and the lowest grades you can press 4. Figure 1 0 : Find the highest grades and IDs Figure 1 1 : Find the lowest grades and IDs
- When the program is finished, you can press the number 5 key to close and exit the program. Figure 1 2 : End the program 2. Result for case 2:
- In this case 2, I will go through some of the most common mistakes made.
- To begin with, I will make a mistake. For example, the system will prompt the user if they do not choose option 1 - option 5. Figure 1 3 : Choosing an invalid option
- Duplicate IDs force the user to re-enter their credentials each time they try to utilize them.
TC
Input choice
Enter the numb er of stude nts.
Input IDs and grade s.
Submi t. - Enter a number of student s: 5 - Enter informa tion about student s from the keyboar d - Enter student’ s ID: 123, 456, 789, 741, 369 - Enter student’ s grades: 7, 8, 6, 9, 72 - Enter a number of students : 5 - Enter informat ion about students from the keyboar d - Enter student’ s ID: 123, 456, 789, 741, 369 - Enter student’ s grades: 7, 8, 6, 9, 72 Failed Rety pe grad es 72 to 5. TC 2
Input choice
Submi t.
| ID: 123
| Grade: 7 | | ID: 456 | Grade: 8 | | ID: 789 | Grade: 6 | | ID: 741 | Grade: 9 | | ID: 369 | Grade: 5 | Passe d
TC
Input choice
Submi t. Find students ’ who has the highest grades Passe d TC 4
Input choice
Submi t. Find students ’ who has the lowest grades Passe d TC 5
Input choice
Submi t. Failed Try other num ber (1-5) TC 6
Input choice
Submi t. Enter number of student: 31 and - 5 Failed Try num ber in rang e ( 3 - 30) TC 7
Input choice
Submi t. Enter number of student: 1 Enter Student s’ ID: GBS 716 Enter student’ s grade: 6
|ID:
GBS
|Grade: 6| Failed Don’t type the work s
b. Disadvantages:
- The application will report an error when entering the wrong data types, you can see that when you enter a student ID with a character types, the application will report an error.
- The menu interface is not finished beautifully.
- Infinity loop when entering IDs with words. Although there are still many errors that have not been fixed, basically my application has met the basic needs of a student management software, the rest I will fix in the near future. REFERENCES
- Anon, 2018. C language. [Online] Available at: https://www.techopedia.com/definition/24068/c-programming-language-c [Accessed 22 June 2022].
- Bhatia, S., 2021. Procedural Programming [Definition]. [Online] Available at: https://hackr.io/blog/procedural-programming [Accessed 21 June 2022].
- Martin, M., 2021. What is Computer Programming? Basics to Learn Coding. [Online] Available at: https://www.guru99.com/computer-programming-tutorial.html [Accessed 2 4 June 2022].
- S. C. Johnson and B. W. Kernighan, 1973. Development of C. [Online] Available at: https://www.bell-labs.com/usr/dmr/www/chist.pdf [Accessed 20 June 2022].
- C Language: Standard Library Functions - string.h [Online] Available at: https://www.techonthenet.com/c_language/standard_library_functions/string_h/index.php [Accessed 19 June 2022].
- C – math.h library functions [Online] Available at: https://fresh2refresh.com/c-programming/c-function/c-math-h-library-functions/ [Accessed 20 June 2022].
- C Programming/string.h/Function reference [Online]
Available at: https://en.wikibooks.org/wiki/C_Programming/string.h/Function_reference [Accessed 21 June 2022].
- What is Data Dictionary [Online] Available at: https://www.tutorialspoint.com/What-is-Data-Dictionary [Accessed 22 June 2022].
- Is stdio.h a library? [Online] Available at: https://stackoverflow.com/questions/57718289/is-stdio-h-a-library [Accessed 22 June 2022].
- stdio.h — Standard input and output [Online] Available at: https://www.ibm.com/docs/en/zos/2.3.0?topic=files-stdioh-standard-input-output [Accessed 22 June 2022].
- Farrel, J. (2019). Java™ Programming. 9th ed. Boston: Cengage, pp.50- 51 1 2. Gookin, D. (2004). C for Dummies. 2nd ed. Hoboken: Wiley Publishing, Inc., pp.147- 239