Search:

Type: Posts; User: javapol

Search: Search took 0.11 seconds.

  1. Thread: Do While Loop

    by javapol
    Replies
    29
    Views
    2,474

    Re: Do While Loop

    Here is my code now, it's working. Thanks for your help, one more thing, the condition is always going to be true. So why won't it work without the IF Statement?


    public class Donations
    {
    ...
  2. Thread: Do While Loop

    by javapol
    Replies
    29
    Views
    2,474

    Re: Do While Loop

    Now it's telling me that highestDonation isnt initialised. I don't know how to intitialise this variable, I know how, but don't know what I should be setting it to. :(
  3. Thread: Do While Loop

    by javapol
    Replies
    29
    Views
    2,474

    Re: Do While Loop

    I have been changing things, trying different things out based on what you guys have said, I am still having trouble. Here is my code

    public class Donations
    {
    public static void...
  4. Thread: Do While Loop

    by javapol
    Replies
    29
    Views
    2,474

    Re: Do While Loop

    Im not 100% sure, so i guess i dont need it.
  5. Thread: Do While Loop

    by javapol
    Replies
    29
    Views
    2,474

    Re: Do While Loop

    I thought id need it for the if statement,
  6. Thread: Do While Loop

    by javapol
    Replies
    29
    Views
    2,474

    Re: Do While Loop

    I havent defined current, I don't know what to initialise it as,
    The newDonation is defined under the prompt so that it will store what the user enters.
  7. Thread: Do While Loop

    by javapol
    Replies
    29
    Views
    2,474

    Re: Do While Loop

    Thanks for pointing that out, I need to change the values of highest donation not newDonation, therefore, I think the condition should be:
    highestDonation=newDonation
    I have not initialised...
  8. Thread: Do While Loop

    by javapol
    Replies
    29
    Views
    2,474

    Re: Do While Loop

    I would do an if statement:

    if(newDonation>currentDonation)
    {
    newdonation=highestdonation
    }
  9. Thread: Do While Loop

    by javapol
    Replies
    29
    Views
    2,474

    Re: Do While Loop

    I don't know the answer to this :(
  10. Thread: Do While Loop

    by javapol
    Replies
    29
    Views
    2,474

    Re: Do While Loop

    Oh, with an IF Statement, I think I know now :)
  11. Thread: Do While Loop

    by javapol
    Replies
    29
    Views
    2,474

    Re: Do While Loop

    I have got everything working, it's just I am stuck on what else to add so that I can output 'who donated the most'. Im guessing this would require me to add something inside the loop to store each...
  12. Thread: Do While Loop

    by javapol
    Replies
    29
    Views
    2,474

    Re: Do While Loop

    1.
    - A For Loop to ask the donor's for their donation details (name & amount)
    - donationQuantity Variable to calculate amount of donations.
    - maxDonation Variable to calculate the total of...
  13. Thread: Do While Loop

    by javapol
    Replies
    29
    Views
    2,474

    Re: Do While Loop

    Yes I have thought about it, I have thought about passing the donation amount to another variable but when it loops up and around to repeat the code then wont the value stored in that variable be...
  14. Thread: Do While Loop

    by javapol
    Replies
    29
    Views
    2,474

    Do While Loop

    So I am prompting the user for donations in a do while loop while the total is less than 500. I need to print out who the highest donor was, how would I do this?
Results 1 to 14 of 14