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

Android Build a Weather App (2015) Exploring an API Android Warm-Up

Ben Holland
PLUS
Ben Holland
Courses Plus Student 4,062 Points

Having 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;

}

Forecast.java
public class Forecast {

  private int mHighTemp;
  private int mLowtemp;
  private int mPrecipChance = double;




}

2 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Ben;

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

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Great answer, Ken...thanks for replying!

Ben Holland
Ben Holland
Courses Plus Student 4,062 Points

Thanks guys , just solved it last night. was a silly mistake .

Another silly mistake..

To pass the challenge,

this line:

private int mLowtemp;

..needs to be

private int mLowTemp;
Ken Alger
Ken Alger
Treehouse Teacher

Mr. 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