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