Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

I want this program in the same file .cpp only. please test the program before you give it to me. please do the program before the deadline.

1 answer below »
I want this program in the same file .cpp only. please test the program before you give it to me. please do the program before the deadline.
Answered Same Day Sep 29, 2021

Solution

Sudipta answered on Oct 01 2021
144 Votes
#include #include #include for exit()
using namespace std;
class ZipCode{
public:
ZipCode(int zip);
takes zip code as an integer input
ZipCode(string bar);
takes zip code as a string (0, 1) input
int getZipCode();
eturns the zip code as an intege
string getBarCode();
eturns the zip code as a string

private:
int zipCode;
string barCode;
ool checkBarCode();
checks the first and last digit is 1 or not and also if the length is 27 or not
ool checkTwoOnes();
checks if exactly two 1's in each group of 5 digits or not
int calculateZipCode();
eturns the final result
string getFiveDigitValues();
};
ZipCode::ZipCode(int zip) : zipCode(zip){}
ZipCode::ZipCode(string bar) : barCode(bar){}
int ZipCode::getZipCode(){
if(checkBarCode()){
if(checkTwoOnes()){
zipCode = calculateZipCode();
}
else{
cout
"There are not exact two one's in each group of 5'!";
exit(1);
}
}
else{
cout
"Invalid Bar-code!";
exit(1);
}
return zipCode;
}
string ZipCode::getBarCode(){
barCode =...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here