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 trialBen Holland
Courses Plus Student 4,062 PointsHaving trouble with mPrecipChance in Challenge Task2.
Heres my code could anybody help ?
public class Forecast {
private int mLowTemp; private int mHighTemp; private int mPrecipChance = double;
}
public class Forecast {
private int mHighTemp;
private int mLowtemp;
private int mPrecipChance = double;
}
2 Answers
Ken Alger
Treehouse TeacherBen;
You are declaring your mPrecipChance
incorrectly. Double is a Java primitive variable type which can hold very large (or small) numbers. The maximum and minimum values are 17 followed by 307 zeros. You can read more about Java primitive data types here.
You declare them in a similar fashion as strings and integers. The line of code for this challenge should look like:
private double mPrecipChance;
Hope it helps and happy coding.
Ken
james white
78,399 PointsAnother silly mistake..
To pass the challenge,
this line:
private int mLowtemp;
..needs to be
private int mLowTemp;
Ken Alger
Treehouse TeacherMr. White;
You are correct to pass the challenge and to follow standard naming conventions that change is necessary. Fortunately the error for this mistake is a little more explicit. As you know the code would function properly with a variable named mLowtemp
. I believe the real challenge in this case is knowing that double is a different data type.
Ken
Ben Jakuben
Treehouse TeacherBen Jakuben
Treehouse TeacherGreat answer, Ken...thanks for replying!
Ben Holland
Courses Plus Student 4,062 PointsBen Holland
Courses Plus Student 4,062 PointsThanks guys , just solved it last night. was a silly mistake .