In this lab you will write your first independent program. The program first defines a function that paints a simple square shaped picture at a given location and of a specified size. The main program then calls this function several times, testing that the function is well defined and illustrating simple user interfaces.
You goal is to write a program that performs the following tasks:
The Shell.cpp file contains the usual skeleton of main function and a skeleton of a function Picture(int x, int y, double size). In addition, two calls of the Picture function are included in main for illustration. You will need to modify Picture function so it paints something nice and you will build four other functions that will supervise the painting of several of your pictures in different sizes and configurations.
In order to write this program, start with thinking with a piece of graph paper. Design a simple picture and record the needed information (coordinates in terms of the top left corner x,y and the given size). Note that size has been defined as double and so you can safely use quantities such as 2.5 * size or size/3. Use the sample code in Picture function as a guide.
Design the function Picture - by writing the entire code on paper first.
Implement your picture code and make sure it works correctly with the existing code in main.
Once this is done, save your Shell.cpp and copy it into a folder labeled FirstPicture.
Now you are ready to test your Picture function thoroughly. To do this you need to declare and define four functions and call these functions from main as specified above. Each function should start with clearing the display.
Test each function after you build it and before you go on to the next one. As you are working on the different tasks, make sure your program is readable. Use comments, tell the reader which task is being performed, use extra blank lines to separate different kinds of actions, use identifiers that are meaningful. Part of your grade will depend on the organization and readability of your program. You may even finish up at home, adding comments and polishing the final layout of the source code.
Once your program is correct, you need to do the following:
· Save the Shell.cpp file (though you had to do it every time you ran the program).
· Print the Shell.cpp file by selecting Print command from the File menu.
· Print an extra copy for one for the two partners - the other one will get back the graded copy.
· Close the Visual C++ environment - ask if you do not know how.
· Copy the Shell.cpp file onto a diskette into a folder labeled PictureLab to hand in, and onto backup diskettes for yourself and for your partner.
· Label the diskette so it shows both names and the name of the lab (Picture Lab).
· Erase all your work from the D drive.
· Hand in the Shell.cpp printout and the diskette.