Docsity

Procedure Programming (Pro102) ASM2, Study Guides, Projects, Research of Information Technology

Toggle sidebar
bg1
1
ASSIGNMENT 2 FRONT SHEET
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
PROG102: Procedural Programming
Submission date
10/9/2021
Date Received 1st
submission
Re-submission Date
Date Received 2nd
submission
Student Name
Dang Nguyen Dang Khoi
Student ID
GCC200058
Class
GCC0903
Assessor name
Le Huynh Quoc Bao
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
Khoi
Grading grid
P5
M3
M4
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19

Partial preview of the text

Download Procedure Programming (Pro102) ASM2 and more Study Guides, Projects, Research Information Technology 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 10/9/2021 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Dang Nguyen Dang Khoi Student ID GCC

Class GCC0903 Assessor name Le Huynh Quoc Bao

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 Khoi

Grading grid P 4 P 5 M3 M4 D

 Summative Feedback:  Resubmission Feedback:

GLecturerrade: (^) Signature: Assessor Signature: Date:

  • II. The changes is with to the original design.
  • III. Test the program with proper test plan.
  • IV. Analyse test results for future maintenance.
  • V. Evaluate my program, lessons learnt and future improvements.
      1. Evaluate my program.............................................................................................
      • a. Advantages
      • b. Disadvantages.........................................................................................................................
      1. Lessons learnt.
      1. Future improvements.
  • VI. Appendix

Assignment 2 Brief

I. 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.

II. Tasks

1. Task 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.

2. 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.

3. 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.

c. User choices Print student ID and student grade to the screen. Then return menu

selection and continue choice one of selections of me

d. User choices Finding max grade, and print it to the screen. Then return menu

selection and continue choice one of selections of menu.

e. User choices Finding min grade, and print it to the screen. Then return menu

selection and continue choice one of selections of menu.

f. User choices Exit. Then exit the program.

2. Exceptions case

a. User doesn’t choice one of selections of program. The program will error

notification in the screen and user must choice one of selections of program again.

d. User enters student ID was used. The program will error notification in the screen

and user must enter another student ID.

II. The changes is with to the original design. In the menu selection and functions of program, each when user opens program or wants to change student information. For example: add and delete student ID and student grade. User can choose function enter student information. So we can cancel selections: add and delete student’s ID and student grade in menu selection. This will help program is simpler, omitted the functions don’t use and user is easier to use program. III. Test the program with proper test plan.

Test Plan

Creator: Dang Nguyen Dang Khoi.  Create Date : 10/9/

No. Test case Function Input Data Expected output Actual output Result

Verify that Student information will save into array if user enters

Input student ID and grade.

  • Enter number of students: 3 - Student ID 1: 1 - Student grade 1: 7
  • Student ID 2: 2
  • Student grade 2: 8

Student information save into array: ID[]={1,2,3} Grade[]={7,8,9}

Student information save into array: ID[]={1,2,3} Grade[]={7,8,9}

Pass

valid information.

Student ID 3: 3 - Student grade 3 : 5

Verify that “Please enter number of student is greater than zero ” is displayed if user enters number of student with negative number.

Input student ID and grade.

  • Enter number of students: - 1

Display error message “Please enter number of student is greater than zero”

Display error message “Please enter number of student is greater than zero”

Pass

Verify that “You must not enter character. Please enter number of student is greater than zero ” is displayed if user enters

Input student ID and grade.

  • Enter number of students: a

Display error message “You must not enter character. Please enter number of student is greater than zero”

Program doesn’t display error message “You must not enter character. Please enter number of student is greater than zero”

Fail

” is displayed if user enters student’s grade with character.

Verify that “You must not enter character. Please enter student ID is number” is displayed if user enters student ID with character.

Input student ID and grade.

  • Enter number of students: 3 Student ID 1: a

Display error message “You must not enter character. Please enter student ID is number”.

Program doesn’t display error message “You must not enter character. Please enter student ID is number”.

Fail

Verify that “This student ID was used. Please enter another student ID” is displayed if user

Input student ID and grade.

  • Enter number of students: 3 - Student ID 1: 1 - Student grade 1: 7
  • Student ID 2: 2
  • Student grade 2: 8
  • Student ID 3: 1

Display error message” This student ID was used. Please enter another student ID”.

Display error message” This student ID was used. Please enter another student ID”.

Pass

enters student ID was used.

Verify that “Invalid number. Please choice number from 1 to 5” is displayed if user enters choice is different number from 1 to 5.

Input the choice Enter choice: 7 Display error message “Invalid number. Please choice number from 1 to 5”

Display error message “Invalid number. Please choice number from 1 to 5”

Pass

Verify that “Invalid. Please choice number from 1 to 5” is displayed if user enters choice is character.

Input the choice Enter choice: / Display error message “You must not enter character. Please choice number from 1 to 5”

Program doesn’t display error message “You must not enter character. Please choice number from 1 to 5”

Fail

when user enters choice is 3 , program will display Student ID has max grade and highest grade.

  • Student ID has max grade is : 3
  • Highest grade: 9 - Student ID has max grade is : 3 Highest grade: 9

Verify that when user enters choice is 4, program will display Student ID has min grade and lowest grade.

Input the choice Enter choice: 4 Display:

  • Student ID has min grade is : 1
  • Lowest grade: 7

Display:

  • Student ID has min grade is : 1
  • Lowest grade: 7

Pass

Verify that when user enters choice is 5, program will exit.

Input the choice Enter choice: 5 Exit the program. Exit the program.

Pass

IV. Analyse test results for future maintenance.

No. Test case Function Result Evaluation

1 Verify that Student information will save into array if user enters valid information.

Input student ID and grade.

Pass The program runs quite fast, stable, exactly what is programmed.

2 Verify that “Please enter number of student is greater than zero” is displayed if user enters number of student with negative number.

Input student ID and grade.

Pass The program runs quite fast, stable, exactly what is programmed.

3 Verify that “You must not enter character. Please enter number of student is greater than zero” is displayed if user enters number of student with character.

Input student ID and grade.

Fail Number of student is number, so in the future, I will use function “Int isdigit(int c)” to check, then warn, and allow user enter number of student again if user enter is character. 4 Verify that “Please enter student grade from 0 to 10” is displayed if user enters student’s grade with negative number or number is greater than 10.

Input student ID and grade.

Pass The program runs quite fast, stable, exactly what is programmed.

5 Verify that “You must not enter character. Please enter student grade from 0 to 10” is displayed if user enters student’s grade with character.

Input student ID and grade.

Fail Student grade is number, so in the future, I will use function “Int isdigit(int c)” to check, then warn, and allow user enter student grade again if user enter is character. 6 Verify that “You must not enter character. Please enter student ID is number” is displayed if user enters student’s ID with character.

Input student ID and grade.

Fail Student ID is number, so in the future, I will use function “Int isdigit(int c) ” to check, then warn,

V. Evaluate my program, lessons learnt and future improvements.

1. Evaluate my program.

a. Advantages

 The program is designed with a simple interface, so it helps user easy for users to use.  The program runs quite fast, stable, and not waste lots of resources.  The functions of program run exactly. It helps user enter and print student ID and grade, and find max and min grade of student in class.

b. Disadvantages

 The program always error if user enter character in input steps, for example: enter number of student, choice, student ID, and student grade.  The program still has quite little function.

2. Lessons learnt.

When design and create a program, we need make a clearly plan. First of all, we need identify the program has how many functions and what functions are those? Second, we need identify variables, data type for variables, and statements are used in program. Third, we need design diagram use case for program, and flowchart for each function of program. Four, we need to write code for program. When we are writing code, we should be careful little by little. Finally, we should test program, find, and fix error if having.

3. Future improvements.

In the future, I will use function “Int isdigit(int c)” for program to check, then warn, and allow user again if user enter is character. In addition, I will add some functions to the program, for example: find average of all student, and print list student grade and student ID respectively in order from highest to lowest.

VI. Appendix

#include<stdlib.h> #include<stdio.h> #include<string.h>

void main() { /* Declare array and variables/ int choice=0,n; // Variables for user input to select menu features and number of students to input// int StID[20]; // The array to storage student's IDs// float StGrade[20]; // The array to storage student grade// / Display menu in the screen/ do { printf("\n\n==============Menu================\n\n"); printf("1. Enter student ID and grade\n"); printf("2. Print student ID and grade\n"); printf("3. Finding max grade\n"); printf("4. Finding min grade\n"); printf("5. Exit\n\n"); fflush(stdin); / Warning to user choice 1 to enter student information if they using the program for the first time/ printf(" If you use the program for the first time or want to change student information. Please select 1 to enter student IDs and grade before selecting other program features\n\n"); / User choice one of selections of program/ printf("Enter choice:"); scanf("%d",&choice); printf("\n"); / Start loop and perform the selection of program*/