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

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

View Full Document Right Arrow Icon
1 Engineering Computation ENG ENG 1D04 1D04 Lecture 3: Loops in practice… Mihai Albu
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
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 ‘ α ’.
Background image of page 3

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

View Full DocumentRight Arrow Icon
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.)
Background image of page 4
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
Background image of page 5

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

View Full DocumentRight Arrow Icon
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
Background image of page 6
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];
Background image of page 7

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

View Full DocumentRight Arrow Icon
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!!!
Background image of page 8
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
Background image of page 9

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

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

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 Right Arrow Icon
Ask a homework question - tutors are online