Docsity

Prog102: Procedural Programming, Schemes and Mind Maps of C programming

Toggle sidebar
bg1
ASSIGNMENT 2 FRONT SHEET
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
NgÓ Thanh Tùng
Student ID
GCH220075
Class
PROG102
Assessor name
Đặng Trần Long
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
Tung
Grading grid
P4
P5
M3
M4
D2
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Prog102: Procedural Programming and more Schemes and Mind Maps C programming in PDF only on Docsity!

ASSIGNMENT 2 FRONT SHEET

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 NgĆ“ Thanh Tùng Student ID GCH Class PROG102^ Assessor name Đặng Trįŗ§n Long 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 Tung Grading grid P 4 P 5 M3 M4 D

 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date: Lecturer Signature:

I. Introduction

1. Scenario

A math teacher wants to manage grades of a class. He asks you 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.

2. Problem

ļ‚· It is difficult and more labor intensive to calculate and sort out the student information manually. Moreover, with large amount of student information, mistakes are likely to occur. ļ‚· A system needs to be created to solve to drawback of doing it manually ļ‚· Some of the function will be included is the program is input, display, calculate, max, min and exit the program

3. Solution

ļ‚· Write the program using procedural programming ļ‚· Variables and arrays to store information and select functions ļ‚· Various function for input, print, find the highest and lowest score and exit

II. Implementation (P4, M3)

1. Explain structure of your program

ļ‚· Declaration section

  • Declare libraries: <stdio.h>: Provide the ability to input information (printf, scanf…)
  • Declare constant variable MAX with value of 50 to make the program easier to update
  • Declare variables: This section declares variables to store student information.
    1. studentNums: the number of students (up to 50)
    2. studentId: store student’s IDs
    3. grade: store student’s grades (MAX is an constant value) ļ‚· Main

2. Explain about each function of your program

ļ‚· Function ā€œmenuā€

  • This function just simply prints out the program interface ļ‚· Function ā€œinputStudentInfoā€
  • This function has 3 parameters to receive student information (studentId, grade, number of student)
  • Using the method selection sort, it changes the location of the variable inside the array studentId and grade and sort it in descending order by grade
  • Finally, it prints out the new order and the highest graded student ļ‚· Function ā€œascendingSortā€
  • This function works very similar to the function ā€œdescendingSortā€. The only thing different is it sort it in ascending order by grade and print out the lowest graded student

III. Program result (P4)

III. Testing (P5, M4)

1. Test case

A test is present base on the requirements of the problem given to check if the program functioning properly:

  • Program interface: functioning properly and display the request for the user. Consistently show the option for the user with every time finish a request.
  • Data: Data type need to be used correctly and store in the right arrays. Moreover, the test plan also includes test with off-limit number.
  • The highest / lowest grade modules: function normally, no infinitive loop or unexpected result. In addition, the program also sorts the order student descending / ascending by grade.
  • Result layout: visual – friendly and easy to view.

2. Test log

ID Test Description Test steps Test Data Expected Results Actual Results Pass/Fail 1 Check input option with valid data

  1. Choose any case Option = 1 Open function to input student information As expected Pass 2 Check input option with valid data
  2. Choose any case Option = 9 Error display As expected Pass 3 Check input number of students with valid data
  3. Choose case 1
  4. Enter number of students studentNums = 5 Show input student info As expected Pass 4 Check input number of students with invalid data
  5. Choose case 1
  6. Enter number of students studentNums = - 2 Error display As expected Pass 5 Check input student info with valid data
  7. Choose case 1
  8. Enter number of students
  9. Enter student information
  10. id = 111
  11. grade = 6. Student added to the list As expected Pass 6 Check input student info with valid data
  12. Choose case 1
  13. Enter number of students
  14. Enter student information
  15. id = 111
  16. grade = - 1 Error display As expected Pass