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

#include <iostream> #include <string> using namespace std; int main() { string z

ID: 3640171 • Letter: #

Question

#include <iostream>
#include <string>

using namespace std;

int main()
{
string zipString;
int value;

do
{
cout << "Please enter a zip code with exactly five digits. "
<< "the zipcode must start with either 605, or 606. Enter 1 to exit. >>";
cin >> zipString;

if(zipString.size() != 5) { continue; } //if its not exactly 5 numbers long

//Check the first 3 numbers for either 606, or 605;
if(zipString[0] != '6') { continue; }
if(zipString[1] != '0') { continue; }
if(zipString[2] == '6') { value = 30; }
if(zipString[2] == '5') { value = 25; }

cout << "The shipping charge for " << zipString << " is $" << value << ".00" << endl;
cin.sync();
cin.get();
}while(zipString[0] != '1');

return 0;
}

Explanation / Answer

PS: Please rate the answer #include #include using namespace std; int main() { string zipString; int value; do { cout > zipString; if(zipString.size() != 5) { continue; } //if its not exactly 5 numbers long //Check the first 3 numbers for either 606, or 605; if (zipString.compare(0,3,"605") == 0) value = 25; else if(zipString.compare(0,3,"606") == 0) value = 30; else continue; cout