Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS1321: Introduction to Programming Georgia Institute of Technology College of Computing Lecture 3 Aug. 28, 2001 Fall Semester.

Similar presentations


Presentation on theme: "CS1321: Introduction to Programming Georgia Institute of Technology College of Computing Lecture 3 Aug. 28, 2001 Fall Semester."— Presentation transcript:

1 CS1321: Introduction to Programming Georgia Institute of Technology College of Computing Lecture 3 Aug. 28, 2001 Fall Semester

2 Today’s Menu 0. Turn in your HW2 assignment 1.Academic Misconduct 1.5 Website and Recitation info!! 2. Let’s go over some HW problems! 3. One more example

3 0. HW 2 must be turned in now Turn in your Homework! Once I start you cannot turn it in.

4 1. Academic Honesty The following slides were originally prepared by Dean Karen Boyd.

5 Dear [CS1] Students, Be forewarned about the consequences of cheating in [CS1], and give them serious thought. In the end your costs strongly outweigh your benefits. Even though the class can be confusing and sometimes even overwhelming, you must not let your frustration get the best of you. When and if you are still unsure just turn in what you have, don’t take the risk of copying someone else’s work. Taking the attitude that you are invincible and that you will never get caught could land you in the Dean’s office at the end of the quarter. So don’t take the cheat finder lightly because it really does exist (for homework and lab projects!) Unfortunately, as a former [CS1] student, I can personally assure that if you are going to cheat you are going to pay a heavy toll for it. “Smart people learn from their own mistakes, geniuses learn from other’s mistakes.” Sincerely, Anonymous CS 1 Student

6 CS1 & CS2 Academic Misconduct Statistics for Fall of 1998 : 22 students were found responsible for violating the student Honor Code 15 students received an F for the course 4 students received a lowered grade 17 students served community service hours 16 students were placed on university probation

7 Student Misconceptions About Academic Integrity: “Cheating is only stealing answers off a test.” “You can’t cheat on homework.” “ It’s okay to work together; it will help me understand the material better.” “ If I work on a problem and can’t get the answer on my own, then it’s okay to get the help from somewhere else- such as "word" or another person- just as long as I tried hard.” “ The definitions of cheating are universal from one professor to another.”

8 What Is Cheating? Cheating is gaining an unfair advantage over others and/or misrepresenting yourself on your work for academic gain. The intent to cheat is not a prerequisite for cheating to occur. Who determines what is cheating in a course? THE INSTRUCTOR

9 CS Expectations: Don’t talk about or show your work Talk about general concepts, not specifics Use “word” only as a tool or resource Group projects on homework or programs are not acceptable Don’t attend a TA-student meeting with other students Don’t share a tutor Read your syllabus on the web

10 How to Avoid Trouble in CS1 Don’t show or look at other’s work Don’t take someone else’s work Don’t think that others are getting away with cheating so maybe you should try it. Don’t ever copy from “word” or web sites - This is plagiarism! Cite anything you did not write (e.g., recitations/lecture/review sessions). Be honest and helpful if your name appears in an investigation Do everything you can to protect yourself

11 Protect Yourself… Try not to copy a file to a community computer Remove all copies from files, directories, desktops and anywhere else Don’t ever make a CS file a shared file Wait at the printer until all copies are printed Never give out your password or a clue to the password Have a password that protects your personal computer Hide all of your disks Don’t ever trust your roommate with your computer files Don’t forget to remove the file from the recycle bin

12 The Cheatfinder It is REAL! It is not an urban myth Changing names, reordering sections and adding blank spaces will not fool the computer. The computer compares the code which should be dissimilar.

13 Why Should You Follow These Expectations? The Consequences Are Serious: F in the course is probable University probation Mandatory participation in community service hours Loss of Hope Scholarship or any other scholarship Lowered GPA- with possible probation or even expulsion from the university Loss of job opportunities Possible ineligibility for the co-op program

14 “When I Signed the Honor Code, it seemed insulting in an odd way. After all, no one considers themselves dishonest or a “cheater.” However, when a student becomes over- burdened with the workloads and deadlines, some of the important promises made within the honor code can become overlooked. Concern for a “check mark” or credit for a problem has over-ridden the importance of understanding the material. You may have violated the honor code without even stopping to think. After four years at tech, [unfortunately I chose to use "word" instead of working the problem out on my own.] Instead of having the self-trust of my abilities, which might have meant getting a lower grade, I chose to improperly represent my understanding of a problem. Not only did embarrassment come after someone realized what I had done, but also I suffered the consequences from a mistake that I could have easily avoided had I taken the extra time to think independently. I have some advice for you newcomers: make good, SMART use of your resources and most of all, TRUST YOUR MIND rather than someone else’s…in the long run, you WILL come out ahead.” -- former CS1 student

15 Academic Integrity DO’S If instructions are in writing, read and follow them. Protect yourself and your work. Keep your password private. Ask your TA for help Tell the truth when asked. Avoid sections with a sibling, significant other or friend and do not go to help sessions together. Turn in accurate reflections of your knowledge.

16 Academic Integrity DON’TS Trust "word"- it is not always right. Copy another’s work Look at someone else’s work. Consider your tutor to be the same as your TA- they cannot look at your work either. Share a tutor, especially to review your homework. Use someone else’s work and try to amend it with added white space or reordered sections, etc- It will NOT fool the cheatfinder. Share anything electronically with another student. Help you friends- it does not help them in the long run.

17 Phew! Seriously, I turned in 22 or so students last semester to Karen Boyd, Dean of Students, for suspicion of academic misconduct. This is not a joke.

18 1.5 CS1321 Website New and improved Proves once again less is really more!! HW Skeleton HW Example Let’s have a look…

19 1.5 Your Recitation Start this week! Do not use Oscar info! Those rooms are not correct (times are) Check your gt****@prism.gatech.edu email for your correct room location.gt****@prism.gatech.edu

20 2. Your Homework, in gory, painful detail No, you can’t wait until after I’m done to turn it in…

21 Problem #1 Your mission in this particular function was to create a function that consumed a value in units Celsius and produce an equivalent number in units Fahrenheit.

22 Problem #1: The Design Recipe Approach ;; Data Analysis & Definitions: ;; What does the data analysis look like?

23 Problem #1: Design Recipe Continued ;;Contract: Celsius->Fahrenheit : number -> number What does the contract look like?

24 Problem #1: Design Recipe Continued What does the purpose look like? ;; Purpose: ;; This function converts a Celsius temperature ;; to a Fahrenheit temperature

25 Problem #1: Design Recipe Continued What does the template section look like? ;; Template: ;;

26 Problem #1: Design Recipe Continued What does the Examples section look like? ;; Examples: ;; (Celsius->Fahrenheit 0) should produce 32 ;; (Celsius->Fahrenheit –40) should produce –40 ;; (Celsius-> Fahrenheit 100) should produce 212 How many examples do we need?

27 Problem #1: Design Recipe Continued How do I define the bloody thing? Well, we have a formula: C = (5/9) (F – 32), where C is Celsius and F is Fahrenheit Some quick math gives us: F = (9/5)C + 32

28 Problem #1: Design Recipe Continued Some quick cleaning up gives us a math function: Celsius->Fahrenheit(x) = (9/5 * x) + 32 Our scheme function quickly follows: ;; Definition (define (Celsius->Fahrenheit c) (+ (* c 9/5) 32))

29 Problem #1: Design Recipe Continued How many test cases do I have to show? And what information do they have to show? Your test cases have to reflect at the VERY least the information conveyed in your Examples Section!!!! 3 Examples shown = At least 3 Test Cases shown

30 Problem #1: Design Recipe Concluded ;; Tests: (Celsius->Fahrenheit 0) ;; should produce 32 (Celsius->Fahrenheit –40) ;; should produce -40 (Celsius->Fahrenheit 100) ;; should produce 212

31 Did yours look like that?

32 Problem #2: Slightly Faster Pace This function asked you to convert a temperature in degrees Fahrenheit and transform it into degrees Kelvin. The formula derived is: K = (5/9)(F – 32) + 273

33 Problem #2: Continued ;; Data Analysis and Definitions: ;; Contract: Fahrenheit->Kelvin : number -> number ;; Purpose: This function converts a value in degrees ;; Fahrenheit to degrees Kelvin ;; Template: ;; Examples: (Fahrenheit->Kelvin 32) should produce ;; 273 ;; (Fahrenheit->Kelvin –40) should produce ;; 233 ;; (Fahrenheit->Kelvin 212) should produce ;; 373

34 Problem #2: Continued ;; Definition: (define (Fahrenheit->Kelvin x) (+ (* (- x 32) 5/9) 273)) ;; Tests: (Fahrenheit->Kelvin 32) ;; should produce 273 (Fahrenheit->Kelvin –40) ;; should produce 233 (Fahrenheit->Kelvin 212) ;; should produce 373

35 Problem #2: Continued But wait, could we have done better?

36 Problem #2: Continued But wait, could we have done better? YES! It would have been an excellent idea to abstract out a function for the Fahrenheit to Celcius part of the calculation!

37 Problem #3: One more! Define the program convert3. It consumes three digits, starting with the least significant digit, followed by the next most significant digit, followed by the next most significant one, and so on. The program produces the corresponding number. For example, the expected value of (convert3 1 2 3) is 321.

38 A quick review of significant digits Identify the most significant and least significant digit in the following numbers: 1 123 378641397649372864978326498761239476239784621 349173249871239649876324987632498734962187364 196378462987364872364786238976492876349872364 75637437215

39 Problem #3: Continued ;;Data Analysis & Definition: ;; Contract: convert3 : number number number --> number ;; Purpose: ;; take 3 digits from least significant to most significant ;; and build the corresponding 3-digit number ;; Template: ;; Examples: (convert3 3 2 1) should produce 123 ;; (convert3 3 5 2) should produce 253 ;; (convert3 6 1 8) should produce 816

40 Problem #3: Continued ;;Definition (define (convert3 least middle most) (+ (* 100 most) (+ (* 10 middle) least)))

41 Problem #3: Continued ;; Tests: (convert3 3 2 1) ;; should produce 123 (convert3 3 5 2) ;; should produce 253 (convert3 6 1 8) ;; should produce 816

42 3. Let’s Look at a Bigger Example Let’s examine: Section 3.1 (p 22 & 23)Section 3.1 (p 22 & 23)

43 Working the Bigger Problem: Extracting Information 1)Profit is the difference between Revenue and Costs 2) Revenue comes exclusively from the sale of tickets (ticket price * number of attendees) 3)Cost is a fixed part ($180) and a variable part which is $0.04 for every attendee 4)The number of attendees varies with the ticket price 5)The owner is mentioning 120 attendants and $5.00 as his starting point. We can base our work off these numbers

44 Working the Bigger Problem: Abstraction We have a number of dependencies in this problem. PROFIT depends on REVENUE and COST. Both REVENUE and COST each depend on ATTENDANCE. We can break the larger problem (profit) into several smaller problems (revenue, cost, and attendance)

45 Working the Bigger Problem: Profit What do we know? ;; Data Definition & Analysis: ;; Contract: profit: number -> number ;; Purpose: ;; to compute profit as the difference between ;; REVENUE and COST at some given ticket-price. ;; Template: ;; Examples: (profit 5.00) should produce 485.20 ;; (profit 4.50) should produce 689.70

46 Working the Bigger Problem: Profit ;; Definition: (define (profit ticket-price) …) Let’s come back to this one…

47 Working the Bigger Problem: Revenue ;; Data Analysis & Definition: ;; Contract: revenue : number -> number ;; Purpose: computes the revenue, given a ticket-price ;; Template: ;; Examples: (revenue 5.00) should produce 600 ;; (revenue 4.50) should produce 877.50 ;; Definition: (define (revenue ticket-price) …) …Ooops, this function depends on the attendance values. I better come back to it.

48 Working the Bigger Problem: Cost ;; Data Analysis & Definition: ;; Contract: cost : number -> number ;; Purpose: computes the cost, given a ticket-price ;; Template:

49 Working the Bigger Problem: Cost ;; Examples: (cost 5.00) should produce 184.80 ;; (cost 4.50) should produce 187.80 ;; Definition: (define (cost ticket-price) …) …Uh-oh…how can I write this without attendance? Let’s put it off

50 Working the Bigger Problem: Attendance ;; Data Analysis & Definition: ;; Contract: attendance : number -> number ;; Purpose: ;; computes attendance, given a ticket price. For every ;; $0.10 we remove from a price of 5.00, we gain 15 people ;; Template:

51 Working the Bigger Problem: Attendance ;; Examples: (revenue 5.00) should produce 120 ;; (revenue 4.50) should produce 195 ;; Definition: (define (attendance ticket-price) (+ 120 ; the following is a re-arrangement of the ; formula: ((5 – T) * 10) * 15 (* (/ 15.10) (- 5.00 ticket-price))))

52 Working the Bigger Problem: Back to Cost Ok, we’ve got attendance, let’s go back to cost: (define (cost ticket-price) (+ 180 (*.04 (attendance ticket-price)))) ;; Tests (cost 5.00) ;; should produce 184.80 (cost 4.50) ;; should produce 187.80

53 Working the Bigger Problem: Back to Revenue (define (revenue ticket-price) (* (attendance ticket-price) ticket-price)) ;; Tests: (revenue 5.00) ;; should produce 600 (revenue 4.50) ;; should produce 877.50

54 Working the Bigger Problem: Back to Profit (define (profit ticket-price) ( - (revenue ticket-price) (cost ticket-price))) ;; Tests: (profit 5.00) ;; should produce 485.20 (profit 4.50) ;; should produce 689.70


Download ppt "CS1321: Introduction to Programming Georgia Institute of Technology College of Computing Lecture 3 Aug. 28, 2001 Fall Semester."

Similar presentations


Ads by Google