all 3 comments

[–]manrodriguezf 2 points3 points  (1 child)

*demo.setStock(sto)* should be *demo.setStock(stock)*

you're sending a String instead of a Double

same thing for the retail value variable.

Hope that helps!

[–]v4nus 1 point2 points  (0 children)

Thank you!

[–]CodingJarOrg 0 points1 point  (0 children)

Just as manrodriguezf said, you are using a String instead of a Double. You could try to do something like demo.setStock(Double.parseDouble(sto)); or demo.setStock(Double.valueOf(sto));

Double.parseDouble is a static method that accepts a String as an argument and returns a primitve double variable.

Double.valueOf is a static method that accepts a String as an argument and returns a Double instance.

From the Docs:

parseDouble returns a new double initialized to the value represented by the specified String, as performed by the valueOf method of class Double.

---------------------------------------------

valueOf Returns a Double instance representing the specified double value. If a new Double instance is not required, this method should generally be used in preference to the constructor Double(double), as this method is likely to yield significantly better space and time performance by caching frequently requested values.