# just wana see what u think

• 02-25-2011, 02:31 AM
andrewj24
just wana see what u think
Hi im new to this forum!
Im taking intro to java.
one of my assignments is to figure out how many quarters,nickles,dimes,pennies i am supposed to return for change.
i got it working just wana get input on improvements or other ways that this should be done.

```import java.util.Scanner; import java.util.*; public class J3 {   public static void main(String[] args)   { while(true){ float change3,total,bill=0; int change,change2,quarter,dime,nickel,pennie,doller; Scanner input = new Scanner(System.in); System.out.println("What is the total amount?\n"); total=input.nextFloat();     while (bill<total){ System.out.printf("Please enter payment amount\n"); bill=input.nextFloat(); } change3=bill-total; System.out.printf("Your change is %.2f\n",change3); bill*=100; total*=100; int bill2 = (int) bill; int total2 = (int) total; change2=bill2-total2; change=change2; doller=change/100; change=change%100; quarter=change/25; change=change%25; dime=change/10; change=change%10; nickel=change/5; change=change%5; pennie=change/1; System.out.printf("%d doller(s)\n",doller); System.out.printf("%d quarter(s)\n",quarter); System.out.printf("%d dime(s)\n",dime); System.out.printf("%d nickel(s)\n",nickel); System.out.printf("%d pennie(s)\n",pennie); } } }```