Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Barry Ort](https://secure.gravatar.com/avatar/2d3a640b72c23b3e927bbc004770da52?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Barry Ort
12,373 Pointswhat's the correct answer?
I can't figure out what the correct answer is.
namespace Treehouse.CodeChallenges
{
class Square : Polygon
{
public double SideLength { get; private set; }
public Square(double sideLength) : base(4)
{
SideLength = sideLength;
}
}
}
namespace Treehouse.CodeChallenges
{
public class Polygon
{
public int NumSides { get; private set; }
public Polygon(int numSides)
{
NumSides = numSides;
}
}
}
![Barry Ort](https://secure.gravatar.com/avatar/2d3a640b72c23b3e927bbc004770da52?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Barry Ort
12,373 PointsI've been working in this for a few days now and I've tried out a bunch of things that didn't work. I followed the error messages that are displayed on preview and this one had the least errors (only 1).
namespace Treehouse.CodeChallenges
{
class Square : Polygon
{
public double SideLength { get; private set; }
public Square(double sideLength) : base(4)
{
SideLength = sideLength;
}
public double Area
{
get
{
return SideLength *= SideLength;
}
}
}
3 Answers
![Patricia Hector](https://secure.gravatar.com/avatar/0bd705e9c81b78ca1d688cbf04490300?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Patricia Hector
42,901 PointsCheck it from inside to outside -your SideLength property is closed, you have two curly brackets { ...} -your constructor (Square) is closed as well, two curly brackets {...} -your Area property and class Square have two -but your namespace has one open curly bracket but there is not a close curly bracket
You can also use a trick: count how many open curly brackets and close curly brackets you have. If the result is the same, everything is fine if it's not, then check your work again. In this case, just add one to the end of the document.
![Barry Ort](https://secure.gravatar.com/avatar/2d3a640b72c23b3e927bbc004770da52?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Barry Ort
12,373 PointsFantastic you were right! Thatnk s lot!
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsYou're really close there.
There was originally a closing brace on line 10, but it seems to have gone missing. Be sure to put it back.
But you also don't want to use a multiplication assignment operator ("*=
") in your computed property. This permanently changes the value of SideLength. All you need is an ordinary multiplication operator ("*
").
The challenge might let you get away with it, but it shouldn't. That's actually a bug in the challenge and you might want to report it to Support.
![Patricia Hector](https://secure.gravatar.com/avatar/0bd705e9c81b78ca1d688cbf04490300?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Patricia Hector
42,901 PointsEverything is fine Barry, you are just missing a curly bracket after your property.)
![Barry Ort](https://secure.gravatar.com/avatar/2d3a640b72c23b3e927bbc004770da52?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Barry Ort
12,373 Pointsbesides the one that is under it?
Steven Parker
230,688 PointsSteven Parker
230,688 PointsIt doesn't look like you've written any code yet.
At least please give it a good-faith attempt and then ask for help if you have trouble.
And as a hint: the area of a square is side length multiplied by itself.