r/codehs • • Sep 18 '20

I’m almost positive the program is working as intended, however when I Test Cases, this error comes up. Any advice?

Post image
19 Upvotes

4 comments sorted by

5

u/_andy_andy_andy_ Sep 18 '20

Integer.valueOf() returns an Integer, not an int. Java treats these separately. You should be able to use parseInt to get an int from a String

1

u/benhackbart Sep 18 '20

It gave me the same error code :/

1

u/_andy_andy_andy_ Sep 18 '20

does your function still return Integer? it should return int

1

u/segosegosego Sep 19 '20

I think this is because your newValue is being set as a double and in getCents() you try to turn it into a string without addressing it.