id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

apcsaPrimitivesDecimalPlaces


Given a double, convert it to its standard String representation and return the number of digits that appear after the decimal point. Assume the standard Java String.valueOf(double) conversion (e.g., 123.0 becomes "123.0", 123.45 becomes "123.45"). Precondition: input will not be a special double value.


apcsaPrimitivesDecimalPlaces(123.45) → 2
apcsaPrimitivesDecimalPlaces(123.0) → 1
apcsaPrimitivesDecimalPlaces(7.12345) → 5

...Save, Compile, Run (ctrl-enter)

public int apcsaPrimitivesDecimalPlaces(double num) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 100

Copyright Nick Parlante 2017 - privacy