Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a java program that can make change . Your program shouldtake two numbers

ID: 3615368 • Letter: W

Question

write a java program that can make change . Your program shouldtake two numbers as input , one that is a monetary amount chargedand the other that is a monetary amount given .It should thenreturn the number of each kind of bill and coin to give back aschange for the difference between the amount given and the amountcharged . The values assigned to the bills and coins can be basedon the monetary system of any current or former government. Try todesign your program so that it returns the fewest number of billsand coins as possible .

Explanation / Answer

please rate - thanks I used american money $20 bill and smaller, can be done withfunctions import java.util.*; public class untitled {   public static void main(String[] args)    {double bill,paid;    int amt,change;    Scanner in=new Scanner(System.in);    System.out.print("Enter amount of bill: ");    bill=in.nextDouble();    System.out.print("Enter number paid: ");    paid=in.nextDouble();    change=(int)((bill-paid+.005)*100);    //to correctdecimal round off    System.out.println("Your change is:");     amt=change/2000;    if(amt>0)          System.out.println(amt+" $20 bills");    change=change%2000;    amt=change/1000;    if(amt>0)          System.out.println(amt+" $10 bills");    change=change%1000;     amt=change/500;    if(amt>0)          System.out.println(amt+" $5 bills");    change=change%500;     amt=change/100;    if(amt>0)          System.out.println(amt+" $1 bills");    change=change%100;     amt=change/25;    if(amt>0)          System.out.println(amt+" quarters");    change=change%25;     amt=change/10;    if(amt>0)          System.out.println(amt+" dimes");    change=change%10;     amt=change/5;    if(amt>0)          System.out.println(amt+" nickels");    amt=change%5;       if(amt>0)          System.out.println(amt+" pennies");           }    }