Q:

I am trying to Write a class definition for a Pyramid. but for some reason it want run. i am beginner and very lost

this is the main method to demo the class.
My class should have these variables:  double Width, Height,
    and it should should have these methods:  SetWidthHeight(double W, double H),  GetVolume().
     import java.util.*;

        public class egypt
        {
           public static void main(String[] args)
           {
              Scanner in = new Scanner(System.in);
              Pyramid Luxor = new Pyramid();
              double W, H;
              System.out.println("Enter Luxor's width:");
              W = in.nextDouble();
              System.out.println("Enter Luxor's height:");
              H = in.nextDouble();

              Luxor.SetWidthHeight(W, H);
              System.out.println("Luxor has volume of " + Luxor.GetVolume());
              System.out.println("Luxor has a Surface Area of " + getSurfaceArea());
           }
        }

       //This class describes pyramids with a square base.

        class Pyramid
        {
          private double Height;
          private double Width ;

          public Pyramid(double W, double H)
           {
                Height = H; Width = W;
        }

           public double GetVolume()
           {
              return Height * Width * Width / 3;
           }

           public double getSurfaceArea()
           {
              double sideLength = Math.sqrt(Height * Height
                 + Width * Width/ 4);
              return 2 * Width * sideLength;
           }
        }

the error     

C:\Users\A1.D257\Desktop\jaava\egypt.java:8: error: constructor
  Pyramid in class Pyramid cannot be applied to given types;
        Pyramid Luxor = new Pyramid();
                        ^   required: double,double   found: no arguments   reason: actual and formal argument lists differ in length
C:\Users\A1.D257\Desktop\jaava\egypt.java:15: error: cannot find
  symbol
        Luxor.SetWidthHeight(W, H);
             ^   symbol:   method SetWidthHeight(double,double)   location: variable Luxor of type Pyramid
C:\Users\A1.D257\Desktop\jaava\egypt.java:17: error: cannot find
  symbol
        System.out.println("Luxor has a Surface Area of " + getSurfaceArea());
                                                            ^   symbol:   method getSurfaceArea()   location: class egypt 3 errors
Tool completed with exit code 1

A:

Your compiler errors:
1) line 8 of egypt.java - Pyramid() cannot be created because you only have one constructor and it expects two arguments 
 public Pyramid(double W, double H)
 {
        Height = H; Width = W;
 }

2) line 15 of egypt.java - you never created the function SetWidthHeight() in class Pyramid.java
3) line 17 of egypt.java getSurfaceArea() is not defined in this scope - just a little mistake you needed to call Luxor.getSurfaceArea()
Fixed the errors to show you exactly how to improve the code
import java.util.*;

// Class name should start uppercase
public class Egypt
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        Pyramid luxor; // start with lowercase
        double width, height; // start with lowercase

        // Get input values
        System.out.println("Enter Luxor's width:");
        width = in.nextDouble();
        System.out.println("Enter Luxor's height:");
        height = in.nextDouble();

        // Initialize variable
        luxor = new Pyramid(width, height);

        System.out.println("Luxor has volume of " + luxor.getVolume());
        System.out.println("Luxor has a Surface Area of " + luxor.getSurfaceArea());
    }
}

// This class describes pyramids with a square base.
public class Pyramid
{
    private double height;
    private double width;

    public Pyramid(double width, double height)
    {
        this.height = height; this.width = width;
    }

    public double getVolume()
    {
        return height * width * width / 3;
    }

    public double getSurfaceArea()
    {
        double sideLength = Math.sqrt(height * height
                + width * width/ 4);
        return 2 * width * sideLength;
    }
}

