/* In Class exercise: 03/24/2016 * You are required to write part of a class for a Square. * It has one data attribute - sideLength. * You only need to write the two constructors - one with parameters, one without, and the accessor and mutator for side length. */ class Square { //one data attribute double sideLength; //can also be int. If you choose int, adjust the methods accordingly //constructors public Square() { sideLength = 10; //any other positive number is also OK. } public Square ( double side) { sideLength = side; } //accessor public double getSideLength() { return sideLength; } //mutator public void setSideLength(double s) { sideLength = s; } //If you wrote everything till here, you'll have a 100 //wrtiting main just do the program can run public static void main( String [] args) { Square sq = new Square (); Square mySquare = new Square (5.8); System.out.println("The side length of the first square is " + sq.getSideLength() + "\nThe side length of the second square is " + mySquare.getSideLength()); //changing the side length of the first one to 50 sq.setSideLength(50); System.out.println("The new side length of the first square is " + sq.getSideLength()); } }