COM 1204 Assignment #2. Due: Friday, 19 April 2002 You will implement the Bagel ADT specified below. Class files compiled from your code may be used by other students in a future assignment. Collaboration between students is forbidden on this assignment. You are responsible for keeping your code hidden from all other students. Part of your grade will be determined by how well you hide your code, part of your grade will be determined by how well you follow the instructions for submitting your code, part of your grade will depend upon the correctness of your code, and part of your grade will depend upon the readability of your code (e.g. indentation, formatting and comments). Turn in your work on this assignment before 4 pm on the due date by sending electronic mail to will@ccs.neu.edu with subject COM 1204 assignment #2 and a body that consists of nothing but your Bagel.java file. That file must begin with a Java block comment that lists 1. Your name, as you want the instructor to write it. 2. Any remarks that you wish to make to the instructor. Late assignments may be discounted, and very late assignments may be discarded. Your email must be sent as plain text, with no MIME or HTML encoding, and must not include any signature lines or other stray characters that would prevent your code from compiling and running. Furthermore your code should follow the other guidelines announced in class. -------------------------------------------------- Your assignment is to write the code for a single file, Bagel.java, that defines Bagel as a class in the default (top-level) package. Sample test code is provided in /course/com1204/.www/will/Assignments/A2/BagelTest.java Your definition must work with this test code, and must behave as specified below. -------------------------------------------------- Specification of the Bagel ADT. Bagel is an immutable abstract data type. Its operations shall have no side effects. The Bagel ADT shall be implemented in Java, and will be tested using Sun's Java 2 Runtime Environment, Standard Edition. The code for this implementation shall be in the default package, and shall define a public class named Bagel that defines the following public static methods, which are specified below. Signature: public static Bagel poppy(); public static Bagel sesame (Bagel, char, int); public static Bagel onion (Bagel, char); public static int raisin (Bagel, char); Algebraic specification: raisin (poppy(), c0) = -1 raisin (sesame (b, c, i), c0) = i if c = c0 raisin (sesame (b, c, i), c0) = raisin (b, c0) otherwise raisin (onion (b, c), c0) = -1 if c = c0 raisin (onion (b, c), c0) = raisin (b, c0) otherwise --------------------------------------------------