c398s00t - CSc 398 Mid-Term Examination Wednesday 15 March...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSc 398 Mid-Term Examination Wednesday 15 March 2000 >>>>>>>>>>>>>>>>>SUGGESTED ANSWERS<<<<<<<<<<<<<<<<<<<<<<<<< 1. The original fibonacci sequence is 1,1,2,3,5,8,. .., where the next number is the sum of the previous two entries. In general, a sequence starting with any two positive numbers is fibonacci if a given entry is the sum of the previous two entries. Write a class Fibonacci which is a subclass of OrderedCollection, which responds to the message "new" by creating an instance whose initial values are 1 and 1, which responds to the message "x1:n x2:m" by creating an instance whose intial values are n and m, whose instances always have two entries, and whose instances respond to the messages "next" (which returns the next entry in the given fibonacci sequence) and "ratio" (which returns the ratio of the two current entries as a Float). (The ratio of consecutive entries in the fibonacci sequence converges to the golden mean, a concept invented by the Greeks). OrderedCollection subclass: #Fibonacci
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/09/2008 for the course CSE 366 taught by Professor Varies during the Spring '08 term at Lehigh University .

Page1 / 3

c398s00t - CSc 398 Mid-Term Examination Wednesday 15 March...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online