[SOLVED] 程序代写代做代考 CMSI 185 – Computer Programming

30 $

File Name: 程序代写代做代考_CMSI_185_–_Computer_Programming.zip
File Size: 546.36 KB

SKU: 5024233296 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


CMSI 185 – Computer Programming
Spring 2017

Homework #4

Part 1

#|

Below is some Racket code.The numbers in the left margin are line numbers.Submit
your hardcopy answers to the questions 1, 2a, 2b, 3a, 3b, 4a, and 4b.

QUESTIONS

1.For each line below, state the line number and describe what that
line does.

2a. What is the purpose of the function “lookup”?
2b. How does the function “lookup” work?

3a. What is the purpose of the function “translate”?
3b. How does the function “translate” work?

4a. What is the purpose of the function “translate_sentence”?
4b. How does the function “translate_sentence? work?

|#

1#lang racket

2(requireracket/trace)

3(define( translate_sentencesentence )

4 ( displayln sentence )

5 ( if [null? sentence]
;then
6 empty
;else
7 (cons ( translate ( firstsentence) )
8 ( translate_sentence( restsentence) )
)
))

9(define( translateword )

10 (lookup word ‘((window fenetre) (book livre) (computer ordinateur)
11(house maison) (closed ferme) (pate pate) (liver foie)
12(faith foi) (weekend (fin de semaine))
13((practical joke) attrape) (pal copai)
14(I Je) (love amore)

)
))

15(define( lookupworddictionary )

16 (cond([null? dictionary] (cons word ‘(unknown word) ))

17([equal? word (first (first dictionary))] (first(rest(first dictionary))))

18(else (lookup word(rest dictionary)))
))

;;;TURN ON TRACING
;(trace translate_sentence)

;;;TEST CASES
19(translate ‘computer)

20(translate ‘(practical joke))

21(displayln (translate_sentence
22‘(I love Racket faith window liver pate house weekend)))

Part 2

A rational number as you’ve learned in high school actually has two components. The numbers1/2,
3/4, 2/243, and 323/478 are all rational numbers.

A rational number that can be made by dividing two integers, a/b, where a and b are integers and b is
not zero.Sometimes when a

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 程序代写代做代考 CMSI 185 – Computer Programming
30 $