Design a cashier change maker that will take as input: a floating point value. Value: "change due" and will convert it to proper currency (from $20 down to pennies) amounts to be handed as change to the customer
i am not sure how to use the rounding correctly every time i enter a new amount it does not work
import java.util.Scanner;
public class cashier
{
public static void main(String [] args)
{
Scanner kbd = new Scanner(System.in);
float bill_20;
float bill_10;
float bill_5;
float bill_1;
float quarters;
float dimes;
float nickels;
float pennies;
float change_Due;
System.out.println("How much money do you have ");
change_Due = kbd.nextFloat();
bill_20 = change_Due / 20f;
change_Due = change_Due % 20f;
bill_10 = change_Due / 10f;
change_Due = change_Due % 10f;
bill_5 = change_Due / 5f;
change_Due = change_Due % 5f;
bill_1 = change_Due / 1f;
change_Due = change_Due % 1f;
quarters = change_Due / 0.25f;
change_Due = change_Due % 0.25f;
dimes = change_Due / 0.10f;
change_Due = change_Due % 0.10f;
nickels = change_Due / 0.05f;
change_Due = change_Due % 0.05f;
pennies = change_Due / 0.01f;
change_Due = change_Due % 0.01f;
System.out.printf("$20 bill: %1.0f\n", bill_20);
System.out.printf("$10 bill: %1.0f\n", bill_10);
System.out.printf("$5 bill: %1.0f\n" , bill_5 );
System.out.printf("$1 bill: %1.0f\n" , bill_1 );
System.out.printf("quarter: %1.0f\n" , quarters);
System.out.printf("dimes: %1.0f\n" , dimes);
System.out.printf("nickels: %1.0f\n" , nickels);
System.out.printf("pennies: %1.0f\n" , pennies);
}
}