WXME0106 ## wxtextwxtabwxmediawximage$(lib "comment-snip.ss" "framework")+(lib "collapsed-snipclass.ss" "framework")drscheme:sexp-snipdrscheme:syntax-snipclass%drscheme:number,(lib "number-snip.ss" "drscheme" "private")drscheme:bindings-snipclass%drscheme:lambda-snip%drscheme:define-snip%java-comment-box%java-interactions-box%"drscheme:vertical-separator-snip%wxbaddrscheme:xml-snip(lib "xml-snipclass.ss" "xml")drscheme:scheme-snip"(lib "scheme-snipclass.ss" "xml")test-case-box% HTML BulletwxlocnK ZZ StandardK-adobe-courier ZZ?\???""Matching Parenthesis Style?\???""????&&(framework:syntax-coloring:scheme:symbol????&&)framework:syntax-coloring:scheme:keyword????&&????t)framework:syntax-coloring:scheme:comment????t????)&(framework:syntax-coloring:scheme:string????)&*framework:syntax-coloring:scheme:constant????)&????>&-framework:syntax-coloring:scheme:parenthesis????>&????@'framework:syntax-coloring:scheme:error????@????'framework:syntax-coloring:scheme:other????????Qp1drscheme:check-syntax:lexically-bound-identifier????Qp????D*drscheme:check-syntax:imported-identifier????D%profj:syntax-coloring:scheme:keyword????????""$profj:syntax-coloring:scheme:string????""%profj:syntax-coloring:scheme:literal????""%profj:syntax-coloring:scheme:comment????t#profj:syntax-coloring:scheme:error????@(profj:syntax-coloring:scheme:identifier????&&%profj:syntax-coloring:scheme:default????F???????XMLF???????K-adobe-courier ZZG???????????QQG????QQG????d?????^???F@\??????F?\??????F?\???F???????F????F?\???22F?]??????F???????F????QQF?\???QQF????K????K?\???F?]???@F?]???F@\???F?\??????F?\???K????>&K????$#K???????K????""K?\???K????K?\???F?33@\??????F?33@\??????????F???????F???????K?]??????K?陙]??????F?陙]??????F?陙??????K?陙??????F?陙??????K?陙??????F?陙??????K?陙??????F?]??????K???????F????F???????K?]??????K?陙]??????F?陙??????F?陙]??????F?z`??????K?陙??????F?陙]??????F?33@\??????F?33@\???F?\??????F?\??????????K?\???F?陙???F?33@???K????CBoK@\???K?33@\???>&F???????K???? ?????????\F?\???@F?陙]??????K?陙???>&K?\?????? :;;; Course Name: Practical Functional Programming (CS6960) !;;; Student Name: Park, Jong Chun ;;; Student ID #: 00259446   ;  a p p e n d - s t r i n g - t o - f i l e :  s t r i n g  s t r i n g  - >  v o i d ;  a p p e n d - s t r i n g - t o - f i l e  a p p e n d s  a  s t r i n g  t o  t h e  e n d  o f  a n  e x i s t i n g  f i l e ;  ( d e f i n e  (app end - s t r i n g - t o - f i l e  f  w ) ;    . . . ) (define (append-string-to-file f w)  (with-output-to-file f  (lambda ()  (display w)) 'append))   ; weather-report is either  ; - no-weather  E; - (make-weather (string number string string number number number)  ( define-struct weather (mm dd day w low high pop))  (define-struct weather (mm dd day w))    ; list-of-weather is 1; - (define-struct list-of-weather (first rest)) (define list-of-weather (first rest))    ; "; make-file-name: number -> string .; make-file-name creates a file name in string .; (make-file-name 0) "should be" "daily-0.txt" ; (define (make-file-name num)  ; (cond ; [(number? num)...] ; [else ...])) (define (make-file-name num)  (cond  [(number? num)( string-append "daily-report-" (number->string num) ".txt")]  [else (display "": make-file-name number\n")])) ; TEST ";(make-file-name 0) -> daily-0.txt    ; output port to write data  (define   DAILY-REPORT  " daily-report.txt ")   4 5; convert-weather-to-string: (make-weather) -> string D; convert-weather-to-string converts weather data to a single string J; (convert-weather-to-string (make-weather "JAN" 01 "WED" "SNOW" 10 35 20) /; "should be" "JAN 01 WED SNOW 10/35 POP 20" '; (define (convert-weather-to-string w)  ; (cond ; [(empty? w) ...] ; [(weather? w)  ; ...(weather-mm w) ... ; ...(weather-dd w) ... ; ...(weather-day w) ... ; ...(weather-w w) ... ; ...(weather-low w) ... ; ...(weather-high w) ...  ; ...(weather-pop w)...])) (define (convert-weather-to-string w)  (cond  [(empty? w) ""]  [(weather? w)  ( string-append   ( weather-mm w) " "  (number->string ( weather-dd w)) " "  ( weather-day w) " "  ( weather-w w) " "  (number->string ( weather-low w)) "/"  (number->string ( weather-high w)) " "  ( string-append "POP "   (number->string ( weather-pop w))))])) ; TEST M; (convert-weather-to-string (make-weather "JAN" 28 "FRI" "MOCLDY" 15 45 20)) '; -> "JAN 28 FRI MOCLDY 15/45 POP 20"  &; convert-weather-to-string: (make-wea ther) -> string  D; convert-weather-to-string converts weather data to a single string  ,; (convert-weather-to-string (make-weather " JAN " 01 " WED " " SNOW ")  ; " should  be " " JAN  01  WED  SNOW  10/35  POP  20 "  '; (define (convert-weather-to-string w)   ; (cond  ; [(empty? w) ...]  ; [(weather? w)  ; ...(weather-mm w) ...  ; ...(weather-dd w) ...  ; ...(weather-day w) ...  ; ...(weather-w w) ... ] ) )  (define  (convert-weather-to-string  w)   (cond   [(empty?  w)  ""]   [(weather?  w)   ( string-append    ( weather-mm  w)  " "   (number->string  ( weather-dd  w))  " "   ( weather-day  w)  " "   ( weather-w  w)  " ")]))  ; TEST  ,; (convert-weather-to-string (make-weather " JAN " 28 " FRI " " MOCLDY "))  ; -> " JAN  28  FRI  MOCLDY "    &; record-today: (make-weather) -> void  ; record -today o p e n s  a n  e x i s t i n g  f i l e ,  i f  d o e s ,  o r  c r e a t s  a  f i l e , ;               and  records  today ' s  weather  info  onto  it.   ; (record-today (make-weather (" JAN " 28 " FRI " " MOCLDY  " 15 45 20))  ; " should ." create a file name of daily-3.txt and record  ; a string of " JAN  28  FRI  MOCLDY  15/45  POP  20  " onto it.  ; (define (record-today w)   ; (cond  ; [(empty? w) ...]  ; [(weather? w)  ;        . . . ( a p p e n d - s t r i n g - t o - f i l e . . . w ) . . . ] (define  ( record-today  w)   (cond   [(empty?  w)   (begin   (display  " No  weather   information  for  today   recorded.\n "))]   [(weather?  w)   (begin   (append-string-to-file   DAILY-REPORT  (convert-weather-to-string  w))   (display    ( string-append  " \nToday ' s  weather   information  was  recorded  in  the  file ,  " DAILY-REPORT  " .\n ")))]))  ;  TEST  ; (record-today 2  #; (make-weather "JAN " 28 " FRI " " MOCLDY  " 15 45 20))  ;; -> Today's weather information was recorded in the file.    &; DISPLAY WELCOMING MESSAGES FOR USERS  (display  " :\trecord-today  \n ")   (display J"\t\t\t(make-weather string number string string number number number)\n") (display E"\t\t\t(make-weather MM DD DAY WEATHER LOW HIGH POP\n")  (display "\t\t\t  * . (make-weather string number string string)\n") (display "\t\t\t  * + (make-weather MM DD DAY WEATHER )\n") (display " \ t \ t \ t  *  M M  i s  \"JAN \", \"FEB \", \"MAR \", \"APR \" ,  a n d  etc.\n ")  (display  " \ t \ t \ t  *  D D  i s  a n y  n u m b e r  i n d i c a t i n g  d a t e . \ n ")  (display  " \ t \ t \ t  *  D A Y  i s  \"MON \", \"TUE \", \"WED \",  and  etc.\n ")  (display  " \ t \ t \ t  *  W E A T H E R  i s  e i t h e r  ")  (display  " SUNNY ,  SNOW ,  RAIN ,  MOCLDY ,  PTCLDY ,  or  WINDY.\n ") (display j"\t\t\tEnter 0 for LOW, 100 for HIGH, and 50 for POP since WEATHER matters in evaluating precision.\n\n\n")