Having some trouble rounding decimal place

Hello all,
I am having some issues rounding a decimal in my code. My program is running and doing what I would like otherwise. Here is what I have so far:
public class MortCalc2
     public static void main(String [] args)
          //Declare and initialize three variables
          double numloanamt = 200000.00; //loan amount of 200k
          double numinterest = 0.0575;  //interest rate of 5.75%
          int numtermyrs = 30;  //term of 30 years
          int numtermmths = 360;  //term of 360 months
          double numwholeamt = 545000.00;  //loan amount + interest
          double numpayment = 0;  //monthly payment
          numpayment = numwholeamt/numtermmths;  //payment equals loan amount plus interest divided by the total term in months
          System.out.println("Your monthly payment is $" + numpayment);
}I am getting the results I want with the calculation except they are coming out as 1513.888888888889. I would like to see 1513.89. Can someone point me in the right direction. Thank you in advance for any help you can provide.
Thanks,
Seawall

Hi, sorry for the first post.
this works okay.
import java.math.*;
public class MortCalc2
     public static void main(String [] args){
are and initialize three variables
double numloanamt = 200000.00; //loan amount of
of 200k
double numinterest = 0.0575;  //interest rate of
of 5.75%
          int numtermyrs = 30;  //term of 30 years
          int numtermmths = 360;  //term of 360 months
double numwholeamt = 545000.00;  //loan amount +
+ interest
          double numpayment = 0;  //monthly paymen
numpayment = numwholeamt/numtermmths;  //payment
t equals loan amount plus interest divided by the
total term in months
numpayment =
Math.round(numpayment*100.0) / 100.0;
System.out.println("Your monthly payment is $" +
+ numpayment);
Thats right, use an Irish screwdriver (a hammer) instead of the correct solution as posted by djmd02 in repsonse #3.

Similar Messages

  • HT201342 I am having some trouble trying to back up my notes to my iCloud account, i have tried to delete my icloud account and create a new one, but still when i back my phone up on iCloud my notes do not seem to be backed up.How can i back up by notes o

    I am having some trouble trying to back up my notes to my iCloud

    Not photos, just data synced with iCloud shown in Settings>iCloud.  If you don't have sufficient storage to back up to iCloud, back up to your computer instead using iTunes (connect you phone to your computer, open iTunes, click on the name of your phone in iTunes, go to ths Summary tab of your iTunes sync settings and click Back Up Now).  Also transfer your purchases to your iTunes library (connect your phone to your computer, open iTunes and go to File>Devices>Transfer Purchases). If you have photo stream photos older than 30 days tha you wan to save, save these to your camera roll before backing up (tap Select, tap the photos, tap the share icon -- box with upward facing arrow, then tap Save to Camera Roll).
    When setting up your new phone, when given the option choose Restore from iTunes Backup and restore the backup you made earlier.

  • I'm having some trouble transferring audio books to my iPhone.  It usually takes 3 or 4 tries to get all the parts transferred.  I didn't use to have this problem - all parts would transfer in one try.

    I'm having some trouble transferring audio books to my iPhone.  It usually takes 3 or 4 tries to get all the parts transferred.  I didn't use to have this problem - all parts would transfer in one try.

    carolinechx wrote:
    i know the description may be a little bit too confusing
    Mostly because you are not using any capital letters or paragraph returns and your post is difficult to read.

  • Hi, i have an 6 gene ipod nano and having some trouble: suddenly the level of the sound starts getting lower and lower without my command...thanks.

    hi, i have an 6 gene ipod nano and having some trouble: suddenly the level of the sound starts getting lower and lower without my command...thanks.

    hi, i have an 6 gene ipod nano and having some trouble: suddenly the level of the sound starts getting lower and lower without my command...thanks.

  • FM to Round decimal place

    Hi Gurus,
    I want to reduce the number of decimal place by rounding off 2 decimal place.
    I am using 'HR_NZ_ROUNDING_DECIMALS' function module but its not working,
    kindly do the needful.
    Regards,
    Maithili

    Hi,
    Use Type cast method instead of finding FM.
    DATA : i type p decimals 4 VALUE '57846.5379'.
    DATA : j type p decimals 2.
    j = i.
    Write : / i.
    Write : / j.
    Regards,
    Velmurugan B

  • I am having some trouble with receiving messages from iMessage users when I don't have my iMessage turned on. When I called for support, I spent 30 min waiting and the woman's response to me was "Turn on your iMessage." I prefer not to use it

    I have an iPhone 5s and a MacBook Pro. Ever since I updated my computer software to Yosemite, it linked my Apple ID with my phone number and I am not receiving messages from iMessage users on my phone, but rather to my computer. I don't like to use iMessage so I keep it off and would like to receive all messages as SMS texts. I have already tried changing my Apple ID password, logging off of my Apple ID in iMessage on my phone and turning it off, and changing settings on messages on my computer. Nothing is working. Either the messages continue to go to my computer or the messages trying to be sent say they cannot be sent.
    After spending 30 + minutes waiting for technical support, the woman helping me (who did not give me her name) told me I should just turn on iMessage. After explaining that I don't like having iMessage on and asking why it worked for at least a year up until this point she said "things change and sometimes we don't know why things do what they do". She asked me about various other things on my phone such as bluetooth and told me to turn on and off airplane mode and the call disconnected. I have not been contacted since, even though she has my phone number.
    I am hoping for some help and also hoping people don't get the type of service I received tonight.

    I think you can solve your problems by removing your AppleID email address from BOTH the Messages setting on your iPhone and the iMessages settings on your Mac.
    On iPhone:
    Settings > Messages > iMessage > Dissabled
    Settings > Messages > Send & Receive > touch the "(i)" < touch "Remove This Email"
    On Mac:
    Open "Messages" application
    Click "Messages menu > Preferences
    Click "Accounts"
    Select your AppleID account
    Under the "You can be reached for messages at" settings, uncheck your AppleID email address and your phone number
    Then uncheck the "Enable this account" setting
    And lastly, ask all of your friends with iPhones to delete all iMessage conversations (blue bubbles) in their entirety.
    To test, send a friend a new text using their phone number (not their email address) and watch the color of the bubble.  If it's green then you are using SMS.

  • I am having some trouble playing games.

    I have an older gateway. I am not sure of the specific name of the model.                                                                                                                                                   specs                                                                                                                                                                                                               Processor:x2 Intel(R) core(tm) Duo cpu T2450 @ 2.00 ghz                                                                                                                                                       system:32-bit operating system                                                                                                                                                                                               computer:Acpi x86-based pc                                                                                                                                                                                                     internal memory/ram: 1.00 gb                                                                                                                                                                                                    I am not sure what else u need to help me with my problem. i just downloaded itunes and i am having trouble opening a game that i downloaded. the download was good i have a great wifi connection. It will not open,locate,or do anything. It gives me an option to open in internet explorer when i right click but still does nothing.I use google chrome for just about everything that it will allow but cannot find this game. Could this be why internet explorer isn't working? I went to the developer website which referred me to itunes. What can i do??

    Any game/App downloaded within iTunes will not work in no computer. They are designed to be synced and used on an iDevice.

  • Help: having some trouble dublicating a character

    [IMG]http://i269.photobucket.com/albums/jj41/leeindy/Capturegiff.png[/IMG]
    to me its an asterisk. But i just cant get it to look right. im using unstructured frame 10. ive tried several character designs but nothing seems to look right. i have microsoft office installed so i have a ton of fonts. i dont care how its done just as its 90% similar when printed. Help please.

    Let's suppose that Zapf Dingbats \x6b is what we want.
    This is how I'd do it:
    Create a Character Format named "Dingbats".
    Set all fields of the dialog to As-Is or blank except:
    Family: ZapfDingbats
    Special > Variable [Create Variable]
    Name: char.symbol.asterisk-full
    Definition: <Dingbats>\x6b<Default ¶ Font>
    Anywhere you need this:
    Special > Variable
    {select char.symbol.asterisk-full from list}
    [Insert]
    You might need to play with the point size in the Chr Fmt.
    Yes, you can hand type this as a local override, using some special keyboard sequence.
    Doing it as a variable has numerous advantages: It avoids having the next character be a Dingbat too, if not also the wrong size. You don't need to memorize or look up the key sequence, font name, etc. every time you need it. You get global control over all instances, in case you find a glyph you like better in some other typeface. If used in a heading, it will appear as an "*" instead of a "k". Spell check won't hassle you about the "k".

  • Oh boy am i having some trouble!

    I'm not very au fait with computers so i tried to search how to do somthing in the help function for finder. the search function doesn't seem to be working and when i tried the links they didnt work either. i tried help through a couple of other programmes and whilst the links worked there the search still wasn't working.
    Help me!!

    Is it just the Help that you are having trouble with?
    The search in Mac Help is not Spotlight related but you can try the steps in this The X Lab FAQ to troubleshoot your Help.
    http://www.thexlab.com/faqs/helpviewer.html

  • Having some trouble with importing audio and editing it in iMovie (iLife '11)

    Hey guys. Hopefully some of you will be willing to help me with my problem.
    Basically I have a video that I've imported into iMovie just fine, and I have a separate audio file that I want to lay over the video. I've figured out how to do this (throw the audio clip into iTunes, then import audio from the iTunes library browser within iMovie). My problem is that I want to have the audio clip I've imported from iTunes come in at a certain point on my video clip, and I want to completely mute the video's sound so that I can ONLY hear the audio clip I've imported from iTunes when that starts playing.
    If anyone can help me on how to do this, or if I was confusing and anyone needs clarification please let me know and I'll do my best to replay as quickly as possible.
    Thank you very much for any and all input!

    Drag your audio track from the Music Browser directly onto the point on your video clip where you wish the audio to start. Don't drag it into the background, but onto the clip thumbnail in your Project. I'm assuming that you have already created a Project and dragged clips from the imported Event. All the editing has to be done in the Project - not the Event.
    You will now see a green bar (ribbon) beneath the clip thumbnails, representing the inserted audio. If you click on the small waveform icon at the lower right below the Project thumbnails panel, the audio waveforms will appear (coloured light and medium blue).
    You can slide the audio back and forth. You can trim the ends by hovering the playhead (red vertical line) over either end of the green bar until you see a cross-hair icon - click and drag inwards or outwards (subject to audio being available at either end). You can also click on the small gear icon at the start of the audio track and select Clip Trimmer - here you can trim the ends by dragging the yellow handles whilst viewing the corresponding video.
    You can split the audio - place the playhead at the proposed split point on the highlighted audio track, right-click (or Control-click) and select Split Clip from the pop-up menu.
    If you click on the small gear icon at the start of the track, you can select the Clip Inspector. Click on Audio Adjustments. Otherwise just double-click the green bar and select Audio from the Inspector. In the Inspector you have many choices for editing audio, such as, volume levels, ducking, fading, enhancement, equalizer settings and so on.
    You can mute the original audio by double-clicking the video track (or using the gear icon), then reducing the volume in the Inspector's Audio tab. Another way is to use the Ducking feature. Open the Inspector for your added audio track and move the Ducking slider to the zero position - this will mute all other tracks running in parallel with the track you've inserted.
    You can easily fade audio tracks in and out without using the Inspector. Open the waveforms by clicking on the waveform icon (as described earlier). At each end of an audio track you will see a small greyish coloured box as you hover over that area. Click and drag as far as you want to create an audio fade. As you do this you will see the waveforms drop in volume.
    You can also select sections of audio in the audio track. In the bottom half of the audio track (with waveforms selected) click and drag to surround the selection with a yellow border. Now you can click on the volume line to adjust the volume up or down for that section. Drag the yellow dots to extend or reduce the fade on either side of the selection.
    Hope this helps! I think I've covered the essentials.
    John
    Message was edited by: John Cogdell

  • Hi! So I am using a MacBook Pro with Retina Display, and I am having some trouble issues with sharing documents on Google.

    I am part of a 2 person group, who's entering a documentary for the NHD competiton. If you don't know what that is here's a link: http://www.nhd.org. Anyway, that doesn't really matter. What does matter, is that my partner and I, we're using Final Cut Pro X to make the documentary. I downloaded the Final Cut Pro X trial on my MacBook Pro so I could work on our documentary at home. My partner Cecilia, wanted to work on it as well, but using Windows Media Player or something like that. My family uses a lot more Apple than windows. So I come home, work a little on our documentary, go under file ---> share ------> masterfile---> settings-----> Video Codec -----> H.264. A couple seconds/ miniutes (it didn't take very long) later, I see our documentary as a Quick Time file pop up under my documents. I then log into gmail. i click compose, type in my partners e-mail, and then click the little paper clip to attach my new quick time file. Considering that it's 11 minutes long and is filled with media and audio, It's no suprise when I see that it exceeds the limit of ...gigabytes i think. So i send it to her using google drive. However, a couple minutes later, my partner says that she can see the file, but can't seem to download it. I double-check and make sure that I, as the owner, allowed her to edit the file. Then I check to see if i accidently clicked: "Prevent viewer from downloading" which I hadn't. Then i, myself, click on the file and click download and it works fine for me, but apparently doesn't work at all for her windows computer. This means that there's somethig wrong with her computer, or I did something wrong while sharing the file. Any ideas as to why the whole downloading process worked on my Apple Laptop and not her Windows Computer?

    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.

  • Having some trouble here

    ok, i tried this, yet does not seem to want to work.
    I am trying to write a java program that calculates
    1/2 - 2/4 + 3/6 - 4/16 + ((-1) ^ (n+1))(n/2^n)
    ok, here is what i have so far:
    package project6;
    import javax.swing.JOptionPane;
    public class Project6 {
        public static void main (String [] args) {
            String enterN = JOptionPane.showInputDialog("Enter an number");
            double n = Double.parseDouble(enterN);
            double a = 1.0/12.0;
            double b = 2.0/4.0;
            double c = 3.0/8.0;
            double d = 4.0/16.0;
            double e = (-1) * (n + 1);
            double z = 1;
            while (z <= n) {
                n = n*n;
                z++;
            double resultA = a - b + c - d + e;
            String output = ("The answer is " + resultA);
            System.out.println(output);
            System.exit(0);
    }but it is not woerking out the way it is supposed to.
    i am NOT allowed to use the math.pow function, so that rules that out

    There's a whole list of wrong or strange things in your code...:
    but it is not woerking out the way it is supposed to.What does that mean? Does it compile? Do you get an error message? Is the output different from what you expected?
    double a = 1.0/12.0;Didn't you mean 1.0/2.0 (or 0.5) here?
    1/2 - 2/4 + 3/6 - 4/16This looks strange. 2/4 = 3/6 = 1/2 and 4/16 = 1/4.
    So 1/2 - 2/4 + 3/6 - 4/16 = 1/2 - 1/2 + 1/2 - 1/4 = 1/4.
    You can get rid of the whole a, b, c, d thing and just write:
    double resultA = 0.25 + e;
    double e = (-1) * (n + 1);
            double z = 1;
            while (z <= n) {
                n = n*n;
                z++;
            }You are doing some calculations here in which you change the value of n, but you're not using the variable n afterwards. So this whole loop is just dummy code.

  • Having some trouble automating?

    Hello there. I tried creating a workflow that I imported to save documents to PDF and the workflow completed but did not show where it was saved. I looked everywhere on my mac and did not find converted file?
    Anyone know why?
    Thx.
    Dorian

    Hi Ic
    I have just run some more tests with it and it is unreliable to say the least. It will not convert what it was doing earlier so there is a problem with it and maybe why it has not been updated since May 2005
    I will look at it again later as it is something I could use to save converting file types using Preview before combining them
    chris

  • I am having some trouble with Adobe Flash Player

    I have tried to record an audioboo and when I press record the Adobe Flash Player comes up and asks to allow the mic etc... I set it up to allow but then can't close the box!? I have tried lots of times and it just won't close and hence I can't record the boo. I don't have a problem closing the flash player any other time and I have in fact recorded audioboo's before, but for some reason I can't now? Any help or advice would be great. 

    I have the exact same issue - but the funny thing is that it is only on my iMac - my MacBook Pro is fine and they both have 10.7.2 and the same latest Flash Player, so I think it might be a hardware problem to be honest.
    Ever since upgrading to Lion my iMac has been that way - my MacBook Pro had the problem with the first update from Adobe but after the second update of the Flash Player everything is fine on the MacBook Pro.
    How old is you MacBook Pro?

  • Having some troubles with annotations, hyperlinks, images within PDFs

    Hello all.
    I am having a few issues with my PDFs and I hope that someone can assist me.
    First, I want to state that we are using LCES2 SP1, with Workbench, Designer, Workspace, PDF generator and Reader Extensions. We do not currently have Output.
    Situation:
    I have created several forms in Designer that present the user with information from an XML submitted via a .net app. The info includes customer data, URLs to other pages and a URL to an image/s which I embed within the PDF for presentation.
    In addition to the customer data, the forms present one or more embedded images from the XML which are different every time(dynamically embedded in form). We also present several URLs from the XML which I have hyperlinked. We also need to capture Annotations/markups on the PDF.
    I have the dynamically populated images displaying correctly to the user. Annotations and the hyperlinks are basically functioning correctly as well.
    My issues:
    The problems that I have encountered are:
    1. The embedded images that are presented do not show the annotations on them. It seems as though the annotations are marking on the PDF behind the embedded images. For example, if I draw a line across the PDF, the line is there but will not show on the actual images. Is there a way to push the images back and bring the annotations etc in front?
    2. The hyperlinks work correctly except that when we open the PDFs in Workspace, the hyperlinks open the page within the Workspace area. Is there a way to force the Hyperlinks from Workspace to open the page in a new browser tab or page? I have attempted to use the target="_blank" with no success.
    3. The annotations are being captured and collected ok within LC. I can see the updated XML which includes the markups etc. I have attempted to then use the updated XML to present the PDF, including the annotations, to the next user in the TaskAssignment. Even using Reader Extensions, the annotations/drawings do not display to the next user in their Task. However, if I open the same document using Acrobat Pro, the annotations are displayed correctly. Anyone have an idea what I am doing wrong? Do we require the use of Output to flatten the document with the annotations?
    Thank you all for your assistance
    David

    Hi,
    three years later I have the same problem as David posted in no. 1.
    I created a PDF form in LCD with image fields and text fields that are filled within another software. In LCD I placed the fields in the background. After the pdf fields have been filled within the other software the user wants to add markups and comments on it.
    But the markups on the PDF appear behind the images and texts. I need the markups in front, how can I manage this??
    Best regards,
    MiHue

Maybe you are looking for