Building a basic Currency Converter
Hi, I am trying to build a pounds to euro, euro to pounds currency converter. The user enters the current exchange rate, what they want to convert and how much. I am trying to use a main class as a command line interface and a class to do the maths. My problem is trying to get them working together as I'm not great with classes. This is what I have so far... the problem is with the Converter converter = new Converter(); line. If I hover over the error symbol in Netbeans it says 'Cannot find symbol'.
package Assignment1;
import java.util.Scanner;
* @author Aaron
public class Interface {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
Converter converter = new Converter();
double exchangeRate;
int convertOption;
double amount = 0;
System.out.println("Welcome to the Currency Converter!");
System.out.println("Please enter the current exchange rate for " +
"Pounds to Euros");
exchangeRate = scan.nextDouble();
System.out.println("Convert Pounds to Euros (1) or Euros to Pounds" +
"(2)");
convertOption = scan.nextInt();
while (convertOption == 1 || convertOption == 2) {
System.out.println("How much would you like to convert?");
amount = scan.nextDouble();
if (convertOption == 1) {
amount = converter.poundToEuro(exchangeRate, amount);
System.out.println("" + amount);
if (convertOption == 2) {
amount = converter.euroToPound(exchangeRate, amount);
System.out.println("" + amount);
if (convertOption != 1 || convertOption != 2) {
System.out.println("Not a valid option. Please re-run the " +
"program.");
package Assignment1;
* @author Aaron
public class Converter {
private double exchangeRate;
private double amount;
private double result;
public Converter(double exchangeRate, double amount, double result) {
this.exchangeRate = exchangeRate;
this.amount = amount;
this.result = result;
public double poundToEuro(double exchangeRate, double amount) {
result = amount * exchangeRate;
return result;
public double euroToPound(double exchangeRate, double amount) {
result = amount / exchangeRate;
return result;
}
By the way:
There's absolutely no need to do the string appending here:
System.out.println("" + amount);Creating a field to hold values to return from methods is unnecessary and poor form; just make them local variables:
public class Converter {
private double result;
public double poundToEuro(double exchangeRate, double amount) {
result = amount * exchangeRate;
return result;
}I second the suggestion not to name your class "Interface". It's syntactically OK (because the keyword is lower-case) but it's still confusing.
Similar Messages
-
I am following the guide provided
HERE to build a currency converter. The static converter works very fine, but I am having issue while building dynamic version of it.
Basically, I have designed it as below:
1) Data flow task: Uses a sql query to get a distinct list of all the currencies being used in the fact table and store into a recordset object 'ObjCurrency'
2) Foreach loop container:
Iterates through all the values in 'ObjCurrency' and each value gets stored in CurrencyCode
2.1) Script task: A message box is used to show the current currency code
2.2) Web service task: As stated in the above guide, I am sending the CurrencyCode variable as a 'FromCurrency' and 'USD' is my 'ToCurrency' to get a dynamic WSDL for every CurrencyCode
2.3) XML task: Used to get 'ConversionRateResponse'
2.4) ScriptTask1: A message box is used to show the current ConversionRateResponse
I am getting an error at 2.2 and the error is:
[Web Service Task] Error: An error occurred with the following error message: "Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebserviceTaskException: Could not execute the Web method. The error is: Method 'ProxyNamespace.CurrencyConvertor.ConversionRate'
not found..
at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebMethodInvokerProxy.InvokeMethod(DTSWebMethodInfo methodInfo, String serviceName, Object connection)
at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebServiceTaskUtil.Invoke(DTSWebMethodInfo methodInfo, String serviceName, Object connection, VariableDispenser taskVariableDispenser)
at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebServiceTask.executeThread()".
Can someone please help me with this?
Thank you in advance.Hi rockstar283,
Based on my research, the issue always caused by the data type of input variable mismatch for the Web Service. For example, the input type for web service is String, the variable was of type Object. Obviously SSIS Web Service Task will not implicitly do
a .toString() call on the input variable. So the issue occurs.
To fix this issue, please change the type of the variable. For more details, please refer to the following similar thread:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/1073ad37-ed05-4ab4-85e3-689e1cd17a68/ssis-web-service-task-error-with-wcf-service
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Is currency convertion rules mandatory
hi friends,
am trying to acheive currnecy convertion i am using standard application set 'Appshell' i have no 'currency convertion rules' in application 'Finance'. But i have manitained the script logic under app 'Finance'. I have gone through some docu in which some says to maitain 'currency convertion rules' and others had not discussed about 'currency convertion rules' .
Please guide me whether to maitain the same or not.
My Objective is to perform the simple currency traslation.
thanksAs a designer of BPC applications, you may choose either to utilize the Business Rules or utilize the Script logic process. Either way is fine and they both work on the same basic premise, enter RATES to input currencies in the RATE app, and convert the LC values associated to each ENTITY member to the ENTITY defined property of CURRENCY, for those REPORTING currenies defined in the app, such as FINANCE. I don't think there is a right or wrong way, since each work, but may require additional settings and design for the more complex translations.
Hope this helps. -
I am trying to build a basic TCL skeleton script that reads a remote SNMP OID and displays the value on the screen.
I don't want it to be an EEM Event, I just want to run it from the (tcl)# prompt.
So I guess I'm asking if you can use cli_exec and other commands in the "namespace import ::cisco::eem::*" in a normal non-EEM script - can I do that?
This is the error I get:
OTN.159(tcl)#source flash:TCL_SNMP_Remote_Read.tcl
invalid command name "::cisco::eem::event_register_none" ^
% Invalid input detected at '^' marker.
What am I missing?
================= TCL_SNMP_Remote_Read.tcl ==============================
::cisco::eem::event_register_none
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
if [catch {cli_open} RESULT]
{ error $RESULT $errorInfo }
else { array set cli1 $RESULT }
if [catch {cli_exec $cli1(fd) "snmp get v2c 192.168.1.100 public timeout 1 oid 1.3.6.1.2.1.1.1.0" } RESULT]
{ error $RESULT $errorInfo }
else { set SnmpSysDesc $RESULT }
if [catch {cli_close $cli1(fd) $cli1(tty_id)} RESULT] {
error $RESULT $errorInfo
puts $SnmpSysDesc
=========================================================================
In the sho-run config I have:
event manager directory user policy "flash:/"
event manager session cli username "cisco"
Any help to get me started would be greatly appreciated!
TimIf you don't want an EEM policy, then don't use any of the EEM constructs. Instead, all you need is this:
set output [exec "snmp get v2c 192.168.1.100 public timeout 1 oid 1.3.6.1.2.1.1.1.0"]puts $output -
The look of my home page was perfect with Firefox 3.6.17. I had a strip of whales breaching around the Google logo. Underneath I had all kinds of wonderful things (I forget what they're called) on the page which was divided into sections: weather, CNN, Reuters, currency converter, Rick Levine's daily horoscope, health tip of the day etc. I promptly removed FF4 because my home page was totally ruined and I can't figure out how to restore all these wonderful easy features. Could you kindly help me or has FF totally changed the entire home page layout and I shall never be able to restore them. I have saved a copy of my Profile on my USB stick. I have a MacBook OSX 10.5.8. Sincerely, Myrna Goldstein
I, too had my book marks disappear when I upgraded to FF 4.0
I am now back and enjoying FF 3.6.17 (my original) yet I am still
without my book marks and am floundering trying to recoup.
Any help appreciated. If unable to see my book marks in the near
future I will definitely jump ship. It's too bad that FF people have
created this problem. I am mystified and disgusted with their actions. -
Currency convertion in 11.1.1.1
Hi ,
We are using 11.1.1.1 planning. In our multi currency application we have entity each entity assigned to one currency. we have defined exchange rates in planning application we gave the name currency rates to the table.
we also assigned this table to scenario.
when we enter data in functional currency for perticular entity and then we saved the data in functional currency. when we changed the currency in drop down to USD and also we ran the business rule that given by the planning tool. its not converting data.
Iam just confused where i missed and what i missedto work the currency convertion as i expected.
I really appreciate your help.
Thanks,Have you done a retrieve (using the spreadsheet add-in) from Essbase to verify that the exchange rates were pushed to the cube?
This retrieve can be a bit confusing, because Hyperion Planning actually stores these rates at upper levels in some dimensions. You'll want to retrieve on:
- Currency (the top member from the dimension)
- Version (the top member from the dimension)
- Entity (the top member from the dimension)
- Any other custom dimensions (the top member from the dimension)
- Budget (or forecast, or whatever specific scenario you're referencing)
- HSP_Rate_USD (or whatever specific currency you're reviewing)
- HSP_Ending (or whatever specific rate type you want to review)
I would recommend doing this retrieve directly against Essbase, and making sure you see some rates in the cube.
Hope this helps,
- Jake -
I have this problem, the deploytool won't extract files to iPlanet/ias6/ias/APPS directory when I deploy my bean which I intent to use rich client to access and has no web application. Today I took someone's advice and deployed the currency converter sample and found out only the ConverterServlet.class was extracted in my APPS/j2eeguide/converter folder. It is really strange as only the web application file was extracted. I am using AIX Unix with iAS 6.0 SP1 installed. I check the ksvradmin and kregedit and all is there. Please help.
Hi, I don't know what the necessary patches are but I tried to deploy currency converter sample on my laptop which has iPlanet installed. The folders of ejb and servlet are there in the APPS. I upload the very ear file on my laptop to the AIX and then use j2eeappreg to deploy it. Guess what, no luck. Can I be sure that it is the problem of the AIX? I didn't set up the AIX enviroment so I will have to consult others if it is the AIX enviroment.
-
http://forums.adobe.com/message/4005827#4005827
gif to swf...what to do to keep this timing of gif, in swf in Flash Builder(FX)? I converted the gif with FW... but run too fast what ever I do...you convert your gif to a swf and you're not happy with the conversion?
if yes, either look for different conversion software, check for info on your current conversion software or don't convert and load your gif into your swf: http://creative-geeks.com/blog/2010/06/30/using-animating-gifs-in-flex-and-flash/ -
Simple Question: Building a basic results page
I’ve followed the Dreamweaver CS3 help file:
”Building a basic results page” in building a simple
search and results page set for a very simple MySQL query. After
restarting multiple times, I’m not getting a results page,
but rather “HTTP 500” …no page to display of
course. After extensive web searches for possible help file errors,
suggestions, my errors, etc., I’m lost. I have programming
experience but not with Dreamweaver.
Thanks…The Nuch> but rather
> ?HTTP 500?
What is the exact url address in the browser when you get the
http 500
error.
in your form, this is the action:
<form action="/member_result_test2.php"
That is a site root relative path, it starts with a leading
/slash.
are you testing this at a local host address like this,
http://localhost/mysite/myform.html
if yes, do NOT use site root relative paths. they won't work
for local
testing.
When you submit the form, it's going here to find the
processing script:
http://localhost/member_result_test2.php
instead of
http://localhost/mysite/member_result_test2.php
change the action path to a document relative path.
(you can use site root relative paths locally if you set up a
virtual host
name so you can use something like
http://mysite.local as a local
testing
url)
Alan
Adobe Community Expert, dreamweaver
http://www.adobe.com/communities/experts/ -
Currency Converter doesn't have all
Currency Converter widget works with Yahoo. I checked yahoo currency converter service, thay have a lot of currencies. But apple widget doesn't have.
Why, and how can I add others.The way to do it is to go to news feed, this has your online contacts on the right hand side, when in panorama.
It's the first time I have found the answer so happy to be famous! -
How to add currency converter icon to toolbar
Does firefox 5 have an icon for currency converter? How do I add a currency converter to a toolbar?
Hi,
You can enable currency in the reporting output using following steps:
Query properties> Display> select Display scaling factors for key figures.
but using this option currency($) will be displayed after the amount. it means key figure values will be displayed like 300$, 800$.
hope it helps..
regards,
raju -
Currency convertion from SKK to EURO
HI Friends
A country is joining the Euro area on a particular date. we wish to change the currency customizing to reflect this change. For example, Slovenkia is planning on joining the Euro area from 01.01.2009.
so we wish to change from the existing currency to Euro in the BW System .
Anybody can give some suggestions and necessery steps for that.
ANY THING AND EVERY THING WILL BE REWARDABLE
Thanks in Advance
Regards
RKHi,
exchange rate here is how one currency converted to another currency at certain date, e.g 06.07.2007 1 USD = 41 INR ...
http://www.x-rates.com/d/INR/table.html
in sap system (r/3, bw, ..) it's maintained in table TCUR*, for BW normally it's transferred from r/3 via rsa1->transfer exchange rates, and the update scheduled periodically.
or you can upload the exchange rate via flat file
http://help.sap.com/saphelp_nw04s/helpdata/en/36/412ae30cb511d5b2df0050da4c74dc/frameset.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/36/412ad80cb511d5b2df0050da4c74dc/frameset.htm
take a look
http://help.sap.com/saphelp_nw04/helpdata/en/ec/076f3b6c980c3be10000000a11402f/frameset.htm
sample code in transfer/update rules check following
CONVERT_TO_FOREIGN_CURRENCY or 'RSW_CURRENCY_TRANSLATION'
currency conversion
currency translation
in query level, try to check 'how to use variable for currency conversion' doc
https://websmp106.sap-ag.de/~sapdownload/011000358700005669792003E/How_to_VarCC_v3.pdf
also
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/462fe790-0201-0010-3ca4-adfd89e4f9f2
oss note 656863
currency translation
hope this helps.
Regards
CSM Reddy -
WADL file for Currency Converter API
Hi all,
I have just started creating Project Siena application. I want to create a WADL file for currency converter API.
I have got an app key for currency converter API but do not know how to use this app key & create a WADL file so that I can use the functions provided by currency converter API in my Project Siena Application.
I have gone through some of the examples of WADL configuration file but those are based on BingSearch & BingTranslator API.
Please help me.
Thanks,take a look at the early version of the WADL generator
http://social.technet.microsoft.com/Forums/en-US/82c7b717-5100-423c-aa44-effed28caf74/wadl-generator-for-project-siena?forum=projectsiena
Also, review this article
http://technet.microsoft.com/en-us/library/dn690140.aspx on how to create a WADL to return JSON.
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Harold Kless Microsoft
Online Community Support -
BT Yahoo Currency Converter problem
On my home page, the BT Yahoo Currency converter table has stopped populating the table with data. Now just shows an empty table. Used to work fine. Any explanation regarding why this has happened and how I can fix it?
Hi Frankah,
Thanks for the message and welcome to the forum. I can try and find out why this has happened. Has this change only only recently happened? Have you changed anything on your Homepage?
Cheers
Sean
BTCare Community Manager
If we have asked you to email us with your details, please make sure you are logged in to the forum, otherwise you will not be able to see our ‘Contact Us’ link within our profiles.
We are sorry that we are unable to deal with service/account queries via the private message(PM) function so please don't PM your account info, we need to deal with this via our email account :-) -
Building A Currency Converter Web Portlet
Hi, I've done a complete install from a Redhat 6.2 CD onto a sinle processor machine, apparently if I switch the kernel to SMP it may help with problems I'm having with my OAS 4.0.8.1 WRKSF going down, can this easily be done or do I have to deinstall and reinstall everything all over, I'm a real Linux novice and wouldn't have a clue where to start. Thanks in advance. Geoff Surgenor Mail : [email protected]
I'm not I Linux guru, but I know that the SMP kernel might not work, if you are using it on a single processor system. If I know it right - excuse me if I'm not - wrksf works well on multiple processors systems because it makes some assumptions about the /proc/stat file which has a different layout about processors. There were some post about how to fix a library to make it work on non-SMP systems.
Morc.
Maybe you are looking for
-
The App Store screen is way off to the right so I can't access it. It has the little spinning wheel I can see when I swipe up to see what's open. It won't close. Should I try to force it? How much more time should I give it? I did just give Google so
-
Hello CIN experts , Pls tell me the T code for SAp ER1 report . Also if there are any other Excise reports available with SAP Regards
-
Updating employee in asset master
Hi There are several laptops and mobile phones which are given to employees. I need to track employee-wise assets. So i need to update employee name in asset master But here there is no HR module so personnel numbers are not available. Employees are
-
Hi There I'm trying to add lyrics to a score I've created. I've read the manual but it's not helped. The process seems arduous and when I've finished, I find the lyrics are no longer tied to the notes I inputed them under. They've moved! Start ag
-
How to search using Arabic language
Hi I am from united Arab emirates my mother language is arabic when using apple tv I would like to search in my language how could I add language to the keyboard ? Can some one help me please.