square_root(value : DOUBLE; tolerance : DOUBLE) : DOUBLE
-- find square root with given tolerance
-- that is, Result squared is within tolerance of given value
-- only works for non-negative values
Rewrite the second two comments as Eiffel pre and post conditions for the routine.
2. Write a class CUSTOMER for use in a business which sells widgets and doodads. Think of some reasonable features a CUSTOMER should have, and implement them (i.e. write the code for the routines). Some ideas to get you started:
Customer details need to be stored
Customers have a certain number of doodads and widgets on order
Other objects will use your objects created with your CUSTOMER class when a customer orders some more widgets and/or doodads, or some doodads and or widgets are delivered.
Assuming widgets cost $2 and doodads cost $3, be able to compute the outstanding bill the customer has. (Make sure you design you class so that the cost of widgets and doodads can be changed easily when the GST is introduced).