# 2 Nested Loops, the outer loop a while loop, AND a Switch

Mikes shoe shop sells shoes in 4 categories - A, B, C, D.
A costs \$100/pair, Bcosts \$150/pair, C-\$200/Pair, D\$300/pair.
You have to write a programme that calculates the total amount due by a customer when the number of pairs and the diferrent categories are specified.. The categories are indicated by the character A/B/C/D.. Finally the total number of pairs sold during the day must be displayed.

The program should display a prompting message asking for thenumber of pairs of shoes the customer wants to buy and should initialize the amount that is due to be paid to 0.Then it should have a 'for' loop going from 1 to the number of pairs the customer wants.
Inside the loop, the category of a specific pair is input. Then a switch statement should be used to determine the price.
You need not validate the input, but include a default case to display an appropriate message if an invalid category has been entered.
Add the price to the total that is due. When the loop ends, display the total amountthat is due by the customer.
The program should repeat the above for all customers until 0 is entered for the number of pairs of shoes.Finally the total number of pairs of shoes that has been sold should be displayed.
Program needs 2 nested loops. The outer loop will be a while loop.
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
This is homework. See http:/help.jsp#hi56

We can help you, but you've got to get the ball rolling, ManiPalani. Show us what's snagging you and we may be able to help, but we can't do the assignment for you.
0
Commented:
Post some code.
0
Author Commented:
Could rstaveley please refund the 500 points as I am planning to hold this question until I add some code.
The accept button was pressed in error.
ManiPalani
0
Commented:
Post a request in http:/Community_Support/ with a link to this question (which you can paste in as http:/Q_21805246.html) and they'll reopen the question and restore points. I'm not an administrator and cannot do this for you - otherwise I'd be happy to.
0
Author Commented:
Question on Hold till Mani Palani posts some code. (I dont know how to cancel this question till then)
0
Author Commented:
Question reopened
Can someone give me a clue as to how to :
1. Subtotal the values for each customer ie TotalPrice
2. Total the total number of shoes for all customers ie NumberPairs

#include <iostream>
#include <string>

using namespace std;
int main () {
char Category;
int counter, NumberPairs, PriceA, PriceB, PriceC, PriceD, TotalPrice;

do {
cout << " HOW MANY PAIRS OF SHOES? ";
cin >> NumberPairs;

for (counter = 1; counter <=NumberPairs; counter++)
{
cout << " Enter category :" <<endl;
cin >> Category;

switch (Category) {
case 'A':
PriceA = 100;
cout << 100 << endl;
break;
case 'B':
PriceB = 150;
cout << 150 << endl;
break;
case 'C':
PriceC = 200;
cout << 200 << endl;
break;
case 'D':
PriceD = 300;
cout << 300 << endl;
break;
default:
cout << " Invalid Category" << endl;
} //end switch

} //end for

} //end do

while ( NumberPairs!=0);

return 0;
}//END INT MAIN
0
Author Commented:
Problem solved!
0
Author Commented:
I am not sure how to delete this question from the list of open questions. Can an adminstrator help me?
0
Commented:
0
Author Commented:
Thank you for the reply but I cannot find the link above the text box referred to in the help file.
0
Commented:
Then post a request in http:/Community_Support/ with a link to this question (which you can paste in as http:/Q_21805246.html), pointing out that there is a problem with the EE software, causing the link not to be displayed. It could be a consequence of reopening the question.
0
Commented:
Beware that you cannot delete a question yourself when others have posted comments to it - see http:/help.jsp#hi302 - you'll need to ask the moderator to delete the question for you.
0
Commented:
Fine by me.
0
Commented:
Closed, 500 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.