Levi
[Adventures in Learning Programming] Q: "we made a class called Earth to make a planet object called Earth but there's only one Earth we don't want multiple Earths how do we modify the class so the properties are useable without instantiating the class?"
Levi
idk man rename the class to something that isn't Earth????
Levi
that fixes everything
Levi
idk if that's the answer it wants tho
Levi
I will be very mad if that's the actual answer
EsperBot
What they're going for is making al the methods and properties are static
Levi
'cause if it ain't named Earth you can instantiate all the planet objects you want
EsperBot
but it's a really stupid example
Levi
yeah that's what I thought the answer was
Levi
it's just the question is worded in a stupid way
EsperBot
you would not design your class hierarchy in this way
EsperBot
Also you would probably make the constructor private to keep anyone from trying to instantiate it
Levi
I also had to spend 20 minutes trying to explain in text how to calculate the areas of pentagons, hexagons, and octagons and i am very mad about it
EsperBot
...how DO you? Is there a formula or do you just need to break down the shape into smaller shapes
Levi
if you have the length of one side there are formulas you can use
Levi
or you can indeed break them down into triangles
Levi
Octagon is 2(1 + sqrt(2))a^2 (where a = length of one side)
Levi
Hexagon is (3sqrt(2)) / 2 a^2
Levi
uhhh plurk formatting killed that
Levi
<- hexagon area
Levi
pentagon is "fuck you for trying to explain this in words" or
Levi
would probably be easier to just program a function to do it but no they want a written explanation
Levi
why are you doing this to me
Levi
click the pentagon picture it cuts off the last part