
Hi I was wondering if someone could help me write a program to convert Pounds into Euro's. The program should prompt the user to input the number of pounds and output the number of Euros this is equivalent to.
Thanks I have not had much luck with this

import java.text.*;
import java.util.*;
public class CurrencyConverter {
public static void main(String[] args) {
Double Exchange;
Double conversionToEuros;
Double Amount;
NumberFormat Pound1 = NumberFormat.getCurrencyInstance();
NumberFormat Euro1 = NumberFormat.getCurrencyInstance(Locale.FRANCE);
Conversion Converter1 = new Conversion();
Scanner scan = new Scanner(System.in);
System.out.println("Enter the current exchange rate(Pounds to Euros): " +"");
Exchange = scan.nextDouble();
Converter1.setExchange(Exchange);
System.out.println("Enter the amount you would like to exchange: " +"");
Amount = scan.nextDouble();
Converter1.setAmount(Amount);
System.out.println("Amount after conversion: " + Euro1.format(Converter1.conversionToEuros()));
}
}
class Conversion {
private double Exchange;
private double Amount;
private double conversionToEuros;
private double conversionToPounds;
public Conversion () {
}
public double getExchange() {
return Exchange;
}
public void setExchange (double currentRate) {
this.Exchange = currentRate;
}
public double getAmount() {
return Amount;
}
public void setAmount (double currentAmount) {
this.Amount = currentAmount;
}
public double conversionToEuros() {
return (Exchange * Amount);
}
public double conversionToPounds() {
return (Amount / Exchange);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.