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 trialRiley Spencer
1,753 PointsCan't Complete Binary Operators Challenge 1
So, I just finished watching the first video on Binary Operators, and now I'm onto the challenge, but I can't complete it! I understand what the task is telling me to do: times the height and width together, and then divide the result by 12.
As you can see in the attached code, I have times the two measurements together in a constant called area, and then divided the results by 12 in a different constant named areaInFeet (it's called areaInFeet because the task told me to name it that).
Any help would be appreciated!
// the height and width of a wall
let height = 120.0 // in inches
let width = 144.0 // in inches
let area = height * width
let areaInFeet = area / 12
1 Answer
William Li
Courses Plus Student 26,868 PointsYou can do it in one line, no need for an extra area
variable; also, the math isn't quite correct.
let areaInFeet = (height / 12) * (width / 12)
That should do it. height
and width
both need to be in unit of feet before multiplying to get the areaInFeet
.
Riley Spencer
1,753 PointsRiley Spencer
1,753 PointsOh, ok! That makes a lot more sense. Thankyou!
William Li
Courses Plus Student 26,868 PointsWilliam Li
Courses Plus Student 26,868 PointsYou're welcome, happy to help :)