Question: / / CAB 3 0 1 Assignment 2 / / ToolCollection ADT specification using System; / / Invariants: no duplicate tools in this tool collection
CAB Assignment
ToolCollection ADT specification
using System;
Invariants: no duplicate tools in this tool collection all the tools in this tool collection have different names and the number of tools in this tool collection is greater than equals to
interface IToolCollection
get the number of tools in this tool collection
int Number
get;
Check if this tool collection is empty
Precondition: nil
Postcondition: return true if this tool collection is empty; otherwise, return false. This tool collection remains unchanged and new Number old Number
bool IsEmpty;
Insert a new tool into this tool collection
Precondition: the new tool is not in this tool collection
Postcondition: the new tool is added into this tool collection, new Number old Number and return true; otherwise, the new tool is not added into this tool collection, new Number old Number and return false.
bool InsertITool tool;
Delete a tool from this tool collection
Precondition: nil
Postcondition: the tool is removed out of this tool collection, new Number old Number and return true, if the tool is present in this tool collection;
otherwise, this tool collection remains unchanged, and new Number old Number, and return false, if the tool is not present in this tool collection.
bool DeleteITool tool;
Search for a tool by its name in this tool collection
pre: nil
post: return the reference of the tool object if the tool is in this tool collection;
otherwise, return null. New Number old Number.
ITool? Searchstring toolName;
Return an array that contains all the tools in this tool collection and the tools in the array are sorted in the dictionary order by their names
Precondition: nil
Postcondition: return an array that contains all the tools in this tool collection and the tools in the array are sorted in alphabetical order by their names and new Number old Number.
ITool ToArray;
Clear this tool collection
Precondition: nil
Postcondition: all the tools in this tool collection are removed from this tool collection and Number
void Clear;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
