Skip to content

Commit 9f023f4

Browse files
committed
Currency in USD
1 parent ac0fc2b commit 9f023f4

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

‎src/Assignments/Problems.java‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,34 @@
11
package Assignments;
22

33
import java.util.Scanner;
4+
import java.math.RoundingMode;
5+
import java.text.DecimalFormat;
46

57
import static java.lang.System.*;
68

79
public class Problems {
810

911
static Problems problems = new Problems();
12+
private static final DecimalFormat df = new DecimalFormat("0.00");
1013

1114
public static void main(String[] args) {
1215

13-
problems.findLargestNumber();
16+
problems.getCurrencyinDollars();
17+
// problems.findLargestNumber();
1418
// problems.calculateSimpleInterest();
1519
// problems.computeWithFormula();
1620
}
1721

22+
void getCurrencyinDollars(){
23+
24+
Scanner firstInput = new Scanner(in);
25+
out.println("Enter Rupees: ");
26+
double indianCurrency = firstInput.nextDouble();
27+
28+
double dollarCurrency = indianCurrency/74.42;
29+
out.println("Value in Dollars is "+ df.format (dollarCurrency) + "$");
30+
}
31+
1832
void findLargestNumber(){
1933
Scanner firstInput = new Scanner(in);
2034
out.println("Enter FirstNumber: ");

0 commit comments

Comments
 (0)