![](https://avatars.plurk.com/6883153-medium51844497.gif)
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?"
![](https://avatars.plurk.com/6883153-medium51844497.gif)
Levi
idk man rename the class to something that isn't Earth????
![](https://avatars.plurk.com/6883153-medium51844497.gif)
Levi
that fixes everything
![](https://avatars.plurk.com/6883153-medium51844497.gif)
Levi
idk if that's the answer it wants tho
![](https://avatars.plurk.com/6883153-medium51844497.gif)
Levi
I will be very mad if that's the actual answer
![](https://avatars.plurk.com/7085887-medium52103407.gif)
EsperBot
What they're going for is making al the methods and properties are static
![](https://avatars.plurk.com/6883153-medium51844497.gif)
Levi
'cause if it ain't named Earth you can instantiate all the planet objects you want
![](https://avatars.plurk.com/7085887-medium52103407.gif)
EsperBot
but it's a really stupid example
![](https://avatars.plurk.com/6883153-medium51844497.gif)
Levi
yeah that's what I thought the answer was
![](https://avatars.plurk.com/6883153-medium51844497.gif)
Levi
it's just the question is worded in a stupid way
![](https://avatars.plurk.com/7085887-medium52103407.gif)
EsperBot
you would not design your class hierarchy in this way
![](https://avatars.plurk.com/7085887-medium52103407.gif)
EsperBot
Also you would probably make the constructor private to keep anyone from trying to instantiate it
![](https://avatars.plurk.com/6883153-medium51844497.gif)
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
![](https://avatars.plurk.com/7085887-medium52103407.gif)
EsperBot
...how DO you? Is there a formula or do you just need to break down the shape into smaller shapes
![](https://avatars.plurk.com/6883153-medium51844497.gif)
Levi
if you have the length of one side there are formulas you can use
![](https://avatars.plurk.com/6883153-medium51844497.gif)
Levi
or you can indeed break them down into triangles
![](https://avatars.plurk.com/6883153-medium51844497.gif)
Levi
Octagon is 2(1 + sqrt(2))a^2 (where a = length of one side)
![](https://avatars.plurk.com/6883153-medium51844497.gif)
Levi
Hexagon is (3sqrt(2)) / 2 a^2
![](https://avatars.plurk.com/6883153-medium51844497.gif)
Levi
uhhh plurk formatting killed that
![](https://avatars.plurk.com/6883153-medium51844497.gif)
Levi
<- hexagon area
![https://images.plurk.com/2V5xogJ4EnG30f6O2iHZgI.png](https://images.plurk.com/mx_2V5xogJ4EnG30f6O2iHZgI.jpg)
![](https://avatars.plurk.com/6883153-medium51844497.gif)
Levi
pentagon is "fuck you for trying to explain this in words" or
![https://images.plurk.com/1Ax8zYIkOcSaJsdsBUWkVb.png](https://images.plurk.com/mx_1Ax8zYIkOcSaJsdsBUWkVb.jpg)
![](https://avatars.plurk.com/6883153-medium51844497.gif)
Levi
would probably be easier to just program a function to do it but no they want a written explanation
![](https://avatars.plurk.com/6883153-medium51844497.gif)
Levi
why are you doing this to me
![](https://avatars.plurk.com/6883153-medium51844497.gif)
Levi
click the pentagon picture it cuts off the last part