My question is about programming. I want to know who the CDF will be:

That's the problem:

Read a floating point value with two decimals. This value represents a monetary value. Next, calculate the least number of possible bills and coins in which the value can be decomposed. The notes considered are 100, 50, 20, 10, 5, 2. The possible currencies are 1, 0.50, 0.25, 0.10, 0.05 and 0.01. Next, show the list of necessary notes.

….

….

….

I have programmed this code in Java:

import java.util.Scanner;

public class Main {

public static void main (String[] args)

{

Scanner input = new Scanner (System.in);

int int100 = 0;

int cont50 = 0;

int int20 = 0;

int int10 = 0;

int int5 = 0;

int int2 = 0;

// coins

int int1 = 0;

int cont0_50 = 0;

int int0_25 = 0;

int cont0_10 = 0;

int cont0_05 = 0;

int cont0_01 = 0;

double value;

value = input.nextFloat ();

while (value> = 100.00) {

value = value-100;

cont100 ++;

}

while (value> = 50.00) {

value = value-50;

cont50 ++;

}

while (value> = 20.00) {

value = value-20;

cont20 ++;

}

while (value> = 10.00) {

value = value-10;

cont10 ++;

}

while (value> = 5.00) {

value = value-5;

cont5 ++;

}

while (value> = 2.00) {

value = value-2;

cont2 ++;

}

// now the coins

while (value> = 1.00) {

value = value-1;

CONT1 ++;

}

while (value> = 0.50) {

value = value-0.50;

cont0_50 ++;

}

while (value> = 0.25) {

value = value-0.25;

cont0_25 ++;

}

while (value> = 0.10) {

value = value-0.10;

cont0_10 ++;

}

while (value> = 0.05) {

value = value-0.05;

cont0_05 ++;

}

while (value> = 0.01) {

value = value-0.01;

cont0_01 ++;

}

System.out.println ("notes");

System.out.println (cont100 + "note (s) of R $ 100.00");

System.out.println (cont50 + "note (s) of R $ 50.00");

System.out.println (cont20 + "note (s) of R $ 20.00");

System.out.println (cont10 + "note (s) of R $ 10.00");

System.out.println (cont5 + "note (s) of R $ 5.00");

System.out.println (cont2 + "note (s) of R $ 2.00");

System.out.println ("COIN");

System.out.println (cont1 + "currency (s) of R $ 1.00");

System.out.println (cont0_50 + "currency (s) of R $ 0.50");

System.out.println (cont0_25 + "currency (s) of R $ 0.25");

System.out.println (cont0_10 + "currency (s) of R $ 0.10");

System.out.println (cont0_05 + "currency (s) of R $ 0.05");

System.out.print (cont0_01 + "currency (s) of R $ 0.01");

}

}

The problem occurs when I put the value of R $ 0.02 as input, it is returned:

NOTES:

0 note (s) of R $ 100.00

0 note (s) of R $ 50.00

0 note (s) from R $ 20.00

0 note (s) from R $ 10.00

0 note (s) of R $ 5.00

0 note (s) from R $ 2.00

COINS:

0 currency (s) of R $ 1.00

0 currency (s) of R $ 0.50

0 currency (s) of R $ 0.25

0 currency (s) of R $ 0.10

0 currency (s) of R $ 0.05

1 coin (s) of R $ 0.01

SHOULD HAVE RETURNS: 2 coin (s) of R $ 0.01 in the last line !!!!

This problem occurs with other values that involve cents …

Well, with numbers like R $ 100.00 and 350.00, for example, the program works perfectly.

Can someone show my code error please?