@NanaOhene_Nyark/

shape creator

Java

No description

fork
loading
Files
  • Main.java
  • circle.java
  • Hi-low
  • rectangle.java
  • triangle.java
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
public class ShapeCreator {

	public static void main(String[] args) {
      // Circle Code
 		System.out.println("RANDOMIZED CIRCLE");
`		System.out.println("Diameter: " + myCircle.getDiameter());
		System.out.println("Area: " + String.format( "%.2f", myCircle.getArea()));
		System.out.println("Circumference: " + String.format( "%.2f", myCircle.getCircumference()));
		System.out.println();
		myCircle.setRadius(50);
		System.out.println("RE-SIZED CIRCLE");
		System.out.println("Radius: " + myCircle.getRadius());
		System.out.println("Diameter: " + myCircle.getDiameter());
		System.out.println("Area: " + String.format( "%.2f", myCircle.getArea()));
		System.out.println("Circumference: " + String.format( "%.2f", myCircle.getCircumference()));
		System.out.println();
      
      /*
      // Rectangle Code
      Rectangle myRectangle = new Rectangle();
		System.out.println("DEFAULT RECTANGLE");
		System.out.println("Length: "+ myRectangle.getLength());
		System.out.println("Width: " + myRectangle.getWidth());
		System.out.println("Perimeter: "+myRectangle.getPerimeter());
		System.out.println("Area: " + myRectangle.getArea());
      System.out.println("Number of Sides: " + myRectangle.getNumSides());
		System.out.println();
		myRectangle.setLength(20);
		myRectangle.setWidth(10);
		System.out.println("RE-SIZED RECTANGLE");
		System.out.println("Length: "+ myRectangle.getLength());
		System.out.println("Width: " + myRectangle.getWidth());
		System.out.println("Perimeter: "+myRectangle.getPerimeter());
		System.out.println("Area: " + myRectangle.getArea());
      System.out.println("Number of Sides: " + myRectangle.getNumSides());
		System.out.println();
      */
      
      /*
      // Square Code
      Square mySquare = new Square((int)(Math.random()*100+1));
		System.out.println("RANDOMIZED SQUARE");
		System.out.println("Side Length: "+ mySquare.getSide());
		System.out.println("Perimeter: "+mySquare.getPerimeter());
		System.out.println("Area: " + mySquare.getArea());
		System.out.println();
		mySquare.setSide(15);
		System.out.println("RE-SIZED SQUARE");
		System.out.println("Side Length: "+ mySquare.getSide());
		System.out.println("Perimeter: "+mySquare.getPerimeter());
		System.out.println("Area: " + mySquare.getArea());
		System.out.println();
      */
      
      /*
      // Triangle Code 
      Triangle myTriangle = new Triangle();
		System.out.println("DEFAULT TRIANGLE");
		System.out.println("Side Length: "+ myTriangle.getSide());
		System.out.println("Perimeter: "+myTriangle.getPerimeter());
		System.out.println("Area: " + String.format( "%.2f", myTriangle.getArea()));
      System.out.println("Number of Sides: " + myTriangle.getNumSides());
		System.out.println();
		myTriangle.setSide(25);
		System.out.println("RE-SIZED TRIANGLE");
		System.out.println("Side Length: "+ myTriangle.getSide());
		System.out.println("Perimeter: "+myTriangle.getPerimeter());
		System.out.println("Area: " + String.format( "%.2f", myTriangle.getArea()));
      System.out.println("Number of Sides: " + myTriangle.getNumSides());	
      */
	}
}