This time I will try to do this right.

I am trying to make make a class Account but I keep on getting an error that says that my if else statements are wrong I am not sure why.
So my question is can anyone tell me why I keep getting an error that says 'else' without 'if '? I have tried to take the { } out like;
public void debit(double amount)
     balance = balance - amount; //Subtract amount from balance.
     if(debitAmount > account1.getBalance());
        System.out.printf(" You don't have enough money for this transaction, the amount available is: $%.2f\n",
          account1.getBalance() );
     else
          account1.debit(debitAmount);
        System.out.printf(" The new balance is: $%.2f\n",account1.getBalance() );
}         I have also tried it like this;
public void debit(double amount)
     balance = balance - amount; //Subtract amount from balance.
     if(debitAmount > account1.getBalance());
        System.out.printf(" You don't have enough money for this transaction, the amount available is: $%.2f\n",
          account1.getBalance() );
     else
          account1.debit(debitAmount);
        System.out.printf(" The new balance is: $%.2f\n",account1.getBalance() );
}        

Melanie_Green wrote:
Using ';' at the end of an IF statement represents the end of the statement, so remove it.
if(condition)
//no brackets applies to the next line only
Next statement, actually. The following are equivalent.
if (x) y = z * 2;
// and
if (x)
  y = z * 2;
// and
if (
x
) y
=
z*
2
;Also, the following are equivalent. In neither case will w = 1 be dependent on the if
if (x)
  y = 2 ; w = 1;
// and
if (x)
  y = 2;
w = 1;

Similar Messages

  • I purchased an HD movie on Apple TV but it says that I cannot access the server at this time.  I try daily but this problem doesn't seem to go away.  Any suggestions?

    I purchased a movie via Apple TV/iTunes but it says that I cannot access the server at this time.  In summary, I can't download the movie.  This problem has persisted for 4-5 days now.  Any suggestions?  BTW, I upgraded to Yosemite on my iMac last weekend.  Thanks!

    You need more RAM.
    http://www.thexlab.com/faqs/lackofram.html
    Mostly iTunes, mail, finder, google chrome, and one or two other programs.
    What are the "two other programs?" The ones you named shouldn't be consuming all your RAM, even if open concurrently. But I've heard (I don't use it) 10.7 is a memory hog.
    Closing open apps may not solve the problem, since that memory is still being held in reserve for them.
    This problem is usually caused by a combination of low RAM and low disk space.I am very puzzled when you say you have 895GB left on the drive. That should be an enormous amount of room for the memory to page out (write) to.
    Message was edited by: WZZZ

  • The server was unable to save the form at this time. Please try again

    Having created a new custom list (even with only a text field) I am unable add new items to the list - the error message is Unexpected
    response from server. The status code of response is '0'. The status text of response is ''. when in 'quick edit'.
    If I try to add or modify an item in the list by clicking 'add new item' I get "The
    server was unable to save the form at this time. Please try again."
    I have restarted the Sharepoint Search Host Controller server but to no avail. I have 24Gb RAM for this server so it's not a
    memory issue (8Gb available). I have also tried from various browsers including Chrome and Safari - still the same error message.
    This error only occurs on lists. I can edit document properties in a library and have no problems with calendar entries.
    There are no entries in the event viewer, so where do I need to begin looking to find out what is (or rather is not) happening?

    One thing I noticed in SP 2013 is that if your list has unique permissions and a user/group has permissions only on that list and has limited or no access at the site level, then you run into this error: "The server was unable to save the form at this time.
    Please try again."
    This can be resolved by either giving that user/group atleast read access at the site level or in my case I had to create a new permission set (since we cant update limited access permission set) which is same as limited access but with the additional permission
    of "Use Remote Interfaces  -  Use SOAP, Web DAV, the Client Object Model or SharePoint Designer interfaces to access the Web site."
    I am not sure if this is a bug or as per design, but not allowing a user who has needed permissions at the list level but limited access at site level doesnt seem right. Never ran into this issue in prior version of SharePoint. I tested and this additional
    permission doesnt seem to violate any security at site level. But implement this at your risk. No guarantees provided and not responsible for any issues with this implementation if any.

  • I recently did the iOS 7.0.2 update, now I'm unable to purchase apps. "App could not be purchased at this time. Please try again later. ". I have tried a few of the suggestions and nothing has worked. Reset,change auto lock time on main screen, now what??

    I recently did the iOS 7.0.2 update, now I'm unable to purchase apps. "App could not be purchased at this time. Please try again later. ". I have tried a few of the suggestions and nothing has worked. Reset,change auto lock time on main screen, change language setting. Now what???

    This sorted it for me:
    Backup your iPhone to iCloud (I believe backing up to iTunes will work too). Now go to "Settings --> General --> Reset --> Erase All Content and Settings" to completely restore your iPhone to factory settings. Assuming you've backed up to iCloud, you'll be asked when setting up your iPhone if you want to restore from an iCloud backup. Choose that option and once your iPhone has restored itself from your backup, this annoying problem will finally be gone! (was for me anyway).
    To restore from an iTunes backup, connect your iPhone to your computer, load iTunes. Click the File menu and select Devices > Restore from Back up.

  • My ipad 2 did its own update as normal except this time it will not load anything to do with game center I cant even open that app is there something I can do

    my ipad 2 did its own update as usual ( 7.0 to 7.1) except this time it will not load anything to do with game center even its own app............is there anything I can do?

    Try closing all of the apps on your iPad and then reset the device.
    To close an app, drag the app up from the multitasking display. Double tap the home button and you will see apps lined up going left to right across the screen. Swipe to get to the app that you want to close and then swipe "up" on the app preview thumbnail to close it. Close every app this way.
    Reset 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 if it appears on the screen - let go of the buttons. Let the iPad start up.

  • Help me!!! I can't activate my iphone 4!!! iTunes say: Were sorry, we are unable to continue with your activation at this time. Please try again later, or contact customer care! What me do?! =((((

    Help me!!! I can't activate my iphone 4!!! iTunes say: Were sorry, we are unable to continue with your activation at this time. Please try again later, or contact customer care! What me do?! =((((
    i try it 3 day help me plz

    I tried it - does not help
    i'am colled in apple thay said that i must to pay 70USD for Apple Care Protactive Plane becouse my phone out of warranty and then thay can help me.
    i will hapend with activation before i unlock my phone in AT&T.
    what i need to do for activation ?

  • HT3743 HT4623 We're sorry, we are unable to continue with your activation at this time. Please try again later, or contact customer care.----How to fix this issue while setting up the iphone for the new ios?

    HT4623 We're sorry, we are unable to continue with your activation at this time. Please try again later, or contact customer care.----How to fix this issue while setting up the iphone for the new ios?

    If you don't have a SIM card in the phone, you must put one in. It's required for activation.
    If you do, then your phone was probably hacked to unlock it from the original carrier. Contact them and see if they will unlock it. If they will not do so, then you can't use that phone.

  • HT4623 Hello Management, Whenever i try to upgrade my Iphone it Brings this massage "We're sorry, we are unable to continue with your activation at this time. Please try again later, or contact customer care.

    HT4623 Hello Management, Whenever i try to upgrade my Iphone it Brings this massage "We're sorry, we are unable to continue with your activation at this time. Please try again later, or contact customer care.

    You are not talking to management here. No one here is an employee or representative of Apple. We are all users and this is a user to user forum.
    The message you describe is usually presented when a phone that has previously been jailbroken, hacked or otherwise been altered in an unauthorized manner. If this applies to your phone you will have to find help elsewhere. The terms of use of this forum prohibit discussion of unauthorized altered devices.

  • Office Home and Student 2010 has stopped working Unspecified Error has occurred. Request cannot be processed at this time. Please try again later ( 0x8007000D )

    My office is saying its an unlicensed product and it prompts me to re install.  It come up with Microsoft Activation Wizard then when I select to activate software via the internet an error comes up saying:
    Unspecified Error has occurred.  Request cannot be processed at this time. Please try again later ( 0x8007000D )
    Please can you help me? I have tried pressing shift and right click an using system administrator but still not working.  I've called the UK helpline and have been cut off twice after repeating myself to the person on the other end.  May be easier
    to try and get some assistance on here? 

    Hi,
    This error can indicate a permissions issue in the registry and/or other operating system issues.
    Here is a
    blog post which descripts some fixes to this specific error:
    Check the Device Manager first to determine whether the issue was caused by an underlying operating system issue.
    If it's not an issue with the operating system, try the rest steps descripted in the blog to troubleshoot the issue.
    Please have a try and feel free to post back with any findings.
    Regards,
    Ethan Hua
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • We're sorry, but we are unable to complete your request at this time. Please try again in a few minutes or start over now.

    Trying to send my iPhone 5 in for repair, keep getting this error:
    "We're sorry, but we are unable to complete your request at this time.
    Please try again in a few minutes or start over now.
    (system.99)"
    Tried using different browsers, and waiting few minutes, no joy : (
    Any Ideas?

    Yeah, it kept doing it when I was trying to change the delivery address, changed it on my apple main apple profile adress and then it worked on the repair page.

  • Error while creating task: The server was unable to save the form at this time. Please try again. (SharePoint 2013)

    I get the following error while saving a task inside task list:
    "The server was unable to save the form at this time. Please try again."
    I tried restarting "search service host controller".
    The server has 8 GB RAM and according to task manager, 6.67 GB is being used.
    I logged into the site with user which is the owner of the site. I tried creating tasks from client as well as the SharePoint server itself. Same error is shown in both the cases.
    How do I find information on the exact problem that is causing the error? What are possible solutions?

    Hi robikshrestha,
    This error message often shows when there is low memory that can be used, the workaround restart the “SharePoint Search Hosting Controller” service is to release some memory, and make it work. Whether restart the service release memory
    in your situation?
    Would you please check whether this issue happens all the time in task list, or happens sometimes when the memory is lower to use. If it doesn’t have a large impact, you can restart the server, check the result. have a look at the event
    log and ULS log, see whether there is related information.
    If it happens all the time, would you please use other browsers, whether the results are same? This may be caused by some add-ons in IE, like Free Download Manager I have seen.
    Thanks,
    Qiao Wei
    TechNet Community Support

  • HT4061 need help with my iphone 4 i try to update last five  days but after updating to 6.1.2  it says that    We're sorry, we are unable to continue with your activation at this time. Please try again later, or c

    need help with my iphone 4 i try to update last five  days but after updating to 6.1.2  it says that
    We're sorry, we are unable to continue with your activation at this time. Please try again later, or c

    If the iPhone was hacked and unlocked via unofficial means, it has become locked again. Insert original SIM in the phone to activate with iTunes.

  • App Store says, "Tuner! and 4 other apps could not be downloaded at this time. Please try again later." How may I appease the Store?

    App Store says, "Tuner! and 4 other apps could not be downloaded at this time. Please try again later."
    How may I appease the Store? The message first appeared a couple of weeks ago and seems to reappear every time I download something from the App Store, be it an update or a new app. I tried re-downloading and re-deleting "Tuner!" (this is the only one whose name I can see), but to no avail. I even tried hiding a whole load of apps from my Purchased list (including Tuner!) in the hope that the five offenders would GO AWAY and stop waiting around being nuisances ;) I haven't noticed them slowing down/stopping my other downloads, so I never paid the pop-up notice much attention, but it is starting to bug me now.
    Thank you if you can help.

    I have been getting the message from time to time over the last couple of weeks.  I just click through, and the download haooens anyway.      The other day I looged onto my accout in apple.com, and it simply wanted me to verify the ccv on the credit card.    
    I am glas your solution worked, but I am not sure you needed to do a full wipe and reinstall.   There is some goofy stuff going on with the store, but nothing you can't get by.

  • I am getting the error "We're sorry we cannot complete your request on the iTunes store at this time. Please try again later." on both my iPhone and iTunes on my computer. What is wrong with iTunes? Is the server down???

    I am getting the error "We're sorry we cannot complete your request on the iTunes store at this time. Please try again later." on both my iPhone and iTunes on my computer. What is wrong with iTunes? Is the server down or what? I need to download some things and update some apps...

    I've been getting the same message for like an hour now.  Since everything was working fine a few hours ago, and nothing changed on my end before it stopped working, I'm guessing it's something on Apple's end.  They probably already know about it by now, and are hopefully working on fixing it, so there's probably not much we can do but wait for them to fix it.

  • The server was unable to save the form at this time. Please try again - tried the trust standards...

    2013 standard sharepoint server.  Content DBs were on a Trial enterprise server and copied over to standard server. All was good on trial server.
    there are 8 sites on server, 2 of the sites cannot create or edit items, they get "The server was unable to save the form at this time. Please try again"
    googling around i tried everything. restarted search host controller, checked ram usage (8gb free), manage content types, iisresets, edit the web.config file ( add things for ram, search host, etc), no alternate access mappings, .net HTTP activation, rebooted
    server... I'm sure i missed some.
    The server is new install, all but the August HF CUs. Trial server the content DBs came from is at same level.
    It is not a server level issue as the other 6 sites are fine. its something with just 2 sites.
    kinda stuck here...
    Thanks,
       Scott<-

    With the USL Logs were hard to track down what was happening, though I think it was too do with /_vti_bin/client.svc/ProcessQuery.
    I did the Enable/Disable Anonymous Access on the Directory with no luck.
    Brought up Fiddler and Saw that I was getting 401 and 500 Errors on
    GET http://team.intranet.eandm.com/it/_vti_bin/client.svc/ProcessQuery HTTP/1.1
    So it had something to do with Permissions. I checked the Authentication and the sites that worked had Forms Auth Enabled, and the ones that didn't, didn't have forms Auth enabled.  Enabling it manually was no go.
    I then went though the web.config on the working and non-working sites and there were some differences.   The Authentication was Forms on the working site, Windows on the nonworking. There was many things not present. httpModules section was missing,
    Many of the Microsoft Identity /Authentication lines etc. 
    So I Basically took the web.config from the working site and copied it to the non-working site preserving the following line from the original web.config:
    <machineKey validationKey="{key}" decryptionKey="{key}" validation="{hash}" />
    After that I had Security Issues, Though I think this was Caused by the July 2014 CU making everything use the Microsoft Identity parts, where as the server I was porting form had the sites created before the July 2014 CU. (though both were at the same level)
    Even though all of the users were present in the site security, I had to Drop and re-add them to every site/and list with special Perms. 
    With the Security Fixed, I no longer received the Error "The server was unable to save the form at this time. Please try again"
    Knock on wood its all functioning fine. 

Maybe you are looking for