Write a program to estimate the price of toupees. There are three models: rug, mop, and silky. The price per unit depends on the order amount:
Model | Quantity | Price per unit |
Rug | 1 – 9 | $89.95 |
Rug | 10 – 29 | $79.95 |
Rug | 30 or more | $64.95 |
Mop | 1 – 9 | $129.95 |
Mop | 10 – 29 | $109.95 |
Mop | 30 or more | $89.95 |
Silky | 1 – 9 | $229.95 |
Silky | 10 – 29 | $189.95 |
Silky | 30 or more | $149.95 |
Your worksheet starts like this:
The user enters a model, a quantity, and clicks Run.
Your program validates both inputs. Model should be R, M, or S. Your program should work for upper- and lowercase, and if there are spaces before or after the character (e.g., " r " is OK). Show error messages as needed.
Quantity must be a number that's one or greater. Show error messages as needed.
The total is price per unit times number ordered.
The usual coding standards apply.
Submit your worksheet.
(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)
Keywords: