CPSC 110 Lecture Notes - Operand

82 views2 pages
28 Aug 2014
School
Course
Professor
ferrari12 and 39375 others unlocked
CPSC 110 Full Course Notes
23
CPSC 110 Full Course Notes
Verified Note
23 documents

Document Summary

Use all caps for constants, use for separating words, To evaluate numbers: ( primitive operator operand use this to evaluate operand until it"s a value) (/ 9 3) (+ 1 2) = 1+2 (/2 1) = 2/1 etc. *use step (top right corner) to see step by step stuff. Exercise: evaluate (* (+ 4 (-7 3) 1) 2) To make shape: (rectangle width height mode color ) Mode=solid, outline i. e. (require 2htdp/image) (rectangle 50 70 solid blue ) You can define a picture as a constant e. g. (define blue-square ((copy pic)) ) To put images beside each other (beside blue-square tiger) (beside name1 name2) Making sentences: adding phrases/strings together: use string-append, i. e. (string-append blu likes red ) => blu likes red ( is for space) Write expression for total cost of buying 2 adult tickets & 3 kid tickets for. . 75/adult and . 75/kid. (define adult-fare 2. 75) (define kid-fare 1. 75) (+ (* adult-fare 2) (* kid-fare 1. 75))

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents