You seem to be leaving out braces on your if statements. It was really easy to find with the code auto-indented. Here's a code excerpt:
switch (pkgType)
{
case 'A':
if (hours > ONE )
cout << "Package A " << PRICEA << hours
<< cost << endl;
cost = PRICEA + ((hours - ONE) * EXTRA1); // this will always get run
break; // this will always get run
// everything below this is unreachable code
else if (hours <= ONE)
{
cout << "Package A " << PRICEA << hours
<< cost << endl;
cost = PRICEA;
}
break;
That happens in all the case statements. I think you want something like this:
switch (pkgType)
{
case 'A':
if (hours > ONE )
{
cout << "Package A " << PRICEA << hours
<< cost << endl;
cost = PRICEA + ((hours - ONE) * EXTRA1);
}
else if (hours <= ONE)
{
cout << "Package A " << PRICEA << hours
<< cost << endl;
cost = PRICEA;
}
break;
which could be further reduced to this:
switch (pkgType)
{
case 'A':
cout << "Package A " << PRICEA << hours
<< cost << endl; // this line was the same in both the if and else
if (hours > ONE )
{
cost = PRICEA + ((hours - ONE) * EXTRA1);
}
else if (hours <= ONE)
{
cost = PRICEA;
}
break;
btw, for future posts, please put your code between[code] and [/code] tags to preserve formatting for the rest of us. Also, posting the error message is usually quite helpful ;)