1. Trang chủ
  2. » Công Nghệ Thông Tin

Assignment 2 Procedural Programming (PROG102)

17 22 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Assignment 2 Procedural Programming
Tác giả Bui Quang Minh
Người hướng dẫn Phan Thanh Tra
Trường học Btec
Chuyên ngành Computing
Thể loại assignment
Định dạng
Số trang 17
Dung lượng 2,6 MB

Nội dung

Môn học này đóng vai trò quan trọng trong việc cung cấp cho người học sự hiểu biết sâu rộng về các nguyên tắc cơ bản trong lĩnh vực Công nghệ Thông tin (CNTT) và Lập trình. Những kiến thức được truyền đạt trong khóa học không chỉ là nền tảng vững chắc cho việc tiếp cận và hiểu rõ sâu sắc về CNTT mà còn giúp học viên phát triển kỹ năng lập trình đặc biệt.

ASSIGNMENT FRONT SHEET Qualification BTEC Level 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 Bui Quang Minh Class GCD1104 Student ID GCD210325 Assessor name Phan Thanh Tra 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 D2  Summative Feedback: Grade: Lecturer Signature:  Resubmission Feedback: Assessor Signature: Date: Table of Contents I IMPLEMENTATION (P4, M3) STRUCTURE OF PROGRAM 1.1 DECLARATION PART 1.2 EXECUTABLE PART FUNCTIONS 2.1 FUNCTION “checkIdExist”: ……… 2.2 FUNCTION “viewAll” ……………… 2.3 FUNCTION “maxGrade” and “minGrade” 2.4 FUNCTION “findSameGrade” IMPORTANT ALGORITHMS PROGRAM RESULTS II TESTING (P5,M4) 12 TESTING THE PROGRAM 12 ANALYZE TEST RESULTS 14 III EVALUATION (D2) 14 PROGRAM 14 PROCEDURAL PROGRAMMING … 15 ASSIGNMENT I Implementation (P4,M3) Structure of your program: DECLARATION PART 1.Libraries 2.Function 3.Local variables (in main) EXECUTABLE PART Main function Function definition Explain functions: Function “checkIdExist”  This function is used to check if the teacher entered the ID that was typed before So, to make sure that there is no ID repeated  IDs[50] and i are parameters, currentId is a local variables  I create the for loop to check the ID which just entered with IDs[i] entered  If currentId == IDs[i] returns true, teacher has to enter again, and if it returns false, the program continues It is used when entering the ID (To avoid repeating ID) Function “viewAll”  This function is used to view the list of student IDs and Grades  I create the for loop with printf() to repeat printing out one by one the value of arrays until the loop equals to the number of students that the teacher entered  I used margin to make printing more accurate such as %.3f It is used when teacher selects option “view all student IDs and Grades” Function “maxGrade” and “minGrade”  These functions are used to find the highest grade and lowest grade  Firstly, I attach the first student to maxGrade and minGrade  Then, I use a for loop from student numbered to student numbered n-1 to check, if it is true with the condition, I attach the student i information as maxGrade and minGrade It is used when teacher selects option “view the highest and lowest grade” Function “findSameGrade”  This function is used to find if there is a grade that is equal to the highest or lowest grade depending on the options  I create a for loop to check every grade in the array compared to max and found before  If it is true, the program prints every ID it found out It is used when teacher selects option and “view all the IDs that having highest and lowest grades” Maxgrade and mingrade were saved and this function is used to find the IDs having the same grades Important algorithms: - When entering the number of students, IDs, grades, and options Do while loop is used to limit the value of them - In function “checkIdExist”, the current ID will be checked and compared to IDs typed before If they are the same, return true and if they are different, return false - In function “maxGrade” and “minGrade”, the for loop is used to find the highest and lowest grades, they are compared to every grade in array If they find the value, it will be assigned (max or min) - In function “findSameGrade”, when the highest and lowest grades are found, this function is used to find IDs having those grades Every grade in array will be compared to max and min, and then print them Program results When the teacher runs the program, it requires him to enter number of students on the screen and he has to enter ID and grade of every student When the teacher enters option 1, the program will display all the student IDs and grades on the screen When the teacher enters option 2, the program will display the highest and lowest grades When the teacher enters option and 4, the program will display student IDs which have the highest and lowest grades II Testing (P5,M4) testing the program: Test Test Case Content Enter wrong number of students (0->50) Enter wrong choice (1>5) Test Data Enter numbers > 50 and 5 and 10 and

Ngày đăng: 02/02/2024, 09:46

TỪ KHÓA LIÊN QUAN

w