c398s00t

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

• Notes
• nizhes
• 3

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

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 instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' !

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

This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern