Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 122 Engineering Computation Lab Lab 4 Dan De Sousa and Bruce Char Department of Computer Science Drexel University Summer 2009 ©By the author. All rights.

Similar presentations


Presentation on theme: "CS 122 Engineering Computation Lab Lab 4 Dan De Sousa and Bruce Char Department of Computer Science Drexel University Summer 2009 ©By the author. All rights."— Presentation transcript:

1 CS 122 Engineering Computation Lab Lab 4 Dan De Sousa and Bruce Char Department of Computer Science Drexel University Summer 2009 ©By the author. All rights reserved. Permission is given to CS122 Winter 2009 staff and students to use and reproduce these notes for their own use.

2 Your class instructor and TA Instructor for this section: Office: Email: Telephone: Your TAs are:

3 Remaining Activities Lab - Today No quiz this week Proficiency exam – Wednesday (in class)

4 Lab Parts Part 1, Sections 1.1-1.3 –Loops, If Statements, Plots Part 2, Sections 2.1-2.4 –Animations and Motion –2.4 Must Be Explained

5 Lecture Overview If Statements If If Else If Elif... Else Boolean operations

6 If Statements If statements allow programmers to choose different paths to follow in code, depending on the condition. If is true, do this. Sample Syntax: if then ; … ; end if;

7 If Statement Example If a is less than or equal to b, add a and b together.

8 If Statements If statements are different from loops. Loops repeat while a condition is true. If statements perform an action once if a condition is true. Also have the ability to branch off into multiple conditions.

9 If-Else Sample Syntax: if then ; … ; else ; … ; end if; If condition is true, perform the first set of instructions Otherwise, perform the other set of instructions

10 If-Else Example

11 If-Elif-…-Else Sample Syntax: if then ; elif then ; elif then ; : else ; end if; If condition is true, perform the first set of instructions. Otherwise if the second is true, perform the second set. So on until we get to the end.

12 If-Elif-...-Else If’s / Elif’s are processed in order from top to bottom. Similar to a piecewise, but we can specify many instructions. Good when we have many different conditions and the actions are different.

13 If-Elif-…-Else Example

14 Boolean Operations Until now, we’ve only needed to specify one condition in our loops and if statements. What if the condition depends on two things? Example: Do something if x greater than 0 and x less than 100.

15 Boolean Operations We can modify Boolean expressions in three ways: and, or, and not operations. We can use these operators in if statements, as well as for and while loops. Saw these operations in piecewise functions The result of each of these expressions: a and b: True only if both a and b are true a or b: True if at least one of a or b is true not a: Inverts (takes opposite of) the value of a

16 ‘and’ / ‘or’ We have two keywords we can use to group conditions together. and or We say: if (x > 0 and x < 100) then … end if: TrueFalse True False a and ba or b a b a b TrueFalse True False a b a b Both Must Be TrueOne Must Be True

17 Example with ‘and’ Find the number of B’s and D’s.

18 Example with ‘or’ Finds the number of out of bounds errors.

19 Proficiency Exam Information Winter 2009

20 Proficiency Exam In class exam, during regular class hour The exam counts for approximately 36% of your final grade –The exam will be in two Maple TA quizzes. One quiz will have How did I do? Turned on. One part will have it turned off. The part where it is turned off will be the multiple choice or similar questions where getting feedback would make the question useless from an evaluation viewpoint.

21 Proficiency Exam For the exam, you will do two tests in Maple TA. One quiz will have How did I do? turned on. One part will have it turned off. The part where it is turned off will be the multiple choice or similar questions where getting feedback would make the question useless from an evaluation viewpoint.

22 Proficiency Exam Questions for the exam will be drawn from past quizzes, and from a small set of new questions. This means that everyone will know what the questions could be, ahead of time. They will also be able to prepare a plan for answering them, ahead of time.

23 Practicing All questions will be posted on Maple TA in practice form starting Tuesday July 20 and running through the exam period. Lab Solutions will be available on Blackboard Vista at that time. For exam security, we will turn off access to the practice quizzes while exams are being run in the labs. Access to Blackboard Vista will be turned off during the exam, as well.

24 Exam Security During the exam You must use the laptop (be it Mac or Windows) provided. You may not use your own computer. You may use Maple Maple TA Browse www.cs.drexel.edu/complab/cs122/winter2009, which has copies of the lab directions and lecture notes. www.cs.drexel.edu/complab/cs122/winter2009 No notes or other aids Blackboard access to the course turned off during the exam

25 Exam security Computer usage will be monitored, both by visual checks by course staff and by software monitoring built into the computers you use. Unlike the labs, we will be in full “Big Brother” mode during the exam: We will be able to watch what you do, log every key stroke and mouse click, and take movies and screenshots of what you are doing.

26 A reminder about cheating Unauthorized access to information for the exam will be a violation of the Academic Honesty policy. So will accessing unauthorized information non- electronically or any other form of cheating. The minimum penalty will be a reduction in the final grade for the course. We reserve the right to give you a course grade of F with no opportunity to withdraw, or to begin proceedings to expel you from the university. If you have concerns about your grade for the course, talk to your instructor.

27 Proficiency Exam Policy If you have a conflict or are unable to attend the scheduled exam due to a reasonable medical or personal excuse, you should contact your section instructor and arrange an alternative time as soon as possible. If you miss your exam and delay contacting your instructor until after the proficiency exam week has passed, our policy will be to give you a zero for the exam.

28 What you should do now Connect to class web page: www.cs.drexel.edu/complab www.cs.drexel.edu/complab Start up Maple 12 Read Lab 4 directions. Do the work with your partner(s). Both should try to do the work, but the grader will need to look at only one answer to give you credit for doing the problem.

29 Finishing up – save files Make sure your name/user id/section number/ date,time/instructor name are on the verification sheet. Get the verification sheet signed and handed in. Save worksheet on desktop if you haven’t done so already. You can call the file “MyLab4CS122”. This will create a file called MyLab4CS122.mw. Submit a copy to Blackboard site. Email a copy to yourself and/or your lab partners as an attachment so you can look at what you did for review purposes later..mw file should open correctly on any Maple 12 (Mac, Windows, Linux) – file format is portable across system types.


Download ppt "CS 122 Engineering Computation Lab Lab 4 Dan De Sousa and Bruce Char Department of Computer Science Drexel University Summer 2009 ©By the author. All rights."

Similar presentations


Ads by Google