# Lecture3 - Engineering Computation ENG 1D04 ENG 1D04...

This preview shows pages 1–10. Sign up to view the full content.

1 Engineering Computation ENG ENG 1D04 1D04 Lecture 3: Loops in practice… Mihai Albu

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
3 Problem… • Present a report of results from ENG1D04 students that received marks for the first assignment. • The report must: – Show the frequency of each mark – Show the number of student with marks in top 90% – Show the average mark of students starting with letter ‘ α ’.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4 Analysis • Data: – 475 students – 1 assignment; marks need to be retrieved – I need student data as well (name, etc.) – I assume all data are available from somewhere (text file). • Special cases – Maybe some missing (or didn’t submit it it time… f ) => I need to count the actual nr. of students that submitted. – Late submission??? =>special case(mark it with 0, subtract 5 marks, give full marks, etc.)
5 Retrieve data Data: name, student id… Solution: ask Jeanne Norris (1 method for 475 students) So, use a method: studentID = PleaseRetrieveStudentData(index) Input: index Output: studentID

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
6 Retrieve Mark Data: student mark Solution: ask TAs (1 method for 475 students) So, use a method: student_mark = PleaseRetrieveMark(studentID) Input: studentID Output: student_mark
7 Create Report 1 Show the frequency of each mark by the number of students studentID = PleaseRetrieveStudentData(i+1) student_mark = PleaseRetrieveMark(studentID) Marks[student_mark] ++ Print (Marks[j] / 475) For (i = 0; i < 475; i ++) //all students For (j = 0; j <= 50; j ++) //all possible marks Is it correct/enough? 461 50 7 49 6 48 0 2 0 1 1 0 Counter (array values) Marks (index of array) int Marks = new int[51];

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
8 Addition - general • Consider variable number of students => total_students = GetStudentsNumber() • Consider variable marking scheme max_mark = GetMaximMark() Universal solution!!! (does not depend on a specific number of students or marking scheme) Take into account all possible input scenarios!!!
Addition – special cases • Check for students that submitted the assignments => bAnswer = DidStudentSubmitAssignment(studentID) o True o False • Count the number of students that submitted the assignment! => nStudentsSubmitted

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 35

Lecture3 - Engineering Computation ENG 1D04 ENG 1D04...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online