fork download
  1. class Ideone
  2. {
  3. String m(float f,int p){int g=(int)f,i=0;String h="",q=""+g;int c=q.length();for(;i++<c;)h+=" ";for(;i<=c+p;i++)h+="-";for(i=c;i<c+Math.round((f-g)*p);i++)q+="|";for(;i++<p+c;)q+=" ";return q+(g+1)+"\n"+h;}
  4. public static void main (String[] args)
  5. {
  6. args=new java.util.Scanner(System.in).nextLine().split(",");
  7. float s=Float.valueOf(args[0]);int p=Integer.valueOf(args[1]);
  8. System.out.println(new Ideone().m(s,p));
  9. }
  10. }
Success #stdin #stdout 0.13s 321344KB
stdin
20.16,12
stdout
20||          21
  ------------