(10 points)
Note: if you work from home, follow the instructions on the resource page to install Eclipse and the UWLibrary. Here is a description of the content of the library that you might find useful.
Winter is here. This is the time to head for the mountains and have some fun making snow men, taking walks among trees, or riding a cable car up a mountain. Unfortunately, this class doesn't include such a field trip! But we can still get a taste of the mountains by drawing a mountain scene with a Java program.
In this project, you will complete several classes to draw a picture in a graphics window. The purpose of this assignment is to give you experience writing classes in Java and using Eclipse.
Download the four files CableCar.java, MountainScene.java, SnowMan.java and Tree.java and include them in an Eclipse project (as we did in class). Run the program by clicking the Run button with the class MountainScene selected. You should get a window with a triangle and a rectangle in the lower left area (this is the beginning of the drawing of a tree with ornaments). Read through the code of MountainScene and Tree. You will see that when MountainScene is instantiated, a graphics window is created. Then a Tree object is created. As it is, the draw method of the Tree class puts a rectangle and a triangle in the graphics window. Make sure that you understand how this is happening within the code.
None of the classes given to you are complete. Your assignment is to complete the four classes and create a fith class so that an instance of MountainScene appears as a picture containing four different moutain elements. Here is a list of the requirements of the assignment :
To create the graphics elements, draw them first on a piece of graph paper. It will make it easy for you to locate each point of your drawing with respect to some reference point (x,y).
If you want to create your own colors, use the Color constructor. It reads Color(r,g,b) where r,g and b are integers between 0 and 255. The color is a mixture of red, green and blue as specified by r, g and b. For example
Color myColor = new Color(100,150,210); // a blueish color
Good luck!
Here is a possible picture (shown with only three types of elements. You have to put in a fourth one as well).
Your program has to be your own.