Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following formula can be used to verify the ABN you are allocated orto verif

ID: 3640807 • Letter: T

Question

The following formula can be used to verify the ABN you are allocated orto verify the ABN issued to a business you deal with. To verify an ABN: Extract each digit from the number beginning with the lowest order digit, multiply it by the appropriate factor (see below) and add the result into a total. When you come to the leftmost digit, first subtract 1. then multiply it by its weight factor (10). Divide the total by 89. noting the remainder If the remainder is zero the number is valid Weight factors (for Step 2) To check the validity of ABN 53 004 085 616 Apply weighting factor to each digit, up to. but not including the left most (6 Times 19) + (1 Times 17) +(6 Times 15) +(5 Times 13) + (8 Times 11) +(0 Times 9) +(4 Times 7) +(0 Times 5) + (0 Times 3) + (3 Times 1) 114+17+90+65+88+0+28+0+0+3=405 Subtract 1 from the leftmost digit multiply it by its factor and add it in to the total (5-1)*10 =40 405+40 = 445 445/89 = 5 remainder 0 The remainder is zero so the number is valid. You may extract the rightmost digit by dividing the number by 10 and taking the remainder (ABN% 10). You can then remove that digit by dividing by 10 (ABN/10)

Explanation / Answer

#include <iostream>
using namespace std;

int main()
{
   //PROTOTYPES
   bool validAbn(long long);

   //LOCAL DECLARATIONS
   long long ABN_Number = 53004085616;

   //PROCEDURES
   if (validAbn(ABN_Number))
      cout << ABN_Number << " is valid." << endl;
   else
      cout << ABN_Number << " is not valid." << endl;

   cout << endl;
   return 0;
}

//---------------------------------------------------------
// FUNCTION DEFINITIONS
//---------------------------------------------------------
bool validAbn(long long ABN_Number)
{
   int sum = 0;
   for (int weight = 19; weight > 0; weight -= 2)
   {
      sum += (ABN_Number % 10) * weight;
      ABN_Number /= 10;
   }
   if (ABN_Number < 10)
   {
      sum += (ABN_Number - 1) * 10;
      if (sum % 89 == 0)
         return true;
   }
   return false;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote