Not quite sure what I'm doing wrong.

As the topic states, not quite sure what I'm doing wrong here. I'm doing a problem for a class and maybe you guys could help me out, or point me in the right direction. The question states:
"Write a program that reads in investment amount, annual interest rate, and number of years, and displays the future investment value using the following formula: "
futureInvestmentValue = investmentAmount x (1 + monthlyInterestRate)numberOfYears*12
(numberOfYears is to the power)
import javax.swing.JOptionPane;
public class Investment {
     public static void main(String[] args) {
            double investmentAmount;
            double interestRate;
            double investmentValue;
          int years;
          String stringInvestmentAmount = JOptionPane("Please Enter An Investment Amount");
               investmentAmount = Double.parseDouble( stringIvestmentAmount );
          String stringIntrestRate = JOptionPane("Please Enter An Intrest Rate In Decimal Form");
               intrestRate = Double.parseDouble( stringIntrestRate );
          String stringYears = JOptionPane("Please Enter A Number Of Years");
               years = Int.parseInteger( stringYears );
          interestRate = 1 + interestRate / 12; //Monthly interest, I believe this is how you calculate it.
          investmentValue = investmentAmount * Math.pow(interestRate, years * 12); //Now the exponent should be the number of months.
          System.out.println("Your investment value is " + investmentValue + ".");
}My Errors are:
C:\Java\Investment.java:15: cannot find symbol
symbol : method JOptionPane(java.lang.String)
location: class Investment
String stringInvestmentAmount = JOptionPane("Please Enter An Investment Amount");
^
C:\Java\Investment.java:16: cannot find symbol
symbol : variable stringIvestmentAmount
location: class Investment
     investmentAmount = Double.parseDouble( stringIvestmentAmount );
     ^
C:\Java\Investment.java:18: cannot find symbol
symbol : method JOptionPane(java.lang.String)
location: class Investment
String stringIntrestRate = JOptionPane("Please Enter An Intrest Rate In Decimal Form");
^
C:\Java\Investment.java:19: cannot find symbol
symbol : variable intrestRate
location: class Investment
     intrestRate = Double.parseDouble( stringIntrestRate );
     ^
C:\Java\Investment.java:21: cannot find symbol
symbol : method JOptionPane(java.lang.String)
location: class Investment
String stringYears = JOptionPane("Please Enter A Number Of Years");
^
C:\Java\Investment.java:22: cannot find symbol
symbol : variable Int
location: class Investment
     years = Int.parseInteger( stringYears );
     ^
6 errors
Tool completed with exit code 1
Edited by: Close on Oct 23, 2007 4:12 PM

String stringInvestmentAmount = JOptionPane("Please Enter An Investment Amount");What is this line trying to do? If you are trying to create a JOptionPane object and pass that String to the constructor then you need the new keyword. If you are trying to call a method of the JOptionPane class then it would be a good idea to include the method name. I sure you are trrying to do the second option.
Once you fix that, it is likely the other errors will disappear. Or different ones will emerge.

Similar Messages

  • HT1688 Hi, just bought my daughter an Iphone 4s and I can't get it to let her on youtube, Facebook etc., keeps saying no internet connection. My husband and I have 3G smartphones and we can get on them on ours, so I'm not sure what I'm doing wrong. Also,

    Hi, just bought my daughter an Iphone 4s and I can't get it to let her on youtube, Facebook etc., keeps saying no internet connection. My husband and I have 3G smartphones and we can get on them on ours, so I'm not sure what I'm doing wrong. Also, my other daughter has the same phone and has no trouble getting on these sites either. Any information to help is greatly appreciated. Thanks

    Well, did you activate this new phone?

  • I am in Aperture photos-browser - view. Amtrying to find "sort"  by file name to elimanate duplcates.  Sort option does not appear. Not sure what I am doing wrong.

    I am in Aperture -photos - browser - view.  Am trying to find "Sort"  by filename to elimate duplicates. I cannot find "sort in Viewer and not sure what I am doing wrong.  Help

    This is what the top of the Viewer should look like:
    Here is the same view with the pulldown opened:
    What is it that you see? Include a screenshot.

  • Hi.  I am having issues with copying files to my shared WB 2TB HDD connected to my airport extreme.  Comes up with error 50.  I am using a Macbook Pro to copy from so not sure what I am doing wrong.  Can someone help? thanks Rory

    Hi.  I am having issues with copying files to my shared WB 2TB HDD connected to my airport extreme.  Comes up with error 50.  I am using a Macbook Pro to copy from so not sure what I am doing wrong.  Can someone help? thanks Rory

    These links might provide some information that may be of help.
    http://support.apple.com/kb/TA20831
    https://discussions.apple.com/message/2035035?messageID=2035035
    I've encountered this error myself upon occasion.  If I remember correctly, it was a permissions/ownership issue with the some of the files I was copying.

  • I am trying to print redplum coupons and I can't, help.  I have updated java, adobe flash, and made sure my printer was set on default.  I am not sure what I am doing wrong.  I have contacted redplum and no one will help.

    I am trying to print redplum coupons and I can't, help.  I have updated java, adobe flash, and made sure my printer was set on default.  I am not sure what I am doing wrong.  I have contacted redplum and no one will help.

    No Apple response???  Redplum/Valassis will not help either.  I searched, using the cups error message and though it is Unbuntu, same error so maybe useful...only problem: details would not display unless I join Unbuntu forum.  What a pain to do anything with my Mac or find any help.  I honestly regret buying this buggy OS.
    Anyway, here is what I found, FYI:
    http://ubuntuforums.org/showthread.php?t=483415
    As the old saying goes: when in doubt, consult the manual. The problem appears to be that I added the printer using the KDE Add Printer Wizard. It was automatically given a "socket" URI instead of an "lpd" one. When I:
    - altered the printer settings at http://localhost:631 (the CUPS admin page) as instructed in the manual for the printer, and
    - copied the PPD file into a second place on the hard drive (as instructed on ubunutuforums, see the link above)
    ..everything started working.
    It's still slower than windows, but I can live with that
    Probably a simple fix. Change the socket I.P. to match the printer I.P. like this:
    socket://192.168.1.86:9100. The thing I'm concerned with using socket:// is that AFAIK the printer I.P. must not change. In my case I'm able to assign a static I.P. address to the printer but it's something to consider.
    I found that the only thing I needed to do was change socket to lpd (and remove :9100 off the end as well). See Solving Ubuntu printer “broken pipe” problem (DocuPrint C525A) . BTW thanks for steering me in the right direction - very grateful.      
    Solving Ubuntu printer “broken pipe” problem (DocuPrint C525A)
    Posted on November 25, 2008
    Are you having a problem with your printer under the latest versions of Ubuntu (perhaps it worked under an older version)? Are you able to print short documents, but not longer, or more graphics-intensive, documents? (e.g. the unfortunate people at http://ubuntuforums.org/showthread.php?t=625493). Do they sit there as Processing for ages and then switch to Held? If you have the same problem I had the solution I tried may work for you too. Firstly, check your cups error log:
    sudo gedit /var/log/cups/error_log
    If you see anything like the following, the solution may be simple:
    [Job 201] Unable to write print data: Broken pipe
    PID 13359 (/usr/lib/cups/backend/socket) stopped with status 1!
    System > Administration > Printing and right click on your printer, selecting Properties. Settings > Device URI
    If you see something like socket://your_printer_ip_address:9100 just change socket to lpd and remove the :9100 off the end. Then click on apply.
    Apparently lpd is a more modern protocol which works with most printers whereas socket is more raw (and potentially faster but riskier in a network situation). Somewhere along the line, the default Ubuntu/Gnome setup for networked printers shifted from lpd to socket. Some primitive printers will have benefited whereas a larger number of more modern printers will have suffered.
    Please correct me if I am wrong (which is highly possible) but the underlying problem could be that socket may make the printer wait a long time for a large file to be processed ready for printing. Some printers, such as the Fuji Xerox DocuPrint C525A, may drop the socket if things take too long to start coming through.
    Changing timeout settings might work but lpd is better than socket so it is the preferred solution in any case.
    If this works for you, please leave a comment to let others know (ideally with a description of the printer and Ubuntu version). Printer may be relevant if it doesn’t support the direct stream protocol properly. NB I may take a while to let your comment through because of the volume of spam. Sorry about that.
    Finally, thanks to sphilli8 for the steer in the right direction at http://ubuntuforums.org/showthread.php?p=6245626.
          http://ubuntuforums.org/showthread.php?t=483415

  • I am trying to submit the link to the podcast RSS feed but when I press submit I receive the error "We care currently experiencing technical difficulties. Please try again later." I am not sure what I am doing wrong.

    I am trying to submit the link to the podcast RSS feed but when I press submit I receive the error "We care currently experiencing technical difficulties. Please try again later." I am not sure what I am doing wrong.

    I am using http://www.greater-light.org/channel.php?id=3344. I have been trying over a month and I am receiving the same error.
    I am on Windows 7.
    Version iTunes 11.1.4.62.

  • PLEASE HELP! I AM STUCK..NOT SURE WHAT I AM DOING WRONG! ARGHHHHHH!

    Hello,
    I am a beginner, only recently started Java a couple of weeks ago. For an assignment at uni, I need to create a simple program which allows the user to enter a row number, 5 7, or 9, and depending on the number of row they select, display the letter H and U. (hope that makes sense).
    We need to use several different types of techniques, selection, interaction, loops and methods. I have used all four techniques, but would like to improve the use of the techniques available. One way for me to do this is using a method, i.e. void print_h(), to let the reader know that this piece of code prints the letter h. I've put this method in, above my switch method, but for some reason displays a blank screen. Is this because I have closed the main method? or because I have written the method in correctly?
    I would really reallty appreciate any help...I need to hand this in this week..been working on it a few days now, and I really don't know where I am going wrong.
    import javax.swing.*;
    public class cw
         public static void main (String args [])
              String t_row;
              int row;
              t_row=JOptionPane.showInputDialog(null, "Please enter row number (5, 7 or 9)");
              row=Integer.parseInt(t_row);
         }//i need to close the main method as if I don't I get illegal start of expression error
         void print_h(int row) //i think the error is here, it needs to take the user input from the main method and use it here
              switch (row)
                   case 5:
                             for (int i=0; i<2; i++)
                                       print_x(2);
                                  print_line(3);
                             for (int i=0;i<2;i++)
                                       print_x(2);
                                  break;
                   case 7:
                             for(int i=0; i<3;i++)
                                       print_x(3);
                                  print_line(4);
                             for(int i=0;i<3;i++)
                                       print_x(3);
                                  break;
                   case 9:
                             for(int i=0; i<4;i++)
                                       print_x(4);
                                  print_line(5);
                             for (int i=0;i<4;i++)
                                       print_x(4);
                                  break;
                   default:     JOptionPane.showMessageDialog (null, "Invalid Value, Please try again");
                                  break;
    void print_u(int row)
         System.out.println(" ");
              switch (row)
                   case 5:
                             for (int i=0; i<4; i++)
                                       print_x(2);
                                  print_line(3);
                                  break;
                   case 7:
                             for(int i=0; i<6;i++)
                                       print_x(3);
                                  print_line(4);
                                  break;
                   case 9:
                             for(int i=0; i<8;i++)
                                       print_x(4);
                                  print_line(5);
                                  break;
                   default:     JOptionPane.showMessageDialog (null, "Invalid Value, Please try again");
                                  break;
              public static void print_x(int no_spaces)
                   System.out.print("x");
                   for (int i=0; i<no_spaces; i++)
                        System.out.print(" ");
                   System.out.println("x");
              public static void print_line(int l)
                   for(int i=0; i<l; i++)
                        System.out.print("x");
                   System.out.println("x");
    Here is my code

    Many thanks for that..but I am not quite sure what you
    mean...apologies..i am really new at this...this is
    what I think you mean...
    public static void main (String args [])
    String t_row;
    int row;
    t_row=JOptionPane.showInputDialog(null, "Please enter
    row number (5, 7 or 9)");
    row=Integer.parseInt(t_row);
    print_h();//call print method here?
    this doesn't work still...? any ideas?Do this :
          t_row=JOptionPane.showInputDialog(null, "Please enter row number (5, 7 or 9)");
          row=Integer.parseInt(t_row);
          print_h();//call print method here? YES but with an argument as demonstrated below
         print_h(row); Hope this clarifies things for you...

  • HT1725 I have been trying to purchase points for a slot machine game using my itunes card. It has subtracted all the $$$$ off the card but I never got the points. Not sure what I am doing wrong. Have restarted the ipad and still nothing.

    I have been trying to purchase points for a slot machine game using my iTunes gift card. It subtracted the right about of $$$ but never gave me my points....not sure what I am doing wrong.
    Any help will be appreciated!

    Contact iTune Support
    https://ssl.apple.com/emea/support/itunes/contact.html

  • When i choose a picture in Lightroom 5, a popup says file not found.  What am i doing wrong?

    When I choose a picture in Lightroom 5, and click on Develop, it was file not found.  What am I doing wrong?

    It means the photo has been moved, renamed or deleted outside of Lightroom (Hint: don't do that)
    To fix the problem, either move the photo back to where it was (using your operating system), or re-connect in Lightroom following these instructions: Adobe Lightroom - Find moved or missing files and folders

  • After doing some editing in Lightroom I want to continue the edit in CS 5 but Lightroom is not exporting the edited version, this has not happened before, what am I doing wrong please? anybody

    After doing some editing in Lightroom I want to continue the edit in CS 5 but Lightroom is not exporting the edited version, this has not happened before, what am I doing wrong please? anybody

    You should be getting an error message that PS CS5 requires a higher version of ACR with two options "render using Lightroom" or "open anyway". You should choose the first option. If you are not seeing the error message then go to your Lightroom prefrences >General Tab> under Prompts> select "Reset all warning dialogs", then try the edit in function again. 

  • Keyer edge tool does not work. What am I doing wrong?

    When I am trying to soften the edge on my green screened image I try to use what they call the edge tool.
    But it does nothing to the edge of the image, it makes the entire keyed image more transparent or more opaque...  this is totally useless... I thought I remembered this working in a previous version but maybe not...
    what am I doing wrong? Or is it just not working correctly.
    Thanks for any help.
    FCPX 10.0.5  OSX 10.6.8

    Do you see the Multifox item to open a new window in the File of Firefox menu?
    You will see a "New Identity Profile" (Ctrl+Alt+M) in the "Firefox > New Tab" menu and in the File menu (press F 10 if the menu bar is hidden) and in the context menu if you right-click a link.<br />
    Choosing that menu entry will open a new window with a new set of cookies marked multifox-profile-2 in the cookie manager.
    It is possible that there is a problem with the file(s) that store the extensions registry.
    Delete the files extensions.* (e.g. extensions.sqlite, extensions.ini, extensions.cache) and compatibility.ini in the Firefox profile folder to reset the extensions registry.
    *https://support.mozilla.org/kb/Profiles
    New files will be created when required.
    See "Corrupt extension files":
    *http://kb.mozillazine.org/Unable_to_install_themes_or_extensions
    *https://support.mozilla.org/kb/Unable+to+install+add-ons
    If you see disabled, not compatible, extensions in "Tools > Add-ons > Extensions" then click the Tools button at the left side of the Search Bar (or click the "Find Updates" button in older Firefox versions) to check if there is a compatibility update available.
    If this hasn't helped then also try to delete the addons.sqlite file.

  • I recently bought full edition of Lightroom 5 for my Nikon D610 but when i connect my other camera, Nikon D3100 for editing my NEF files it says not supported files.What am i doing wrong?

    I recently bought full edition of Lightroom 5 for my Nikon D610 but when i connect my other camera,Nikon D3100 for editing my NEF files it says not supported files.What am i doing wrong?
    Thanks in advance

    Often, this error message means that you have used some version of Nikon software to transfer the photos to your computer, and this has corrupted the files. There is a fix which uncorrupts the files at http://www.sno.phy.queensu.ca/~phil/exiftool/fix_corrupted_nef.html
    But you said you get this message when you "connect my other camera Nikon D3100", the key word being "connect", and this doesn't really fit the description I just gave. This error message normally happens after you have transferred the photos to your computer via Nikon software, not when you connect it. So ... maybe you need to explain a little more ... what exact task (what menu options, what are you clicking on, what are you trying to do) when you get this error.

  • Cannot home share the game app purchased at iTunes store. Home sharing music works. Home sharing books works. But, when I try to copy the game app, it says my computer is not authorized. What am I doing wrong?

    Cannot home share the game app purchased at iTunes store. Home sharing music works. Home sharing books works. But, when I try to copy the game app, it says my computer is not authorized. What am I doing wrong?

    I've been struggling with a similar issue myself and just figured it out.  Some of my content had been purchased with an older Apple ID that I don't use any more.  When I authorized my second computer, I only authorized it for my new Apple ID, not my old one.  When I tried to copy my library to the new computer, many songs, apps, etc. reported the error "could not be copied because this computer is not authorized".  It drove me crazy because I knew the computer was authorized and much of my library came over just fine.
    Finally I selected some of the problem items, selected "Get Info" from the menus, and saw that they were all purchased by my old Apple ID.  I then authorized my old Apple ID on my new computer, and all of my files are copying correctly now.
    Would be great if the message said something like "...because this computer is not authorized for Apple ID [email protected]"

  • My password seems to be working but my apps on my i pad will not update?  what am i doing wrong?

    i hove not been able to update apps on my ipad for weeks  my password seems to work but it will not update apps?  what am i doing wrong?

    What happens when you try to update? That is the missing element here? Without knowing what you are experiencing, it's really difficult to suggest what to do. I will go on the assumption that you are seeing the "waiting" icons. If that's the case, this is my standard response that includes quite a number of things to try.
    Even if it is not the "waiting" icons issue, one of these suggestions might help anyway.
    1. Tap the "waiting" icon and see if you can pause it. If it does pause, then tap it again and see if it will resume. If that works, repeat the same steps for each "waiting" icon.
    2. Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    3. Make sure that you do not have a stalled download in iTunes - if you have a download in there that did not finish, complete that one first.
    4. If that doesn't work - sign out of your account, restart the iPad and then sign in again.
    Settings>iTunes & App Store>Apple ID. Tap your ID and sign out. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    Go back to Settings>iTunes & App Store>Sign in and then try to update again. Tap one waiting icon only if necessary to start the download stream.
    5. You can also try deleting the waiting icons - tap and hold down on an icon until it wiggles - the tap the X on the icon to delete it. Then try to download again. Apps may also be able to be deleted in Settings>General>Usage>Storage if you cannot get the X to pop up on the icon.
    6. You can try resetting all settings. Settings>General>Reset>Reset All Settings. You will have to enter all of your device settings again.... All of the settings in the settings app will have to be re-entered.
    7. If all else fails, download the updates or the apps in iTunes on your computer and then sync the content to your iPad.

  • WRT54G does not work or what am I doing wrong?

    My setup: DSL -> 2wire modem router (bridge mode, firewall shutdown) ->WRT54G -> LAN with 1 IPPBX, 1 wired PC and 3 wireless PC.
    VoIP is running fine within our LAN, we have 2 SIP trunks running fine, But we just cant make an external softphone to work properly from WAN (outside the LAN).
    As long as I know, the simplest way to explain what a firewall does is 'everything requested from the inside should be wellcomed, anything unsolicited from the outside should be disallowed UNLESS explicitly told otherwise' this is, why the heck do we have unreachable ports althought we have allow those to receive extern traffic?
    Please check the pdf´s (snapshots) here:
    http://travelexpress.com.mx/download/router/status.pdf
    http://travelexpress.com.mx/download/router/router_firewall.pdf
    http://travelexpress.com.mx/download/router/router_forward.pdf
    http://travelexpress.com.mx/download/router/scanner.pdf
    http://travelexpress.com.mx/download/router/scanner1.pdf
    All those are for showing current setup, firewall, port forwarding and the results of a port scanner wich shows that efectively, we cannot use our extern SIP client because the WRT54G is blocking it...
    Thanks in advance as we are urged to fix this ASAP

    Yes. NAT is a function in the router. Just like the firewall. But still, both are different functions of the router. The firewall filters traffic to the router. NAT is responsible for mapping IP addresses. The reason why unsolicited packets from the internet won't get into the LAN is because NAT cannot deliver those packets and not the firewall rejecting some incoming connection. NAT does not filter. NAT tries to deliver and if it does not know where it drops it. But not because it wants to filter something.
    The settings on the router are correct. But as I have mentioned before, forwarding a port does not mean it's open or accessible. There are still other factors which could cause the port to be closed...
    Regarding the modem: you can check that if you connect a computer directly to the modem, open a port on the computer and then do the internet port scan again.
    I also explained how to check with telnet if TCP port 5060 on the IPPBX is really open or not. Why don't you just do this test? It would be much easier and faster, giving relevant answers. I don't mind whether asterisk usually uses both protocols on 5060 or not. Maybe it does. Maybe not. Maybe it can be configured. Whatever. Enter "telnet 192.168.1.69 5060" into a command prompt window of a computer connected to your LAN and you see if the port is open or not. Then we know something for sure instead of thinking about what should be or should not be...
    Also do the same telnet test with port 23 and 80 and then use the internet port scanner to scan for tcp port 23 and tcp port 80. Then we could see if anything goes through or not instead of discussing theory...
    I did not say you have to set up a lab setup. I only explained that you were mixing NAT functions and firewall functions of the router. The NAT function may look like some firewall in certain respects but it is still a different function with a completely different purpose.
    I also can't say if the IP settings are all correct. Maybe the IP address is correct but the gateway address is not. Or the DNS server.
    The subject of this thread is "... or what am I doing wrong?". It's impossible to comment on something if you don't give the details which would allow to verify that you have set it up indeed correct...

Maybe you are looking for

  • IE 5 and java2

    Can i use swing components in applets and watch it in ie5 without installing any "running environments" ?

  • Importing class from different directory

    Hi, Can anyone tell me how to import a class from a different directory? I have a DGenerator class in ./generator directory. I have tried Import generator.DGenerator; to use the DGenerator class. However. I got the error: cannot access generator.DGen

  • Planning Profile for Project System

    Dear All, In planning Profile (T Code OPSB) for Project System we can find  RElem.f.billing plan ..field, in this field which cost element we have to assign wheather it is sales revenue or secondary cost element cat.31 or else..plz adives me.. Thanks

  • Regarding no party no technical system, or anything when log into IR

    Hi all:      Technical systems(ABAP type) and business systems(ABAP type) have been created in SLD, however when log into Integration Repository, there is nothing on object Panel, no technical system or party , totally empty, could you please tell me

  • Changing the timing in scheduler jobs

    Hi All, In the below code I have given the execution timing as 2:15. But next run date value is showing as 3:00 AM. What is wrong here?. I created this job at 2:00 AM SQL> select owner,LAST_START_DATE,NEXT_RUN_DATE from dba_Scheduler_jobs where JOB_N