Question: public class DigitCounter { public static int digits(double n) { int number = (int)n; String num = Integer.toString(Math.abs (number)); // Math.abs takes the negative away

public class DigitCounter {
public static int digits(double n) {
int number = (int)n;
String num = Integer.toString(Math.abs (number)); // Math.abs takes the negative away
String[]stringArray = num.split("\\.");
return stringArray[0].length();
}
public static int digits(int n){
String num = Integer.toString(Math.abs (n)); // Math.abs takes the negative away
String[]stringArray = num.split("\\.");
return stringArray[0].length();
}
public static int digits(float n) {
int number = (int)n;
String num = Integer.toString(Math.abs (number)); // Math.abs takes the negative away
String[]stringArray = num.split("\\.");
return stringArray[0].length();
}
public static int digits(String n) {
String[]stringArray = n.split("\\.");
return stringArray[0].length();
}
public static int decimals(double n) {
String num = String.valueOf(n);
int indexOfDecimal = num.indexOf(".");
int number = num.substring(indexOfDecimal+1).length();
return number;
}
public static int decimals(int n) {
return 0;
}
public static int decimals(float n) {
String num = String.valueOf(n);
int indexOfDecimal = num.indexOf(".");
int number = num.substring(indexOfDecimal+1).length();
return number;
}
public static int decimals(String n) {
String num= n;
int indexOfDecimal = num.indexOf(".");
int number = num.substring(indexOfDecimal+1).length();
return number;
}
}
what's the UML of this problem here above?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!