Menu
Question Index
...


Write a program to get maximum number of decimal count for the given numbers. When the input list is empty or null, should return -1.

Input (List of double values) Output
[12.98, 34.5567, 22.31256, 78.9012, 21.1234] 5
[-32.00, -41.023, 23.34, -67.547, -97.1234] 4
[] -1
null -1

class MaximumDecimalCount

{    public static void main(String s[])
    {
        List list = new ArrayList();
        list.add(12.098);
        list.add(32.02);
        list.add(25.345765);
        list.add(47.12);
        list.add(89.023);
        list.add(567.345);
        int result = getMaximumDecimalCount(list);
        System.out.println("The maximum decimal count of values "+list+" is "+result);

    }


public static int getMaximumDecimalCount(List<Double> list)
{
int result = -1;
//Write a code to get the maximum decimal count for given values
return result;
}
public static int getDecimalCount(Double value)
{
int result = 0;
//Write a code to get the decimal count for given value
return result;
}
}

Doubts

Problems

Topic: Collection Framework In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App