Description
Homework 8_
The aim of this homework assignment is to practice writing hierarchy of classes.
Design a hierarchy of Files. You have two different kinds of Files, Text File and an Image File. The files are identified by their name and type, which is identified by either txt or gif extension. An Image file has dimensions of pixel rows and pixel columns. Each pixel has a color depth that can be represented by number of bits. (8 bits is one byte). A Text file is a plain ASCII file that contains characters. Each character is represented by 8 bits. You should provide a function getSize that returns size of a file. Size of a file is measured in bytes. The size of an Image file is calculated by finding how many pixels are needed to store a file multiplied by number of bits to color a single bit divided by 8. The size of the Text file is calculated by counting number of ASCII characters stored in a file.
Provide a function to display properties of a File. Properties include: type, name, size, dimensions and color depth for an Image File, characters for a Text File. Provide functions to return type and names of files. Provide function to retrieve character count for a Text file. Provide functions to retrieve dimensions and color depth of an Image File.
Write .h and .cpp files for File, Image, and Text classes.