Results 1 to 5 of 5
  1. #1
    darthamctis is offline Member
    Join Date
    Sep 2015
    Posts
    3
    Rep Power
    0

    Angry Need help with program!!

    This is my code.

    import java.util.Scanner;


    public class Temp {

    public static void main(String[] args) {
    // TODO Auto-generated method stub
    // Title
    System.out.println("!!Pound Collecter!!");
    int accumulatedPounds = 0;
    int todayPounds = 0;
    String keepGoing = "";
    String stopGoing = "";

    // Create a Scanner
    Scanner input = new Scanner(System.in);

    //processing
    do {
    accumulatedPounds = 0;
    for (int counter = 0; counter < 7; counter++)

    //input
    {
    System.out.println("Please enter the number of "
    + "Pounds for day " + (counter + 1));
    todayPounds = input.nextInt();
    accumulatedPounds = todayPounds;
    }

    //output
    System.out.println("The total number of Pounds collected "
    + "is " + accumulatedPounds + " ");
    System.out.println("The total paid out is $" +
    String.format("%.2f", accumulatedPounds * .50));
    System.out.println("Do you want to continue? Enter y/n");
    keepGoing = input.next();

    } while (keepGoing.equals("y") || keepGoing.equals("Y"));


    if (stopGoing.equals("n") || stopGoing.equals("N"));

    System.out.println("Thank you for playing!!");
    stopGoing = input.next();



    }

    }


    Everything works except it wont add the numbers that i enter to make the accumulatedPounds correct. any help would be great!!!

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Need help with program!!

    Also posted at: Need help with program!!
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    darthamctis is offline Member
    Join Date
    Sep 2015
    Posts
    3
    Rep Power
    0

    Default Re: Need help with program!!

    Two different forums right?

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Need help with program!!

    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    darthamctis is offline Member
    Join Date
    Sep 2015
    Posts
    3
    Rep Power
    0

Similar Threads

  1. Replies: 19
    Last Post: 07-17-2015, 03:40 PM
  2. Replies: 6
    Last Post: 12-15-2013, 06:40 AM
  3. Replies: 4
    Last Post: 11-21-2012, 01:19 PM
  4. Replies: 2
    Last Post: 04-02-2011, 12:57 PM
  5. Replies: 0
    Last Post: 10-04-2007, 09:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •