Currency Converter Project in Java

Currency Converter in Java:

Currency converter is a mini project in Java Programming. It provides a web-based interface for exchanging money from one currency to another currency. In this article, we’ll see how to make a currency converter which includes conversion between Rupees, Dollar, Pound, Euro and Kuwaiti dinar.

import java.util.*;
import java.text.DecimalFormat;
class Currency_Converter
{
public static void main(String[] args)
{
double rupee,dollar,pound,code,euro,KWD;
DecimalFormat f = new DecimalFormat("##.###");
Scanner sc = new Scanner(System.in);
System.out.println("*** WelCome to Webeduclick Currency Converter Project ***\nEnter the currency code \n1:Rupees\n2:Dollar\n3:Pound\n4:Euro\n5:Kuwaiti dinar");
code=sc.nextInt();
if(code == 1)
{
System.out.println("Enter amount in rupees:");
rupee = sc.nextFloat();
dollar = rupee / 75;
System.out.println("Dollar : "+f.format(dollar));
pound = rupee / 101;
System.out.println("Pound : "+f.format(pound));
euro = rupee / 84;
System.out.println("Euro : "+f.format(euro));
KWD = rupee / 250;
System.out.println("Kuwaiti dinar : "+f.format(KWD));
}
else if (code == 2)
{
System.out.println("Enter amount in dollar:");
dollar = sc.nextFloat();
rupee = dollar * 75;
System.out.println("Rupees : "+f.format(rupee));
pound = dollar * 0.72;
System.out.println("Pound : "+f.format(pound));
euro = dollar * 0.88;
System.out.println("Euro : "+f.format(euro));
KWD = dollar * 0.30;
System.out.println("Kuwaiti dinar : "+f.format(KWD));
}
else if(code == 3)
{
System.out.println("Enter amount in Pound:");
pound = sc.nextFloat();
rupee = pound * 101;
System.out.println("Rupees : "+f.format(rupee));
dollar = pound * 1.35;
System.out.println("Dollar : "+f.format(dollar));
euro = pound * 1.36;
System.out.println("Euro : "+f.format(euro));
KWD = pound * 0.4;
System.out.println("Kuwaiti dinar : "+f.format(KWD));
}
else if(code == 4)
{
System.out.println("Enter amount in Euro:");
euro = sc.nextFloat();
rupee = euro * 84;
System.out.println("Rupees : "+f.format(rupee));
dollar = euro * 1.12;
System.out.println("Dollar : "+f.format(dollar));
pound = euro * 0.73;
System.out.println("Pound : "+f.format(pound));
KWD = euro * 0.34;
System.out.println("Kuwaiti dinar : "+f.format(KWD));
}
else if(code == 5)
{
System.out.println("Enter amount in Kuwaiti dinar:");
KWD = sc.nextFloat();
rupee = KWD * 250;
System.out.println("Rupees : "+f.format(rupee));
dollar = KWD * 3.30;
System.out.println("Dollar : "+f.format(dollar));
pound = KWD * 2.5;
System.out.println("Pound : "+f.format(pound));
euro = KWD * 2.94;
System.out.println("Euro : "+f.format(euro));
}
else
System.out.println("Invalid Code!");
}
}

 

Output-1:

Currency Converter Project in Java

Output-2:

Currency Converter Project in Java

Output-3:

Currency Converter Project in Java

Output-4:

Currency Converter Project in Java

Output-5:

Currency Converter Project in Java

Leave a Reply

Your email address will not be published. Required fields are marked *