Need help

this is for java, save me

 

Step 1: Write the class declaration for class Square that has a private instance variable side of type double and a no-argument constructor that sets the side to 1.0 by calling a method named setSide that you will declare in step 2.

 

Step 2: Write a method setSide for the class you defined in step1. Set the side variable to the argument of the method. Also make sure that the side is not less than 0.0. If it is, keep the default setting of 1.0.

 

Step 3: Write a method getSide for the class you modified in step2 that retrieves the value of instance variable side.

 

Step 4: Define another constructor for the class that takes one argument, the side, and uses the Square’s set method to set the side.

 

Step 5: Write a method computeArea for the class that computes the area of a Square.

 

Step 6: Define a toString method for the class that will return a String containing the value of side and the area of the Square.

 

You may use the SquareTest below to test your assignment:

 

 

import java.util.Scanner;

 

public class SquareTest

 {

 // set up GUI components and instantiate new MyRectangle

 public static void main( String args[] )

 {

 Scanner input = new Scanner( System.in );

 

 // create a new Square with no initial values

 Square square = new Square();

 

 System.out.print( "Please enter a double value for the side of the square: " );

 

 double double1 = input.nextDouble();

 

 square.setSide( double1 );

 

System.out.println( square ); // see the results of the test

 } // end main

} // end class SquareTest

 

------------------------------------------------------------------------------------------------------------------------------------------

and i have this so far



public class Square
{
     // a double type of private instance variable
          private double side;
         
     // one of the side is set to 1.0 with no arguments constructor
         
              public double Side( double );
              
               {   side = 1.0;  
                  setSide (side);
                  }
                  
                  
                      
         public double side();
                           
        {  
         if (side <0.0)    
         side = 1.0;
        else    
        side = s;
            }
                               
         public double getSide ()
          {
             return s;
                        }
                                    
          public double computeArea ();
          //compute are for the sides of triangle
          {  
           Double Area = 0;   
           Area = newside * newside;  
           System.out.println("The Square Area is" + Area);
            }
                                         
            public static void main (String [] args)
          {   
          square s = new square (6);   
          s.computeArea ();
            }
}

Firstly, I don't touch Java at all, but as far as I'm aware a constructor should always be the same name as your class you are wanting to construct.

http://pastebin.com/Haiiy7Lu

I haven't done your homework for you, but given you something that explains constructors and a C# example. Simply put this is the proper basics of Object Orientated Programming and if you want to get anywhere you have to learn it. If you get other people to do this for you at this low of a level then you'll hinder your understanding massively.

Just get some books and read. Once you understand this and wrap you head around this concept of classes and separated encapsulation, programming will become easy quick.