Let the user set in a number

Hello, I want to make a program where the user can put in a number an get a conversion to another valuta..
//Exchange to NOK
               public double beregnTilNok(int antall){
                    return antall * kurs / enhet;
               // Beregn from NOK to valuta
                public double beregnFraNok(double nok){
                    return nok * enhet / kurs;
TEST METODE FOR VALUTA
     class Oving06{
          public static void main(String[] args){
               // lager et objekt av valuta klassen svenske kroner:
               Valuta svenskValuta = new Valuta("Sek", 80.24, 100);
// Beregn metode svenske:
               String tekskt = showInputDialog("Legg inn antall kroner som skal konverteres: ");
               //double tall1 = Double.parseDouble(tall1Lest);
               System.out.println("Dette gir: " + svenskValuta.beregnTilNok(6) + " norske kroner.");
}

I would create a console. That is, after the user runs the program, it prompts the user for a line of input.
For example:
public static void main(String[] args) {
     Scanner input = new Scanner(System.in); // This reads in lines from standard in.
     while(true) {
          System.out.print("Enter a number > ");
          String line = input.nextLine();
          try {
               double value = Double.parseDouble(line.trim());
               double converted_value = beregnTilNok(value);
               System.out.println("Converted " + value + " to " + value + ".");
          } catch (Exception e) {continue;}
}You do not need the while loop if you only want to ask your user for one line of input.
~ Anthop

Similar Messages

  • A suggestion for the mouse setting through persistence via SkyDrive/OneDrive: Add a check button to let the user tell if the mouse settings should be "restored" every time the user logs in a "different" computer using the same Microsoft Account.

    Every time I log in one of my 2 computers with Microsoft Account, I have to change the main button (left/right) setting, because the settings persistence via SkyDrive/OneDrive.
    I have different main mouse button settings in the computers.
    Those settings shouldn't be changed, if the account is not a new one, after all, if the user has different settings in old accounts, it means there must be a reason to do it (because of hardware and/or furniture restriction).
    Thus, a check button in the mouse settings' window that let the user tell if it should be changed or not would be welcomed.

    Every time I log in one of my 2 computers with Microsoft Account, I have to change the main button (left/right) setting, because the settings persistence via SkyDrive/OneDrive.
    I have different main mouse button settings in the computers.
    Those settings shouldn't be changed, if the account is not a new one, after all, if the user has different settings in old accounts, it means there must be a reason to do it (because of hardware and/or furniture restriction).
    Thus, a check button in the mouse settings' window that let the user tell if it should be changed or not would be welcomed.

  • How to let the user define the colors for each plots in the graph (I use LabVIEW 7)?

    How to let the user define the colors for each plots in the graph (I
    use LabVIEW 7)?

    Hi,
    Take a look at this example, it uses property nodes to select tha
    active plot and then changes the color of that plot.
    If you want to make the number of plots dynamic you could use a for
    loop and an array of color boxes.
    I hope this helps.
    Regards,
    Juan Carlos
    N.I.
    Attachments:
    Changing_plot_color.vi ‏38 KB

  • So I just bought a used MacBook from Amazon with OSX 10.5.8.  I am trying to install new software and operating system, but I don't have the passwords to the Users set up in the computer.  What do I do?

    So I just bought a used MacBook from Amazon with OSX 10.5.8.  I am trying to install new software and operating system, but I don't have the passwords to the Users set up in the computer.  What do I do?

    Put your install DVD into the optical drive (CD/DVD drive) and reboot. Be sure to either use the disc that came with your Mac, or, if you installed a later Mac OS X version from disc, use the newer disc. As soon as you hear the boot chime, hold down the "c" key on your keyboard (or the Option Key until the Install Disk shows up) until the apple shows up. That will force your MacBook to boot from the install DVD in the optical drive.
    When it does start up, you'll see a panel asking you to choose your language. Choose your language and press the Return key on your keyboard once. It will then present you with an Installation window. Completely ignore this window and click on Utilities in the top menu and scroll down to Reset Password. After resetting the password use Startup Disk from the same menu to choose your hard drive for startup and restart.

  • Can I somehow let the user select multiple images from device?

    Is there any way to let the user select multiple images from the device media gallery?
    The CameraRoll only selects one image. And the FileRefernceList doesn't show thumbnails (so you have no idea what you are selecting).
    Is there a way, or maybe some sort of workaround, for this? Is there a way to maybe "read" the users gallery on the SD-card and output your own gallery that the user can select from?
    I'm developing towards both Android and iOS so cross-plattform is a must.
    Thank you guys

    +1 to this question. I'm looking to do the same thing but haven't had any luck yet.

  • How to make a control to let the user to select a type of line?

    Dear All,
    I want to make a control to let the user can select a type of line from some types. Just like selecting the line type of plot in the graph.
    Is there any good way to do it, or is there any examples?
    Thank you.

    Hello,
    I think you can use a pict ring as selector and the detect value changes of that indicator to apply the new plot style on the graph using property nodes.
    Let me know if you need more help on this
    Message Edité par TiTou le 08-30-2006 01:50 PM
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
    Attachments:
    palette.jpg ‏19 KB

  • Letting the user choose the amount of questions to a random quiz

    is it possible to Letting the user choose the amount of questions to a random quiz taken from a question pool?

    Hi Paul,
    you could check the source code of the http://osmf.org/dev/1.5gm/youtube-googleanalytics.html page. The js script code creates the embed code on page load.
    After the object is created, I obtain a generated embed code similar to:
    <object id="StrobeMediaPlayback" width="640" height="480" type="application/x-shockwave-flash" name="StrobeMediaPlayback" data="StrobeMediaPlayback.swf" style="visibility: visible;">
    <param name="allowFullScreen" value="true">
    <param name="flashvars" value="src=http://movie/.....&plugin_ga=GTrackPlugin.swf&ga_http://www.realeyes.com/osmf/plugins/trac king/google=%3Cvalue%20key%3D%22reTrackConfig%22%20type%3D%22class%22%20class%3D%22com.rea leyes.osmf.plugins.tracking.google.config.RETrackConfig%22%3E%09%09%20%20%20%20%20%20%20%2 0%3Caccount%3EUA-7184501-2%3C/account%3E%09%09%20%2...l%3D%22start%22%20/%3E%09%09%20%20%2 0%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cmarker%20time%3D%2220%22%20label%3D%22start%22% 20/%3E%09%09%20%20%20%20%20%20%20%20%3C/event%3E%09%09%20%20%20%20%20%20%20%20%3Cdebug%3Et rue%3C/debug%3E%09%09%20%20%20%20%20%20%20%20%3CupdateInterval%3E250%3C/updateInterval%3E% 09%09%09%3C/value%3E&src_namespace_realeyes=http://www.realeyes.com/osmf/plugins/tracking/ google&src_realeyes_pageURL=page%20description&javascriptCallbackFunction=onJavaScriptBrid geCreated">
    </object>
    You will have to urlencode the XML data in order to use the plugin, I think this is where you are stuck.
    Does this help create your own code?
    P.S. regarding the contents of the XML string, you will have to personalize it for you own purposes.

  • How to let the user know the application is still running during SQLite reads

    I'm using an SQLite database to read and write to my application. In some places it has to do very large reads and writes and the application comes to a standstill for like 10 seconds while this is happening. I've tried calling showBusyCursor(), but it only works if I call that function and then set a timer to execute the sql query. But the busy cursor also freezes once the connection starts.
    Why doesn't the showBusyCursor work during this time? Are there any other things I can do to the application to ensure the user that it is not frozen and just processing?

    Keep in mind that I haven't actually implemented this yet, but my path is headed right in that direction in the next few days. From wh
    at I have read you can access the database in two modes: synchronous and asynchronous. From your description it sounds like you are accessing the database in synchronous mode, which will stop the application thread until the database thread is completed.
    To get around that limitation you will want to run your database accesses in asynchronous mode, so that the application will continue running while the database is being accessed. What you do then is implement a listener on the database that will call a function that will hide the waiting cursor or image. Then you start the waiting indicator in the application. Once the database is done, it will trigger your listener and remove the waiting indicator, allowing the user to once again interact with your app.
    Hope this helps!
    ~Mike

  • Develop Module RGB Pixel values: 0-100% or 0-255.  Let the user choose.

    I know that folks differ on whether they prefer to see RGB pixel values represented as integers in the range of 0-255 or floating point numbers between 0 and 100%.  Is there a way that the user can choose which one he/she wants (perhaps in the preferences)?  0-255 makes no sense for images which are >24 bit depth or in other color spaces.  It would be nice to have the "luddite option" (0-255) and the "future proof" option (0-100% or whatever range makes sense given the color space).  :-)

    rI load a raw image of Macbeth colorchecker. I look at the RGB percentages for one of the patches. What are they percentages of? I cycle though the colorsapces with Edit/Preferences/External Editing and nothing changes. The RGB precentages remain the same. They are not dependent on the "external editing" colorspace.
    As you discovered, the "external editing" preference is not used inside Lightroom. It sets the color space of the file that gets generated when you do an "edit in Photoshop". Lightroom uses a unique colorspace that has prophotoRGB primaries. Internally all math is done in a linear gamma version of prophotoRGB called MelissaRGB inside Adobe. The values reported under the histogram are based on melissaRGB but modified by the sRGB tone curve. There is nothing equivalent to it in any other piece of software, so you simply cannot compare Lightroom values to values in any other peice of software, regardless of the color space. Andrew wrote a nice overview on this many years ago: http://www.ppmag.com/reviews/200701_rodneycm.pdf 
    I go to Soft Proofing and the RGB values change to numeric. I cycle through some output profiles and the RGB values change, as I would expect. But when I turn soft proofing off, the RGB precentage values return and are the same. They do not depend on the Soft Proof profile. And in soft proof I only see 1 set of values, not a pair of values like Photohobby said. What am I missing?
    If you turn off soft proofing, the values simply return to the actual values according to the internal representation of the image, not the soft proofed ones. What did you expect would happen? I've never seen pairs of values so I am not sure what that is about.
    So, it looks like the Lightroom 4 RGB percentages are based on the Adobe98 colorspace, and are not dependent on any other settings?
    As said above, the values are not comparable. the colorspace is prophotoRGB with an sRGB tone curve. If you're looking for colorchecker values in the Lightroom system: check here.
    When I search the web for "skin tone by the numbers" I get hundreds of CMYK answers. I've never seen an RGB method. Please write one for us.
    You really do not want to do this weird by numbers thing. This is largely a thing of the past. With modern color management and display calibration all you need to do is make the skin tone look good on your display and your output will be good. The simplest and quickest thing to do is to use a reference image with known good skin tones and put it up next to your image. Then adjust white balance until your own image looks good visually. Even better is simply to start with a known neutral by shooting a grey card or color checker neutral patch in the same lighting condition. This ensures good skin tone rendering if your development is not too extreme.

  • How to let the user select from more then 1 data templet file to fillin a field

    help i have a form the has 5 free form text fields that i need to select from a list of texts to fill it in and then allow the user to add to the data.
    thanks

    thanks here are 2 strings
    COPD continue O2 by NC/Albuterol MDI/ Atrovent MDI/ Duonebs/ Albuterol MDI/ Prednisone taper/ IV Solumedrol/ Spiva/ Advair diskus/ oximetry prn/ PT/ OT/ Coreg
    CAD/ANGINA  cont. O2 by NC?baby ASA/ ASA/ Lopressor/Atenolol/ Lisinopril/ Low fat diet/ PT/OT/ sublingual nitroglycerin prn/ Lasix/ Lipitor/ Zocor/ Mevacor
    i would like the user to be able to select from inside of the field when it is blank (fisrt time entering data)
    thanks again

  • How do I create a form field ONLY template in Acrobat 9 Pro that will let the user enter and print only the form field data on a pre-printed form?

    This template will be used to type in information that will then be printed on an agency's official, barcoded form loaded in a printer (instead of blank paper.)  Only the user-entered info should print on the pre-printed form.  Users will use Adobe Reader to complete their templates; they do not have Acrobat.  Thank you!

    Use the template as non-printable background and add the form fields.

  • Is this how I would go about letting the user choose a source file and a de

    Hello everyone.
    I wasn't sure on how I would do this but what I want is from a drop down menu (which I already have created) they are going to choose somthing.
    Once they choose somthing I want it to bring up another window that has a layout like this:
    ------------------------------------------------------------------------------------|
    JLabel->Source:[                            ] (browse) <--JButton|
    JLabel->Destination:[                      ] (browse) <---JButton|
    ------------------------------------------------------------------------------------|
    So this new window I want to show up, what would it be? Is it just a JPannel or a JFrame with JButtons?

    It might actually be more difficult the more I look at JDialog.
    Because what I need is, to allow the user to select a destination directory and a source directory so when they click the button, it will open up a JFileChooser. whatever they pick, I need the window to stay up until both directory's are selected (A source and a destination)
    Then I'll have an Ok button that will close the window.
    THen I'll use their input source/destination strings and do my other processing with that.

  • I need to make an app that lets the user save a text file to their docs

    i am a 14 year old developer, and i have a problem with interface builder. i would like to add a button, or option in the menu that will allow the user to save a file. it is just a basic text file. can anyone please help? and im a code noob, so make it simple! thanks!

    Seen these?
    Guides:
    http://developer.apple.com/library/mac/search/?q=open+save
    Application File Management:
    http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/AppFileMgm t/
    The Save and Open Panels:
    http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/AppFileMgm t/Concepts/SaveOpenPanels.html
    Managing Accessory Views:
    http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/AppFileMgm t/Articles/ManagingAccessoryViews.html

  • Let the user try again

    I issue a jboexception to show a validation error. I would like to give the user the opportunity to fix the problem without having to retype everything. For example, if the user is inserting a record and they fail on one field validation, it displays the error correctly. It doesn't give them a link to go back to what they typed and fix it. If the back button is clicked on the browser, it appears that they can fix it, but when they save, it gives an error about not being able to find the row handle.
    How do I get around this? I need this soon.
    Giggles

    yes and when I push the icon to download and go through all 3 steps it says this version is already downloaded.  so i close the browser and try to download the document again and it says the same error

  • Access denied on first login, then it lets the user in (Fedora Core 5)

    I am getting the message "Access denied by Application security check" the first time I login to the db (dba privs.) from a remote machine. Then I click the link to return to the application and log in again. This time it will let me in. Then I close the browser, open back up and it does the same thing. After doing this a few times it lets me in w/o the message until I rebooted, and then it starts the message again (I rebooted both the server and the client come to think of it). At any rate it is installed on FC5, which I am a little green on, however I did somehow manage to get this far.

    Here is a way to design for scheduler running:
    Import-Module ActiveDirectory
    $path='\\UNCLocation\devshare\*'
    $addn = (Get-ADDomain).DistuinguishedName
    $defaultLocation="OU=Homeless,$addn"
    $dnsroot = (Get-ADDomain).dnsroot
    $log = "C:\Path\To\errorlog.log"
    $enabled=$true
    function Logit($type='INFO',$msg,$p1,$p2){
    $text=('[{0}][{1}]{2}[{3}|{4}]' -f [DateTime]::Now,$type,$msg,$p1,$p2)
    Write-Verbose $text
    $text| Out-File $log -append
    Function Create-Users{
    [CmdletBinding()]
    Param()
    Get-ChildItem $path -Include *.csv |
    ForEach-Object {
    $nu=Import-Csv $_
    $sam = $_.FirstName.substring(0,1).ToLower() + $_.LastName.ToLower()
    if(!Get-ADUser -LDAPFilter "(sAMAccountName=$sam)")
    Logit -msg 'Creating user' -p1 $sam
    $setpass = ConvertTo-SecureString -AsPlainText $_.Password -force
    $userprops=@{
    SamAccouontName=$sam
    GivenName=$_.FirstName
    Initials=$_.Initials
    Surname=$_.LastName
    DisplayName=($_.LastName + "," + $_.FirstName)
    UserPrincipalName=($sam + "@" + $dnsroot)
    OfficePhone=$_.Number
    AccountPassword=$setpass
    Enabled=$enabled
    Path=$defaultLocation
    $location = $_.Department + ".$($addn)"
    If ([adsi]::Exists("LDAP://$($location)")){
    $userprops.Path=$location
    Logit -msg "User $sam will be created inctarget OU:" -p1 $location
    }else{
    Logit -type ERROR -msg 'Target OU not found. User will be created in default'
    New-AdUser @userprops
    Logit -msg 'Created new user:' -p1 $sam
    }else{
    Logit -type ERROR -msg 'Username already exists' $sam
    Create-Users -Verbose
    The code loops through all CSVs found.  If you run it in the scheduler every 2 or 3 minutes it will be pretty fast.
    You will need to add a layer of error handling and logging to get it to work smoothly.
    ¯\_(ツ)_/¯

Maybe you are looking for

  • Tax Calculation of free goods

    Hi We have a requirement where the client wants only VAT to be posted in GL accounts and not the price.For this I tried free goods condition type R100 with AltCBV 28.But the VAT value is also coming zero. I want the VAT to be calculated on Pricing co

  • No system load data available in st03

    Dear Guru,               When i am executing Tcode ST03 it is showing that "No system load data available" when i am executing "RSSTAT83" report then its thriwing "LOGDB_SSCR_NOT_FOUND" dump. statndard job getting cancelled thats why i hae change the

  • GNOME and KDE file associations

    Hi, I like to use KDE and GNOME, alternating between them. Sounds crazy, but I like both. Please, let's avoid the "GNOME vs. KDE" discussion, right? My problem is: I like to use different file associations when I'm using GNOME or KDE. For example, I'

  • Disabling "Save as..." popup in Acrobat Distiller printer driver

    Hi! We are using an application which is automatically generating a pdf file using the Acrobat Distiller printer driver, but recently one workstation start poping up a Save as... window each time a file is generated (it is very annoying since this ap

  • Replicating authorization roles via HR replication from ECC 6 to SRM 5.0

    Hi, I'm interested in knowing whether anyone has used the distribution model to copy roles (AG objects) between ECC 6 and SRM 5.0. Someone said that it's possible so I would like to validate that statement as I don't know whether it is possible and p