repl.it
@imigames/

change

Java

No description

fork
loading
Files
  • Main.java
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import java.util.Scanner;
import java.lang.Math;
class Main {
public static void main(String[] args) {
     Scanner input = new Scanner(System.in);
     System.out.println("Enter amount) ");
     double amount = input.nextDouble();
     int amountInt = (int) (amount * 100);

     double tmp;
     if(amount >= 100)
         {
         tmp = (int) amount/100;
         System.out.println (tmp + "$100 bills");
         amount = amount % 100;
         }
     if(amount >= 50)
         {
         tmp = (int) amount/50;
         System.out.println (tmp + "$50 bills");
         amount = amount % 50;
         }
    if(amount >= 20)
    {
        tmp = (int) amount/20;
        System.out.println (tmp + "$20 bills");
        amount = amount % 20;
    }
    if(amount >= 10)
    {
        tmp= (int) amount/10;
        System.out.println (tmp + "$10 bills");
        amount = amount % 10;
    }
    if(amount >= 5)
    {
        tmp = (int) amount/5;
        System.out.println (tmp + "$5 bills");
        amount = amount % 5;
    }
    if(amount >= 1)
    {
        tmp = (int) amount/1;
        System.out.println (tmp + "$1 bills");
        amount = amount % 1;
    }
    if(amount >= .25)
    {
        tmp = (int) amount/.25;
        System.out.println (tmp + "quater");
        amount = amount % 25;
    }
    if(amount >= .10)
    {
        tmp = (int) amount/.10;
        System.out.println (tmp + "dime");
        amount = amount % .10;
    }
    if(amount >= .05)
    {
        tmp = (int) amount/.05;
        System.out.println (tmp + "nickel");
        amount = amount % .05;
    }
    if(amount >= .01)
    {
        tmp = (int) amount/.01;
        System.out.println (tmp + "penny");
        amount = amount % .01;
    }
}
}