Docsity

Procedural-Programing-------------------, Assignments of Human Development

Toggle sidebar
bg1
ASSIGNMENT 2 FRONT SHEET
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
Unit 0: Procedural Programming
Submission date
23/10/2020
Date Received 1st
submission
23/10/2020
Re-submission Date
Date Received 2nd
submission
Student Name
Le Trong Trung
Student ID
GCH190392
Class
Assessor name
Nguyen Dinh Tran 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
Trung
Grading grid
P4
P5
M3
M4
D2
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Procedural-Programing------------------- and more Assignments Human Development in PDF only on Docsity!

ASSIGNMENT 2 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title Unit 0 : Procedural Programming

Submission date 23/10/2020 Date Received 1st submission 23/10/

Re-submission Date Date Received 2nd submission

Student Name Le Trong Trung Student ID GCH

Class Assessor name Nguyen Dinh Tran 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 Trung

Grading grid

P4 P5 M3 M4 D

Summative Feedback:Resubmission Feedback:

Grade: Assessor Signature: Date:

Lecturer Signature:

I. Sceenshot & Explain

1. Problem. 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. Solve problem.

  • I write a program is used to manage student information.
  • The main functions of program is:
  • Input student information (Student ID, Student Grades)
  • Display student information (Print to the screen)
  • Find the student has highest grades
  • Find the student has lowest grades 3. Development process.  Global variables:
  • Used to declare variables to be used in the program. Figure 1. Global variables of program.

 Menu Options:

  • Helps to display more options in the menu.
  • Ex: input student ID&grades, view student, find the highest or lowest grades of student, exit program. Figure 2. Menu Options of program.

 Function find the highest grades of student:

  • Help you find the student has highest grades and print to the screen. Figure 5. Find the highest grades of student.  Function find the lowest grades of student:
  • Help you find the student has lowest grades and print to the screen. Figure 6. Find the lowest grades of student.

4. Sceenshot.  Menu Options:  Enter student’s information(2-10): Figure 8. Input information of student Figure 7. Menu Options.

 Find the lowest grades of student: Figure 11. Find the lowest grades of student.  Exit program: Figure 12. Exit program

II. Test plan Test case What is being test How Data Expected Result Result Evaluate 1 User input selection Int choice Range:1- 5 Try to input boundary data, typical data, bad data A,b,c,,&… Typical data(1,2,..) Decimal in typical data(1.1,1.2…) Bad data(statement) Boundary data Error Accepted Error Error Error Error Accepted Accepted Error Accepted Pass Pass False Pass Pass 2 Input the number of student ID[10] Try to input boundary data, typical data, bad data A,b,c,,&… Typical data(1,2,3..) Decimal in typical data(1.1,1.2…) Bad data(statement) Boundary data Error Accepted Error Error Error Error Accepted Accepted Error Error Pass Pass False Pass Pass 3 Input the student ID Int ID[10] Try to input boundary data, typical data, bad data A,b,c,*,&… Typical data(1,2,3..) Decimal in typical data(1.1,1.2…) Bad data(statement) duplicate with the Error Accepted Error Error Error Accepted Accepted Accepted Accepted Error Flase Pass False False Pass

III. Evaluation of code After testing and checking my application error, I found that my application has many shortcoming such as:

  • Application will error when entering the wrongs data types, you can see when I entered ID student with types charactes, application will error.
  • Menu interface is not completed beautifully Although there are many errors that have not been resolved, But basically my application has met the basic need of a student management software, the rest I will fixed in the future. IV. Code of program #include <stdio.h> #include <stdlib.h> #include <string.h> int IDs[10]; int n; float Grades[10]; void input() { int i = 0; int j; do { printf("%d. Enter student's ID: ",i+1); scanf ("%d", &IDs[i]); for (j=0;j<i;j++) while (IDs[i]==IDs[j]) { printf ("Dublicate ID, please enter again \n"); printf("%d. Enter student's ID: ",i+1); scanf ("%d",&IDs[i]);

do{ printf("%d. Enter grade's student: ",i+1); scanf("%f", &Grades[i]); if (Grades[i]<0|| Grades[i]>10){ printf ("Enter a wrong grade for the student, please enter again \n"); } }while (Grades[i]<0|| Grades[i]>10); i++; } while (i < n); } void Display() { int i=0; do { printf("Students ID: %d\n| Grades:%.2f\n", IDs[i],Grades[i]); i++; } while (i<n); } void maxGrades () { int maxID = IDs[0]; int i;

if (Grades[i] == min){ printf("Student has lowest grades: %.2f | ID: %d.\n", min,IDs[i]); } } } int main () { int choice; do{ printf (" 1. Input student's ID & Grade\n"); printf (" 2. view student's ID & Grade \n"); printf (" 3. Find student's who has highest grades \n"); printf (" 4. Find student's who has lowest grades \n"); printf (" 5. Exit program \n "); printf ("Pleas...Input your choice: "); scanf ("%d",&choice); switch (choice){ case 1: do { printf("How many students do you want to enter(2-10): "); scanf("%d", &n); if (n<2 || n>10){ printf (" Enter the wrong student number, please enter again: \n"); } } while (n<2 || n>10);

input(); system("cls"); break; case 2: printf("view student's ID & Grade\n"); system("cls"); Display (); break; case 3: printf("Find student's who has highest grade\n"); system("cls"); maxGrades (); break; case 4: printf ("Find student's who has lowest grades \n"); system("cls"); minGrades(); break; case 5: printf ("Exiting program ... \n"); exit(0); system("cls"); return 0; break; default: