Home Answers Viewqa Java-Beginners Java Currency Converter

 
 


David Ferguson
Java Currency Converter
1 Answer(s)      a year and 7 months 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

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 Pages:
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
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
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
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
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 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 - 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
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
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
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
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
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
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
converter code for audio file
converter code for audio file  how can i convert a audio file to a another file format like mp3
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
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
Alphabet Character Case-Converter
Alphabet Character Case-Converter       In this section, you will learn to convert...:\corejava>java CharToLowercase Enter the uppercase character: R
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
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
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
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 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
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
C Temperature Converter
C Temperature Converter       Here we are going to illustrates you how to convert temperature from Celsius to Fahrenheit in C. You can see in the given example, we prompt
Temperature Converter in SWT
Temperature Converter in SWT       This example illustrates you how to convert temperature from...;{   getShell().setText("Temperature Converter");  
I18N
; 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.  
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
java - Java Beginners
java   Note. I am from philippines and our currency is peso  I am from India and our culture is good
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
java - Development process
java  Design classes for Currency, Rupee, and Dollar. Write a program...*; class Currency implements Serializable { protected String currency; protected int amount; public Currency(String cur, int amt
java - Design concepts & design patterns
java  design classes for currency,rupee,and doller.write a program... java.io.*; import java.util.*; class Currency implements Serializable{ public String currency; public int amount; public Currency(String currency, int
Palm Open Source
Currency does exactly what its name says: it converts one currency to another... countries. Most currency conversion utilities act as a calculator: you enter an amount, choose the desired currency, then press the convert button. Currency uses
Java question
Java question  Write a program that converts a (C to F Converter from 0 - 20) and writes the output to a file instead of the screen. Open the file in Notepad to confirm the output
CurrencyFormatter in Flex4
CurrencyFormatter in Flex4: The CurrencyFormatter class formats a number in a currency value. It formatted the decimal rounding and precision, thousand separator and negative sign. you can set the currency symbol by using
java
java  .doc to html converter in java   it's urgent buddies   Hi Friend, Try the following code: import java.io.*; import org.apache.poi.hwpf.HWPFDocument; import org.apache.poi.hwpf.extractor.WordExtractor
jsf tags - Java Server Faces Questions
jsf tags  hi how can i insert a currency symbol in the jsf field...; but   id working fine with the following libs but currency tag is not working can any one tell me how can use both space and currency tag in my jsf
J2ME - Java Beginners
J2ME  I have to Create a currency conversion application that converts between three currencies..............pls show me the coding or mail me the code to rdx_ruLz@hotmail.com.....................thank you
CurrencyValidator in Flex4
CurrencyValidator in Flex4: The CurrencyValidator class validates the currency format. You can set the precision property in it. The Tag of CurrencyValidator is <mx:CurrencyValidator>. In this example you can see how we can use
Java programming question - Java Beginners
Java programming question  I want to write a program that converts... the following code: import java.io.*; import java.util.*; class Converter...(); } } public static void main(String[] args){ Converter convert=new Converter
JSF Interview Questions
? The main reasons behind creating our converter... of creating and using custom converter in our application? Creating and using a custom converter requires the following steps
Object serialization - Java Beginners
Object serialization  Design classes for Currency, Rupee, and Dollar. Write a program that randomly generates Rupee and Dollar objects and write them into a file using object serialization. Write another program to read
JSF Application
;   Custom Converter Example in JSF JSF provides a very... converter. When the user enters value to the component, it?s simply a string... provided many converters like Boolean Converter, Byte Converter, Number Converter
conert java code to jsp... plz imm i wan...
conert java code to jsp... plz imm i wan...  how to convert this java code into jsp?? Java| Frameworks| Databases| Technology| Development| Build... iPhone Baby Names Application Currency Format Example This Example shows you how
Need to develop Java Program - Development process
Need to develop Java Program  Design classes for Currency, Rupee, and Dollar. Write a program that randomly generates Rupee and Dollar objects and write them into a file using object serialization. Write another program to read
exe set up software - Java Server Faces Questions
exe set up software  hi i want a exe file creator software. i am doing a project in swings. now i need exe converter. pls send
classes and data abstraction - Java Beginners
classes and data abstraction  Create a java program for a class named... the starting currency amount and type of currency. The data member sum contains... as follows: You're starting with amount in currency type In this output, amount

Ask Questions?

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.