CS 2510 Midterm: Complete and Comphrehensive 52-page Midterm Study Guide - Spring 2016

307 views52 pages

Document Summary

Topics included: introduction for java (differ from drracket, data definitions, methods for simple classes, unions, and lists, accumulators, practice, abstraction, exceptions, sameness, filter, introduction for java (differ from drracket) Design recipe for functions: data definition, signature & purpose, examples / testing, template / inventory, code, run / test. ;; a number representing time to travel from framingham to boston (define time-to-travel 30) (define heavy-traffic (+ time-to-travel 20)) (define light-traffic (- 30 minutes 10)) isl dynamically typed. Etc int timetotravel = 30; double x = 5. 5; boolean iseven = true; ;; a book is a (make-book string string number) (define-struct book (title author price)) (define pride (make-book pride of prejudice austin 5)) In the above, we see book is a simple class. Every simple class should have the constructor, which is like above book(string title, string author, int price) , Of course, we could make it become a little difficult.