CPSC 3200 Object-Oriented Development Programming Assignment #3


Category: You will Instantly receive a download link for .zip solution file upon Payment


5/5 - (8 votes)

P3 exercises your understanding of inheritance and polymorphism in C#.
You must define appropriate class(es). Note that design is concerned with consistency.
Use PROGRAMMING BY CONTRACT to document your design and ALL assumptions made.
DO NOT hard code.
P3’s goal is to design C# classes for “image collages”, abstracting the arrangement of digital images in a collage. You do not need to actually store images: each image can be represented by a unique id. For example, say a marketing team has 2500 images in its DB, each numbered between 1000 and 9999. If an imageCollage contains the sequence (2345, 4321, 1114, 8975, 2314) then those 5 digital images will be displayed in a collage.

Part I: Class design
You are to design a class hierarchy of imageCollage¬s, where the ‘size’ of each imageCollage varies. Each imageCollage object encapsulates, at minimum, a sequence of image ids and:
1) If ‘on’, an imageCollage allows the replacement of one specified image with another and returns appropriate values for display (sequence of image numbers) & query (image in sequence) as well as counts for the number of display queries and image replacements. If ‘off’, an imageCollage rejects replacement requests and returns no valid information.
2) If ‘on’, a cyclicCollage acts like a imageCollage, except that each display request yields a shifted sequence of its images, where the shift value is an internally encapsulated value.
(2345, 4321, 1114, 8975, 2314) is first display
(8975, 2314, 2345, 4321, 1114) is second display with a shift of 3 (and no replace)
(4321, 1114, 8975, 2314, 2345) is third display with a shift of 3 (and no replace)
3) If ‘on’, a bitCollage acts like a imageCollage, except: each display request yields a subsequence of its images, where one to three (random) images numbers have been omitted; and, for a given object, only odd (or even) image numbers may be replaced.
(2345, 4321, 8975, 2314) is first display
(4321, 1114, 2314) is second display
(2314, 2345, 4321, 1114) is third display
(8975, 2345) is fourth display

Clearly, many details are missing. Make reasonable design decisions so that your classes satisfy the stated goal(s), communicate assumptions and use, and yield clear and maintainable software.

Use ProgrammingByContract to specify pre and post conditions; interface, implementation and class invariants. Relationships should be noted in the appropriate invariants.

Part II: Driver
Design a driver to demonstrate the program requirements.
Clearly specify the intent and structure of your driver
Driver should define, and appropriately test type functionality using, a heterogeneous array.
Test data (objects) should be allocated via a construction routine and should provide a
random distribution of objects with arbitrary initial values (values should be reasonable)
meaningful base values for non-arbitrary initial values

Do not skimp on your driver’s design. Comments from previous assignments apply.

UPLOAD YOUR individual FILES (P3.cs, imageCollage.cs, cyclicCollage.cs …) TO Canvas