I am trying to make a histogram with inputting a value and rounding it. The rounded value should print out the number of asterisks.
I did the following code and inputted a value but, the output is coming out as nothing.
public class Histogram
{
public static void main(String args[])
{
histogram obj = new histogram();
obj.histogram(13.5);
}
}
class histogram
{
public void histogram(double num)
{
int roundNum = (int)(num);
if (roundNum == 14)
{
System.out.println("**************" + num);
}
if (roundNum == 3)
{
System.out.println("***" + num);
}
if (roundNum == 16)
{
System.out.println("****************" + num);
}
if (roundNum == 0)
{
System.out.println("" + num);
}
if (roundNum == 1)
{
System.out.println("*" + num);
}
}
}