2 Nested Loops, the outer loop a while loop, AND a Switch
Posted on 2006-04-07
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.