2017-09-12 HW02

posted Sep 12, 2017, 6:19 AM by Samuel Konstantinovich   [ updated Sep 12, 2017, 6:25 AM ]
Do Now:
Convert to Scheme notation:
a)  8 + 3 * 2 + 1 
c)  9 - 1 / 2 + 3 * 2
b)   7 - 4
     (5 * 2)2

operators:
+
-
*
/
quotient - the integer portion of the mathematical quotient.
remainder - the leftover portion of the original number when dividing.

Evaluate:
a) (quotient (remainder 12 11) (remainder 5 3) )
b) ( / (- (* 3 2) 5) (* (- 3 2) 5) )



Login:
username: stuy.edu username
password: OSIS

Running DrRacket on the school computers.
1. To open a terminal (shortcut  Ctrl-Alt-T)
Click the ubuntu menu is the top left corner (the funny circle)
type terminal
click the terminal icon

2. In the terminal type 
drracket  
Then press enter


Changing your password:
1) Open the Terminal application on your computer.
2) At the $ prompt type:
Answer yes
It will ask for your password, the cursor 
will not move as you enter it, that is normal.
3) At the $ prompt type:
$ passwd
Follow the instructions to change your password.
4) Close Terminal and log out the computer.



This header is to be included on all submitted assignments
;Last name, First Name
;STUY ID
;MKS21 Period<x>
;YYYY-MM-DD
;HW<x>

e.g.
;Smith, David
;1234
;MKS21 Period4
;2015-09-18
;HW04

HOMEWORK!

HW02:


Answer the following questions, submit a plain text document on the homework server.

1. Convert the infix expression to scheme notation.
 a. ( 5 - 4 * 2 ) / ( 10 - 5 ) + 3
 b.   2 +  3 ( 4 - 2) / ( 1 - 3 / 5 ) 
 c.   4 + 3 * 2 
      ----------   -    1
        5 - 10    

2. Evaluate the expressions (show the steps you took line by line) You may verify your result using DrRacket.
 a. (* (+ 4 -7 9) (/ 15 5) (- 3 -1) )
 b. (/ (- 20 -4)   (* -3 (* 2 -1)))
 c.  (+ 
     (remainder 10 7) 
     (remainder 7 10) 
     (* 
       (quotient 24 10) 
       (remainder 24 10)))




Comments