-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Milestone
Description
All methods should take Object and throw a NumberFormatException if the object is not of the required type. This will make printing error messages much easier.
Example:
public Vector3D multiply(Object o) throws NumberFormatException {
if(o.getClass() == Vector3D.class)
...vector dot product...
else if(o.getClass() == Double.class)
...scalar multiplication...
else
throw new NumberFormatException("Error: invalid type. The * operator requires an object of type Vector3D or double");
}
Metadata
Metadata
Assignees
Labels
No labels