COS3711 Assignment 2 (COMPLETE ANSWERS) 2026 - DUE 9 July 2026
COS3711 Assignment 2 (COMPLETE ANSWERS) 2026 - DUE 9 July 2026; 100% TRUSTED Complete, trusted solutions and explanations. For assistance, Whats-App 0.6.7-1.7.1-1.7.3.9. Ensure your success with us ..... One way to draw a set of shapes (squares, circles, rectangles, and ellipses) is to use an inheritance hierarchy similar to the one below. The base class holds basic pen and brush values, and subclasses hold a number of additional properties (squares and circles need one property – the radius of a circle for example, whereas rectangles and ellipses need an additional property – length and width of the two sides of a rectangle, for example). The Shape, Shape1Property (for circles and squares), and Shape2Property (for ellipses and rectangles) classes are abstract classes (the draw() function being the pure virtual function in all of them). COS3711/Assignment 2/2026 3 Use this structure to create an application that will draw the required shape in a GUI window. The UML diagram gives only the basic structure, and you will need to add getter and setters, other constructors, and helper functions as you need them. Note that if you cannot get the image to appear, you should at least display the shape properties in a GUI window so that the following three questions can also be completed. Extend the application in Question 1 by adding a class that will maintain a list of shapes. You will want only one list in the application, so use an appropriate design pattern to ensure this. As items are added to the list, allow the user to move backwards and forwards through the list. Using the XML file below, import the shapes contained in it when the application starts up (using DOM), and display the first one. You should then be able to navigate through the 4 shapes and add new ones to the list. shapeList shape type="Square" pw="1" pc="Red" fc="Black" p1="110" p2="" / shape type="Circle" pw="2" pc="Green" fc="Blue" p1="75" p2="" / shape type="Ellipse" pw="3" pc="Black" fc="Red" p1="140" p2="55" / shape type="Rectangle" pw="4" pc="Blue" fc="Green" p1="75" p2="120" / /shapeList Ensure that all necessary file checks are implemented. COS3711/Assignment 2/2026 Extend the application in Question 3 using a Memento pattern to enable a backup/restore facility. Allow the user to keep the state of the application at a user-indicated point, and return the state of the application to that point (again, when the user chooses), and display the first shape in the list. You need only allow for a single backup point.
Written for
- Institution
-
University of South Africa (Unisa)
Document information
- Uploaded on
- July 9, 2026
- Number of pages
- 61
- Written in
- 2025/2026
- Type
- Exam (elaborations)
- Contains
- Questions & answers