Share on Google+Share on Google+

sassy
currency
1 Answer(s)      8 years ago
Posted in : Java Beginners

Ads

View Answers

August 13, 2008 at 12:52 PM


hai friend.....
This is a simple method....
change according to the rate....

import java.io.*;
class Currency
{
public static void main(String args[]) throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int ch=0;
float val;
System.out.println("Enter The Option for Currency");
System.out.println("1. DOLLAR \n 2.SWISS \n 3.EURO \n 4.MEXICAN");
ch=Integer.parseInt(br.readLine());
System.out.println("Enter the money: ");
String s=br.readLine();
val=Float.valueOf(s.trim()).floatValue();
switch(ch)
{
case 1:System.out.println("SWISS "+val*1.2);

System.out.println("EURO "+val*1.8);
System.out.println("MEXICAN "+val*1.3);
break;
case 2:System.out.println("DOLLAR "+val*0.8);

System.out.println("EURO "+val*1.8);
System.out.println("MEXICAN "+val*1.3);
break;
case 3:System.out.println("DOLLAR "+val*0.8);

System.out.println("SWISS "+val*1.8);
System.out.println("MEXICAN "+val*1.3);
break;
case 4:System.out.println("DOLLAR "+val*0.8);

System.out.println("EURO "+val*1.8);
System.out.println("SWISS "+val*1.3);
break;
default:System.out.println("ERROR");
}
}
}

thanks and regards
prashu
[email protected]









Related Tutorials/Questions & Answers:
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 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
Advertisements
currency symbols in excel
currency symbols in excel  How to add a currency symbol in Excel sheet? Please guide me
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
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
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
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
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
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
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
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... are going to format the number into locale specific currency using NumberFormat class
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
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
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
BI: Improving performance in financial service
BI: Improving performance in financial service       FINANCIAL SERVICE INDUSTRY generally includes banking, security exchange and international finance like currency exchange
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.  
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 - 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
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 - Java Beginners
java   Note. I am from philippines and our currency is peso  I am from India and our culture is good
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
java application/applet - Java Beginners
a currency converter, containing a set of currency (minimum SIX) and the conversion result. 2. The user can interactively select the currency to perform the conversion. 3. When the user finishes selecting the currency (convert
java - Java Beginners
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. The user can interactively select the currency to perform the conversion. 3. When
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 [email protected]....................thank you
Problem in accessing data from Database
is text and all others are of currency data type. If i enter 0 or null value in currency column and then try to retrieve data using my servlet coding
conert java code to jsp... plz imm i wan...
iPhone Baby Names Application 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 used in this example
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
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
classes and data abstraction - Java Beginners
the starting currency amount and type of currency. The data member sum contains... for Mexican pesos, f for Swiss francs, e for Euro dollars or q to quit...() is called. If the user enters 'q', the data member more is set to false to allow
Tutorials   
Java Spring Hibernate Struts Training Retrieve database from the table dynamically in jsp from oracle using servlet What does core Java include? java What are some way to learn Java quickly? Is it required to learn Java before learning Java Script? Is it necessary to learn java script before learning PHP? Are HTML5 and Java Script boosts Java career? Is Java object oriented? Fingerprint application with Java Uninstall Oracle Virtual Box JSON to HashMap Free Java online Training I want example of Control Statement in Java ANSI Color Codes with Python Create a Program that Calculates Input What is difference between JDK,JRE and JVM? How to see ubuntu version on server? How to get Page Source in Selenium (WebDriver) using Java? The path to the driver executable must be set by the webdriver.gecko.driver system property parse data from a link in java Java Program Qns using BlueJ How to fix HAX Kernel Module Is Not Installed error? Installing Audacity Looking for code Logic to check track changes & Coments in MSWord, MSWordx, MSExcel, MSExcelx is ON/OFF Installing JDK on Mac SAX Parser exception ERROR 601 (42P00): Syntax error. Encountered Thread java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory How to install Ubuntu 16.04 LTS? HttpServletRequest cannot be resolved to a type in eclipse - Solved Unhandled event loop exception GC overhead limit exceeded Spring Data jpa with apache phoenix Caused by: java.lang.IllegalArgumentException: Not a host:port pair: PBUF o.a.h.h.z.RecoverableZooKeeper - Possibly transient ZooKeeper, quorum= com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager class not found com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager not found How to download and install Java 8 on Windows? How to uninstall JDK 7? How to install gtk-doc-tools package in Ubuntu? How to install Oracle JDK 8 on Ubuntu? ejabberd_ctl.beam not found - Solved How to convert date to UTC format in Java? How to install autoconf, automake and libtool in Ubuntu 15.10? How to convert current date to mm dd yyyy format in Java? How to convert current date to dd mm yyyy format in Java? How to stop window closing in "internalFrameClosing" event. How to find list of all index in Neo4j? neo4j-server.properties file location SASLError using PLAIN: not-authorized

Ads

 
Advertisement null

Ads