So I need to do this with minimum code, and no if/else statement. With very basic and introductory java. For some reason, I'm having a hard time thinking through how to do this when I know the answer is so simple. Here is the assignment
"Write a program that prompts the user to enter two double values, the first one the amount due on a bill and the second item the amount of money given to the clerk. The program must make change with dollar bills, quarters, dimes, nickels, and pennies. The clerk does not have any 50 cent pieces. For this program, we can assume the amount of money given is equal to or greater than the amount due. Sample out shown below. The output needs to be readable but does not have to match pecisely."
Here is the code I have so far.
Scanner input = new Scanner(System.in);
// prompt user to input cost of purchase
System.out.println("Enter the total cost of the purchase");
// store user input as totalCost
double totalCost = input.nextDouble();
// prompt user to input amount of money they gave to clerk
System.out.println("Enter the amount of money given to the clerk");
// store user input as amountGiven
double amountGiven = input.nextDouble();
double totalChange = amountGiven - totalCost;