Search:

Type: Posts; User: hotshotennis

Search: Search took 0.61 seconds.

  1. Replies
    13
    Views
    468

    Re: Credit Card String Program

    private int calcCheckDigits() {
    int sum;
    sum = checkSum();
    System.out.println("Sum2 = " + sum);
    // if ((sum + checkDigit) % 10 == 0) {
    checkDigit += sum;
    ...
  2. Replies
    13
    Views
    468

    Re: Credit Card String Program

    I think it assigns a value, just not the right one because sum is completely off and too large... But I don't know where the logic in the code is wrong.
  3. Replies
    13
    Views
    468

    Re: Credit Card String Program

    checkDigit is assigned inside of the method calcCheckDigits. But it relies on sum, which I'm pretty sure is wrong.
    If I assign chechDigit to -1 like you specified, the new output I get looks like...
  4. Replies
    13
    Views
    468

    Re: Credit Card String Program

    Okay here is my new scanner definition:


    static Scanner scanner = new Scanner("321321\n654654654\n2\n987987\nn");


    And my resulting output from it(still has the debugging println for sum):...
  5. Replies
    13
    Views
    468

    Re: Credit Card String Program

    My debugging println statement was used to print out the sum right before it is returned from the method chechSum. I provided the user input used in running the program in my very first post. Here it...
  6. Replies
    13
    Views
    468

    Re: Credit Card String Program

    Hmmm its made from my checkSum method.... but I cannot understand how my sum could end up being zero. Everything looks good to me. I guess I'll try tinkering with it some more.

    --- Update ---
    ...
  7. Replies
    13
    Views
    468

    Credit Card String Program

    public class CreditCardNumber {
    private String issuerID = "000000";
    private String accountNum = "999999999";
    private int checkDigit;

    public CreditCardNumber(String tempIssuerID, String...
Results 1 to 7 of 7