Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Java Currency Converter
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


David Ferguson
Java Currency Converter
1 Answer(s)      3 years ago
Posted in : Java Beginners


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


Advertisement
View Answers

October 25, 2011 at 11:10 AM


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);
}
}


Related Tutorials/Questions & Answers:
Java Currency Converter
Java Currency Converter   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
Java array in currency converter
Java array in currency converter  Hi all, My sister is trying to teach me java. She's in school for programming and I'm not but I am just trying... not have any programming experience. Right now I am working on this currency
Advertisements
currency converter
currency converter  hi i have encountered a problem while creating a pdf file in jsp.... my problem is i want commas for the currency which is diplayed in the pdf file... i'm using sybase, stored procedure for the front end
Currency Converter in PHP - PHP
Currency Converter in PHP  Can anyone give me an idea on how to convert US dollar, Rupees, euro and yen to pounds
currency - Java Beginners
currency  helo guys can you share me a code about Currency... Mexican pesos sample input: ENTER TYPE OF CURRENCY:(so the user must choose a currency if dollars,swiss francs,euro dollars or mexican pesos)sample I input
currency - Java Beginners
currency  helo guys can you share me a "JAVAcode" about Currency...=9.815 Mexican pesos sample input: ENTER TYPE OF CURRENCY:(so the user must choose a currency if dollars,swiss francs,euro dollars or mexican pesos)sample I
converter
converter  I want to convert my c source code to java. Please tell me any software. How I convert c code to java code
how to do an measure converter in netbeans - Java Beginners
how to do an measure converter in netbeans   hi im not sure... information on joptionpane visit to : http://www.roseindia.net/java/java-tips/GUI/containers/20dialogs/10joptionpane.shtml http://www.roseindia.net/java/java-tips
converter application
converter application  Develop a converter application using event-driven programming paradigm of Java. Procedure: 1. Design a menu bar with two menus. 2. The first menu has the following menu items, Distance, Currency
currency conversion
currency conversion   hi frds.. I wan jsp code to convert currency in different formats??... if u know plz plz plz post it   Please visit the following link: http://www.roseindia.net/tutorials/I18N/currency
Currency Symbol problem
Currency Symbol problem  Hi All, My Server side code...(); Currency currency = Currency.getInstance("MYR"); // Malaysia Code numberFormat.setCurrency(currency); int num = 12345; I want to print this in a JSP Page
currency symbols in excel
currency symbols in excel  How to add a currency symbol in Excel sheet? Please guide me
javascript regex validate currency
javascript regex validate currency  How to validate currency in JavaScript?   <html> <head> <title>Currency validation... validate() { var currency = document.getElementById("currency").value
pdf to voice converter
pdf to voice converter  is it possible to implement PDF to speech converter by extracting text from pdf and then text to speech
converter code for audio file
converter code for audio file  how can i convert a audio file to a another file format like mp3
Doubt about Xstream Converter
Doubt about Xstream Converter  Hi, I am using the Xstream freamwork to read a lot of files in a batch operation. I use a custom converter Xstream to read some properties of my Xml file, but when I changed my application
Why not use Double or Float to represent currency?
Why not use Double or Float to represent currency?  Why not use Double or Float to represent currency
Currency Format Example
Currency Format Example       This Example shows you how to format currency according to the locale. In the code given below we are formatting Currency according to the locale. Methods
Formatting and Parsing Locale-Specific Currency
Formatting and Parsing Locale-Specific Currency In this section, you will learn how to format and parse the locale specific currency. Through the formatting..., NumberFormat, Decimal format etc, Java has made programming easier. Here we
JSF converter Tag
JSF converter Tag          This tag is used to register the converter instance... of backing bean class which implements Converter interface. You have to maintain
Java String Case Converter
Java String Case Converter Here we are going to convert lowercase characters to upper case and upper case characters to lower case simultaneously from the given input string. Description of code: Through the following code, we have
Custom Converter Example
Custom Converter Example     ... custom converter. When the user inputs value to the component... in this conversion. JSF framework has provided many converters like Boolean Converter
Java Temperature Converter
Java Temperature Converter In this tutorial, you will learn how to convert temperature from Celsius to Fahrenheit and vice versa. Here is an example where we have created three functions celcius(), fahrenheit() and display table
java - Java Beginners
a program for a Java application / applet which contains a set of GUI components as detailed below.\ 1. The Java applet page/application models a currency converter, containing a set of currency (minimum SIX) and the conversion result. 2
java application/applet - Java Beginners
a currency converter, containing a set of currency (minimum SIX) and the conversion...java application/applet  In this project, the student has to develop and submit a program for a Java application / applet which contains a set of GUI
Using Standard Converter & Custom Converter
Using Standard Converter & Custom Converter... Converter, Byte Converter, Number Converter etc. These converters convert values..., Boolean and Character. If you don't specify the converter for the component
Degree Converter
Degree Converter      ...;DegreeConverter"  for java component. After that we are going to create a method...:\corejava>java DegreeConverter 200 degrees Celcius in Fahrenheit
Alphabet Character Case-Converter
Alphabet Character Case-Converter       In this section, you will learn to convert...:\corejava>java CharToLowercase Enter the uppercase character: R
java code - JavaMail
java code  design classes for currency,rupee,dollar.write a program... args[]) throws Exception{ Currency curr; FileInputStream fis = new... = (Currency)is.readObject(); if((curr.currency).equals("$")){ System.out.println(curr
help me - Java Beginners
help me  helo guys can you share me a code about Currency... dollars 1 dollar=9.815 Mexican pesos sample INPUT: ENTER TYPE OF CURRENCY: sample I input DOLLARS (so the user must choose a currency if dollars ,swiss
Advertisements
 

 

 

DMCA.com