954,510 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Constructor ?

actually I went the wrong way I think, below is the the partial code area and the bold shows what needs tobe, but I know I didnt do it right, can anyone show me an example or where to find help?

if  (myFields[c_shapeNameField].equals(ShapeName.circle)){
    <strong>//ASSIGN a new Circle object to shapes[index], passing the Circle constructor the following arguments:</strong>
     Shape[index] = new Circle(Integer.parseInt(myFields[c_xCoordinateField]),
     Integer.parseInt(myFields[c_yCoordinateField]), Integer.parseInt(myFields[c_radiusField])); 
     }
     else if  (myFields[c_shapeNameField].equals(ShapeName.cube)){
     <strong>//ASSIGN a new Cube object to shapes[index], passing the Cube constructor the following arguments:</strong>
     Cube shape = new Cube(Integer.parseInt(myFields[c_xCoordinateField]),
     Integer.parseInt(myFields[c_yCoordinateField]), Integer.parseInt(myFields[c_sideField]));
        }
     else if  (myFields[c_shapeNameField].equals(ShapeName.sphere)){
     <strong>//ASSIGN a new Sphere object to shapes[index], passing the Sphere constructor the following arguments:</strong>
     Sphere shape = new Sphere(Integer.parseInt(myFields[c_xCoordinateField]),
     Integer.parseInt(myFields[c_yCoordinateField]), Integer.parseInt(myFields[c_radiusField]));
        }
     else if  (myFields[c_shapeNameField].equals(ShapeName.square)){
     <strong>//ASSIGN a new Square object to shapes[index], passing the Square constructor the following arguments:</strong>
     Square shape = new Square(Integer.parseInt(myFields[c_xCoordinateField]),
     Integer.parseInt(myFields[c_yCoordinateField]), Integer.parseInt(myFields[c_sideField]));
          }
iwlu
Newbie Poster
11 posts since Sep 2006
Reputation Points: 12
Solved Threads: 0
 

without knowing what you're trying to do it's kinda hard to give you hints on how to do it.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You