Write down all the shapes you can think of–both two-dimensional and three-dimensional– and form those shapes into a shape hierarchy. Your hierarchy should have superclass Shape, from which class TwoDimensionalShape and class ThreeDimensionalShape are derived. Once you have developed the hierarchy, define each of the classes in the hierarchy. We will use this hierarchy in the exercises to process all shapes as objects of superclass Shape.

i hAVE DONE THIS SO FAR BUT NOW I AM REALLY LOST

public class Shapes {
	int width;
	int length;
	int name;
	int numberOfSides;
	public void displayShape(int x){
		system.out.println("Shapes of diffent dimension")
	}
	public class TwoDimShape extends Shapes{
			public void displayShape(int x) {
			System.out.println("Two dimensional shapes");
				}
	public class ThreeDimShape extends Shapes {
		int height;
		public void displayShape(int x)
			System.out.println("Three dimensional shapes");
	}
		
    public class quadlateral extends TwoDimShape {
    	public void displayshape(x);
    		System.out.println("Quadlateral shapes");
    }
    public class sphere extends ThreeDimShape {
    	public void displayshape(x);
    		System.out.println("Sphere");
    }
    public static void main(String[] args) {
    	
    	Scanner input = new Scanner( System.in );
    	
    }
}

Recommended Answers

All 2 Replies

Make a list of the programs requirements:
1) do this
2) do that
etc

and then say which ones you have completed and which ones you are working on.

Please edit your code and wrap it in code tags. Use the [code] icon above the input box.

commented: Good advice to newbies on how to get started on a problem. +3

Make a sort of family tree. Just do it on paper. Basicly just do what the assignment says, just don't start coding right away if you haven't fully figured out what you want to do. It saves a lot of time recoding and bug squashing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.