-
Notifications
You must be signed in to change notification settings - Fork 0
/
Currecncy_Con.java
142 lines (94 loc) · 4.67 KB
/
Currecncy_Con.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// SIMPLE MINI JAVA PROJECT
// CURRENCY CONVERTOR
import java.util.*;
import java.text.DecimalFormat;
public class Currecncy_Con {
public static void main(String[] args) {
double amount, dollar, pound, code, euro, yen, ringgit, rupee;
DecimalFormat f = new DecimalFormat("##.##");
try (Scanner sc = new Scanner(System.in)) {
System.out.println("hi, Welcome to the Currency Converter!");
System.out.println("which currency You want to Convert ? ");
System.out.println("1:Ruppe \t2:Dollar \t3:Pound \n4:Euro \t5:Yen \t6:Ringgit ");
code = sc.nextInt();
System.out.println("How much Money you want to convert ?");
amount = sc.nextFloat();
}
// Amounts Conversion
if (code == 1) {
dollar = amount / 70;
System.out.println("Your " + amount + " Rupee is : " + f.format(dollar) + " Dollar");
pound = amount / 88;
System.out.println("Your " + amount + " Rupee is : " + f.format(pound) + " Pound");
euro = amount / 80;
System.out.println("Your " + amount + " Rupee is : " + f.format(euro) + " Euro");
yen = amount / 0.63;
System.out.println("Your " + amount + " Rupee is : " + f.format(yen) + " Yen");
ringgit = amount / 16;
System.out.println("Your " + amount + " Rupee is : " + f.format(ringgit) + " ringgit");
} else if (code == 2) {
// Dollar Conversion
rupee = amount * 70;
System.out.println("Your " + amount + " Dollar is : " + f.format(rupee) + " Ruppes");
pound = amount * 0.78;
System.out.println("Your " + amount + " Dollar is : " + f.format(pound) + " Pound");
euro = amount * 0.87;
System.out.println("Your " + amount + " Dollar is : " + f.format(euro) + " Euro");
yen = amount * 111.087;
System.out.println("Your " + amount + " Dollar is : " + f.format(yen) + " Yen");
ringgit = amount * 4.17;
System.out.println("Your " + amount + " Dollar is : " + f.format(ringgit) + " ringgit");
} else if (code == 3) {
// Pound Conversion
rupee = amount * 88;
System.out.println("Your " + amount + " pound is : " + f.format(rupee) + " Ruppes");
dollar = amount * 1.26;
System.out.println("Your " + amount + " pound is : " + f.format(dollar) + " Dollar");
euro = amount * 1.10;
System.out.println("Your " + amount + " pound is : " + f.format(euro) + " Euro");
yen = amount * 140.93;
System.out.println("Your " + amount + " pound is : " + f.format(yen) + " Yen");
ringgit = amount * 5.29;
System.out.println("Your " + amount + " pound is : " + f.format(ringgit) + " ringgit");
} else if (code == 4) {
// Euro Conversion
rupee = amount * 80;
System.out.println("Your " + amount + " euro is : " + f.format(rupee) + " Ruppes");
dollar = amount * 1.14;
System.out.println("Your " + amount + " euro is : " + f.format(dollar) + " Dollar");
pound = amount * 0.90;
System.out.println("Your " + amount + " euro is : " + f.format(pound) + " Pound");
yen = amount * 127.32;
System.out.println("Your " + amount + " euro is : " + f.format(yen) + " Yen");
ringgit = amount * 4.78;
System.out.println("Your " + amount + " euro is : " + f.format(ringgit) + " ringgit");
} else if (code == 5) {
// Yen Conversion
rupee = amount * 0.63;
System.out.println("Your " + amount + " yen is : " + f.format(rupee) + " Ruppes");
dollar = amount * 0.008;
System.out.println("Your " + amount + " yen is : " + f.format(dollar) + " Dollar");
pound = amount * 0.007;
System.out.println("Your " + amount + " yen is : " + f.format(pound) + " Pound");
euro = amount * 0.007;
System.out.println("Your " + amount + " yen is : " + f.format(euro) + " Euro");
ringgit = amount * 0.037;
System.out.println("Your " + amount + " yen is : " + f.format(ringgit) + " ringgit");
} else if (code == 6) {
// Ringgit Conversion
rupee = amount * 16.8;
System.out.println("Your " + amount + " ringgit is : " + f.format(rupee) + " Ruppes");
dollar = amount * 0.239;
System.out.println("Your " + amount + " ringgit is : " + f.format(dollar) + " dollar");
pound = amount * 0.188;
System.out.println("Your " + amount + " ringgit is : " + f.format(pound) + " pound");
euro = amount * 0.209;
System.out.println("Your " + amount + " ringgit is : " + f.format(euro) + " euro");
yen = amount * 26.63;
System.out.println("Your " + amount + " ringgit is : " + f.format(yen) + " yen");
} else {
System.out.println("Invalid input");
}
System.out.println("Thank you ");
}
}