












Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!













Learner’s name: Tran Quang Hien ID: GCS Class: GCS1003A Subject code: PROG Assignment due: Assignment submitted:
ASSIGNMENT 2 FRONT SHEET Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Prog102: Procedural Programming Submission date 06 / 03 /2022 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Tran Quang Hien Student ID GCS Class GCS1003A Assessor name Le Ngoc Thanh 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 P4 P5 M3 M4 D
Unit Number and Title 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 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. Also evaluate how procedural programming is applied in your program, state benefits, disadvantages or difficulties. 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.
P4, M3. Implementation and program result Introduction to computer programming language
1. Structure of my program First and foremost, it is difficult to respond to all of the requirements from the Math teacher using simply the primary function. As a result, I'll need to divide my software into several functions to do this. Each feature is played by one function, and all features support each choice, allowing the instructor to manage the students' grades. Now I'll go over each function one by one. 2. Each function 2.1 Global variables Figure 1: Global variables of my program #include stdio.h> is a preprocessor command that instructs a C compiler to include the stdio.h file before proceeding to real compilation. The #includestdlib.h> header specifies four variable types, many macros, and different functions for performing general functions on the second line. Variables: Key, array Name, array Id, array Grade, n, i, function PrintMenu, function InputStudentInfo, function Show(), function Max(), function Min().
Figure 2: Function main of my program First, print the menu and show the user their options. Do... While loops help me to regulate the condition when I want to repeat anything and scan the key to choose my option. Switch...case statement is used to pass an integer from the keyboard into another function(Example: if we press number 2, it means our option is Show, then we are moved to function Show).
Figure 3: Function PrintMenu of my program
Same as InputStudentInfo function, I use for loops to display all students that the user has input.
Figure 6: Function Max of my program Float max as Grade[1] (The highest grade is the first student’s grade). Then I use for loop from 1 to n, then it looks at each grade in the list. If the grade it is looking at is larger, it becomes the highest. Finally, the variable "highest" holds the highest grade and print that variable.
Figure 7 : Function Min of my program
Float min as Grade[1] (The lowest grade is the first student’s grade). Then I use for loop from 1 to n, then it looks at each grade in the list. If the grade it is looking at is lower, it becomes the lowest. Finally, the variable "lowest" holds the highest grade and print that variable. 3. Some coding standards used in the program We should follow some code standards rules as Network Developers. Naming the module or title meaningfully also makes it easier for developers and debuggers to comprehend and maintain the code. The Module Name, the Note, the Date the Module Was Created, and the Author of the Specific Module must all precisely adhere to them. Local variables, global variables, constants, and functions are all named in a way that helps readers comprehend the written escape code. Local variables must be named with a non-capital letter in a camel uppercase character format. Global variables, on the other hand, must begin with a capital letter, maybe a camel capital. For a better visual interface, avoid using digits in variable names and provide some space between encoding/method/header/class. The lesser the coding complexity, the easier it is to maintain or even develop, since the more complicated the code is, the more difficult it is to maintain or even create. Especially when it comes to script debugging. Add some comments to your program to make it easier to comprehend. The length of the coding should be kept to a minimum. Every function should have a time restriction. Simply break down the large work into smaller portions and do it. The goal of the coding courses is to boost software productivity while also reducing development time. Errors can be easily tracked and error kinds identified. Remove encryption's unanticipated hidden costs. Always prefix one interface line to line P5, M4. Testing
1. Test plan Test case Action Test input What I expect Test output Result Analyze 1 Run the program N\A Display the menu The program runs and the menu is display Pass Function Menu do their jobs when function main call 2 Use input integer Try to press number 2 first and then press number 1 When input number 2 the program will require the user to input their choice again Require user to choose again Pass It works successfully because of my show function, it can’t print student info while the user didn’t input it, and at the end of each function, the program will automatically scan the user’s next option 3 User try to input words or alphabet Press any button except integer The program will announce an error and require the user to input again It was being lagged and we can not control it anymore Fail I see it will be a big problem for the user, I think that I need to fix it and add the feature for warning users when they don’t input integer
2. Screenshots of the program running
Figure 8 : Display menu After launching the software, this is the screen that displays the selection list.
Figure 9: Try to input the user’s choice To begin entering student information, press the number 1 on the keyboard and press enter. A question regarding the number of students to enter will come on the screen; simply input the number of students and their details. The result will show a list of students with each student including id and score.
Figure 10: Try to input words instead of integer I tried typing a few letters instead of an integer and pressing enter after selecting the student information input option, but the screen doesn't show anything. Figure 10 is an example.
Figure 11: When I choose option 1 and input information of 3 students After running the application, the program presents the alternatives. I needed to enter student information, so I pressed 1 on the keyboard and then entered. Next, the program asks how many students I want to enter. I enter
number 1 on the keyboard and press enter. Next, the program will ask again how many students I want to enter. I enter the number of students as one, and the application then asks for the student's id and grade. After I've submitted a sufficient amount of data in the correct format, I can move on to the next step.
Figure 14: Print the highest grade I want to see who has the highest grade, so I press number 3 on the keyboard and enter after entering and publishing student information on the screen. The program will then show me the student with the best grades. 2 .8 Test case 8 Figure 15: Print the lowest grade I want to see who has the lowest grade, so I press number 4 on the keyboard and enter after entering and
publishing student information on the screen. The program will then show me the student with the lowest grades. 2 .9 Test case 9 Figure 16: Exit program When you've made all of your choices, press the number five key on the keyboard to exit the software. D2. Evaluation
1. Evaluation of the implementation process compared to the design of Assignment 1 After I've completed my execution, I'd want to make some observations about it in comparison to the initial design I created for Assignment 1: First, as with the design in assignment 1, the data types I use in the code are int and float variables to hold integers and my actual values have not changed. The float variable has also been used to announce the student's highest grade, the lowest grade, and overall grade. Next, in terms of code selection structures, I utilized the switch case structure to create a menu of five options. I successfully produced all of the possibilities, but there is one thing I can't do: if the selection is one of the other five options, the program will display an "Incorrect entry, please re-enter" notice on the screen. That is the sole variation in selection structure between Assignment 1 and Assignment 2 following execution. The third point is concerning the iteration structure, which has not changed from Assignment 1. I've inserted student information such as grades and IDs into a for loop, and I've also used it to find the highest and lowest grades. I've also had success with the do-while structure; the "options" function displays a menu of alternatives, while the "YourChoice" function allows the user to select their preferred option. Last but not least, that is the function in my program, all of which I have successfully implemented with the exception of functions 6 and 7. I can print out the scores of the students with the highest and scores lowest, but I am unable to determine who has the highest/lowest score. That's all I have to say about how Assignment 2 was carried out for assignment 1. 2. State lessons learned and future improvements 2 .1 Lessons learned After executing and testing my software, I discovered that it is rather basic and has several problems. What I mean is that some of the features haven't lived up to my expectations. I can't add more students or update their
REFERENCES