You are required to implement a Painting manager system in C++. This system keeps track of paintings in an art gallery. Each painting contains the following ï¬elds:
1. IDâThis is a unique (integer) identiï¬er for each painting
2. TitleâThis is the title of the painting.
3. Artist nameâThe ï¬rst name of the artist who painted the painting.
4. PictureâA ï¬le containing a picture of the painting in an appropriate format
The last item above is a jpeg-formatted sequence meant to display an image of a painting on the userâs display. For the time being, you do not have to worry about creating, storing or displaying the image; you may assume that this functionality will be implemented by someone else. However, you must make provisions for the fact that images will be relatively large, making each painting instance expensive to store in memory. To handle the size of each painting instance, your manager (Mr. Oogawh Booey) has decided that you should store your painting instances in ï¬les most of the time. Also, you should implement a smart pointer class called PaintingWrapper that dynamically loads instances of class Painting when they are needed and stores them back on ï¬le when done with a painting. (Each painting is stored in a diï¬erent ï¬le.) You are to code a test version of the program that contains just 5 paintings denoted by unique IDs 1 through 5. Each of the ï¬ve painting is stored in a separate ï¬le. At any point in time, only two of the paintings can be stored in memory; the remaining paintings exist only in the ï¬les associated with your project. When the program is started, the program creates a linked list of 5 painting wrappers; however, none of the painting instances are loaded in memory. Next, paintings are loaded from memory and stored back to ï¬les (possibly after being modiï¬ed) as needed while executing the commands described next. Your project should support the command line interface below. Your command line interface will prompt the user for a command, and then execute the command. Here is a list of commands. Make sure not to cause any memory leaks or dangling pointers in the implementation of these commands.
1. lâList all paintings. Each painting is loaded from disk and its information (ID, title, etc.) is displayed in the userâs screen (except, of course, for the picture). Paintings are stored back on disk as needed to keep a maximum of two total paintings in memory.
2. 1 ... 5âEdit a painting. This command sets the numbered painting to be current painting. If the painting is not already in memory, it is loaded from disk and stored in the corresponding painting wrapper. In this case, a painting currently in memory may have to be stored back into its corresponding ï¬le and deleted from memory.
3. tâThis command changes the title of the current painting. The user is prompted for a new string, which becomes the new title of the painting. The current painting is not saved to ï¬le as part of this command. The new content of current painting is displayed in the userâs screen.
4. aâThis command changes the name of the author of the current painting. The user is prompted for a new string, which becomes the new author of the painting. The current painting is not saved to ï¬le as part of this command. The new content of current painting is displayed in the userâs screen.
5. sâSave all paintings. This command save the painting(s) currently in memory to the corresponding ï¬le(s). Each ï¬le is ï¬rst deleted (e.g., using the remove() C++ function). Next, an ofstream instance is opened on the named ï¬le, and the paintingâs information is saved to the ï¬le. Finally, the stream is closed.
6. qâQuits the painting manager.
Implementation notes. Your painting manager must meet the following requirements. First, each painting wrapper should handle exactly one painting. Second, clients should not be allowed to create, delete, access or modify a painting instance directly; these functions are handled by the wrapper. Third, clients should not be allowed to duplicate (copy) wrappers, or to modify the painting instance associated with a wrapper. Finally, you must code the linked list yourself, without relying on classes deï¬ned, e.g., in the Standard Template Library (STL) or other libraries. You must work alone on this project. Save all your code in a collection of header and code ï¬les and submit a zip archive with a (short) readme ï¬le containing instructions on how to use your Painting Manager. The archive should also contain ï¬ve text ï¬les describing each of your initial paintings. Submit the archive by clicking on the link provided with this assignment. Your code should compile under the GNU C++ compiler. No late submissions will be accepted.

Posted by:


Post date:




Download link: mp3.pdf

upload program

    This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
    C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.