Assignment (50%): Apply the principles of modular programming to a given unfinished application. There are three deadlines throughout the semester with each deadline having a different weight. You can work alone or with another student (be smart in choosing a teammate).
Exam (50%): On the PC you will get an exercise to build a modular program and a test script to test your code. The exam is 3 hours.
Exam 14/06/2023
Build a program that implements the principles of abstraction, inheritance... that were taught in the course.
Build an abstraction for the module called "graph diagrams". The abstraction consists of the classes nodes and arcs. Nodes can be either rectangular with the specified integers for width and height or they can be circular with a specified integer for radius (use inheritance). The parameters are integers larger than zero. The arc class has the input parameter for a starting angle. Be sure to have all the formal specifications necessary (informal specifications are not required). For the constructor of the classes you have to use defensive programming, for the methods you have to use contractual programming. You have access to the logicalcollections package from the lectures. Arcs have a single source node and a single target node. These nodes are set to null when making new arc instances. Arcs also have methods for setting a target/source node and unlinking the target/source nodes. Unlinking again sets these nodes to null. The target and source node can also be the same node. Each node has a set of outgoing arcs and a set of incoming arcs.
Allow client modules to access the width of a rectangular node, the height of a rectangular node, the radius of a circular node, the set of incoming arcs of a node, the set of outgoing arcs of a node, the departure angle of an arc, the source node of an arc, the target node of an arc. Also, allow clients to set a target node for an arc, to set a source node for an arc, to unlink source nodes from an arc, and to unlink target nodes from an arc. Clients should not be able to alter the set of incoming or outgoing arcs of specific nodes, this should be done internally.
Then develop the methods to get the area of a node, this should be calculated differently for the specific type of node (dynamic binding!). Create a method isIsoMorphic() for nodes to allow clients to detect if two separate node instances are identical. They should be identical if they have the exact same width, height or radius as each other and if they are linked to the exact same arcs as each other.
Lastly, write a test script using assertions to test all the methods and specifications. This should encapsulate all the documentation that you have made.