Exam 2 Practice Test

THIS IS AN OPEN BOOK/OPEN NOTE EXAM.

Time Limit: 90 minutes

The exam consists of three parts. Complete part1, then complete part2, and then part3. If you complete a higher-numbered part without completing a lower-numbered part you will not get any credit for the higher-numbered part. Remember to comment your code. Commenting your code is worth 5% of your grade.
Part1: Worth 65% (Passing, but less than CTE certification level). Part2: Worth an additional 20% when part1 is also completed (CTE certification level). Part3: Worth an additional 15% when part1 and part2 are also completed.

Write an applet named ORings that looks like the one above.

1) The above applet consists of a five colored circles in a specific pattern.

2) All of the shapes should be placed using relative positioning with the variables x, y, and size. Relative position in a figure means that every point used in the code to draw the figure is related by some form of arithmetic expression to an anchor point. As such, all of the parameters should be set using these variables, or using expressions that make use of these variables.

Your submission should consist of the following files.

  • ORings.java
  • ORings.html

Below you are given the sample code for two methods: drawStar, and drawBigDipper.

You are to create three classes: the Constellation, BigDipper and BigDipperApplet classes.

1) The Constellation class, should have the attributes englishName and latinName. It should also have the methods drawStar (provided) and drawConstName. It should not be a subclass of Applet. drawConstName should display the englishName and latinName, as seen in the above example.

2) The BigDipper dipper class should be a subclass of Constellation. It should contain the drawBigDipper method.

3) The BigDipperApplet should be a dummy class that contains a BigDipper object. Using the object that you create, you assing a value to englishName and latinName. You should then call the drawBigDipper method. When viewed, the BigDipperApplet class should look like the above example.

Your submission should consist of the following files.

  • Constellation.java
  • BigDipper.java
  • BigDipperApplet.java
  • BigDipperApplet.html

Create an applet named Movie looks and functions like the one above.

1) Your applet should have four Button objects and a TextField object.

2) The Buttons shoudl be labeled as in the above example

3) When a Button is clicked, its value should be displayed in the TextField. You should use GridLayout to control the appearance of your applet.

Your submission should consist of the following files:

  • Movies.java
  • Movies.html

	public void drawStar(Graphics g, int x, int y)

	{

		g.drawLine(x + 15, y, x + 25, y + 28);

		g.drawLine(x + 25, y + 28, x, y + 10);

		g.drawLine(x, y + 10, x + 30, y + 10);

		g.drawLine(x + 30, y + 10, x + 5, y + 28);

		g.drawLine(x + 5, y + 28, x + 15, y);

		

	}





	public void drawBigDipper(Graphics g, int x, int y)

	{

		drawStar(g, 0, 25);

		drawStar(g, 65, 0);

		drawStar(g, 105, 90);

		drawStar(g, 90, 205);

		drawStar(g, 88, 275);

		drawStar(g, 225, 200);

		drawStar(g, 185, 285);

		

		drawConstName(g, x + 10, y + 325);

	}







 

 


Copyright: 1998, Carnegie Mellon University, All Rights Reserved