CSE143 Proj-let 6

Both parts due in quiz section Tuesday, August 12, 2003

Sample solution for Part A code.   Sample solution for Part B code.

No electronic turn-in!  You can write your answers by hand, as long as they are legible.  If you hand in a printout, be sure that is is clear where your answers are (for example, if you implement an entire problem in Java and only one method was required as the answer to a question, circle or highlight that method and label it with the problem number, so we can easily find it for grading).


 Part A (to be done by each student individually).  Ground rules: you may not use the for or while statements. 

1a. Write a method called arrayMin which, given an array of ints, returns the smallest value found in the array.   Precondition: array length is greater than 0.

1b. Write a method called MinObject which, given a List, returns the object in the List which has the smallest value.  Assume that all elements of the List implement the Comparable interface and can be compared with one another.  If more than one element has the same smallest value, it doesn't matter which one is returned.  Return null if the list is empty.

1c. Give a complexity analysis of your answer to 1a.

1d. Give a complexity analysis of your answer to 1b.

A palindrome is a word or phrase which reads the same forwards as backwards (like "ABBA" or "ubu" or "I").  In general, spaces, punctuation, and capitalization are ignored, so "Madam, I'm Adam!" is considered a palindrome.   We could also define an exact palindrome to be one in which spaces, punctuation, and capitalization were also matched, so that "Madam, I'm Adam" would not be an exact palindrome.

2a. Write a method which, given a String, returns true if and only if the argument is an exact palindrome.

2b. Write a method which, given a String, returns true if and only if the argument is a palindrome (in the general sense).



Step B.  Electronic Latte Bar.  To be done by partners, only one turn-in per team.

You and your partner plan to get rich by opening an electronic coffee shop.  Once at your site, a customer can select a beverage, pay electronically, and the chosen beverage will be delivered by Federal Express -- within 24 hours, guaranteed.

Work out the design of the Electronic Latte Bar, from a Model-View-Controller point of view.  Don't worry too much about data structures or algorithms.  Focus on how the system would be divided along MVC lines.  Express your answer by specifying the interface that each of the three components would satisfy.  Expand on the interface specifications with comments or diagrams if appropriate.  Restrict your answer to one page if possible, two maximum.