Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Melinda
- //12/1/15
- import java.util.*;
- public class McDonalds
- {
- public static void main (String[] args)
- {
- Scanner input = new Scanner (System.in);
- System.out.println("Enter the bill amount");
- int bill = input.nextInt();
- if (bill >= 100)
- System.out.println("I cannot accept a 100 dollar bill. Sorry.");
- else if (bill==0)
- System.out.println("No change");
- else {
- int twenty = bill/20;
- int billTemp = bill - (twenty *20);
- int ten = bill/10;
- billTemp = bill - (ten * 10);
- int five = billTemp/5;
- int ones = billTemp = (five*5);
- System.out.println(bill + " can be made using ");
- if (twenty>0)
- System.out.print(twenty + " twenties ");
- if (ten>0)
- System.out.print(ten + " tens ");
- if (five>0)
- System.out.print(five + " fives ");
- if (ones>0)
- System.out.print(ones + " ones ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement