Develop a program to determine the price for a custom shop sign. The price is determined by the number of colors in the sign, if the sign will have lighting, and if an old sign must be removed. Lighted signs cost 25% more than the base price, and removal of an old sign costs 10% of the base price of the new sign. You must validate the input; make sure the number of colors is greater than 0. You must use switch to calculate base price based on the number of colors. The total cost must be represented in currency ($) and two digits decimal points. Your program’s prompt and messages should look similar to the sample provided. The fee schedule is shown below: Colors in the sign Base Price 1 $250 2 $325 3 $450 4 $625 5 or more $850 For example: Num Base Price Light Remove With Light With Remove Total Cost 1 $250.00 Y Y $312.50 $25.00 $337.50 1 $250.00 Y N $312.50 $0.00 $312.50 1 $250.00 N Y $250.00 $25.00 $275.00 1 $250.00 N N $250.00 $0.00 $250.00
Develop a program to determine the price for a custom shop sign. The price is determined by the number of colors in the sign, if the sign will have lighting, and if an old sign must be removed. Lighted signs cost 25% more than the base price, and removal of an old sign costs 10% of the base price of the new sign. You must validate the input; make sure the number of colors is greater than 0. You must use switch to calculate base price based on the number of colors. The total cost must be represented in currency ($) and two digits decimal points. Your program’s prompt and messages should look similar to the sample provided. The fee schedule is shown below: Colors in the sign Base Price 1 $250 2 $325 3 $450 4 $625 5 or more $850 For example: Num Base Price Light Remove With Light With Remove Total Cost 1 $250.00 Y Y $312.50 $25.00 $337.50 1 $250.00 Y N $312.50 $0.00 $312.50 1 $250.00 N Y $250.00 $25.00 $275.00 1 $250.00 N N $250.00 $0.00 $250.00
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Develop a program to determine the price for a custom shop sign. The price is determined by the number of colors in the sign, if the sign will have lighting, and if an old sign must be removed.
Lighted signs cost 25% more than the base price, and removal of an old sign costs 10% of the base price of the new sign.
- You must validate the input; make sure the number of colors is greater than 0.
- You must use switch to calculate base price based on the number of colors.
- The total cost must be represented in currency ($) and two digits decimal points.
- Your program’s prompt and messages should look similar to the sample provided.
The fee schedule is shown below:
Colors in the sign |
Base Price |
1 |
$250 |
2 |
$325 |
3 |
$450 |
4 |
$625 |
5 or more |
$850 |
For example:
Num |
Base Price |
Light |
Remove |
With Light |
With Remove |
Total Cost |
1 |
$250.00 |
Y |
Y |
$312.50 |
$25.00 |
$337.50 |
1 |
$250.00 |
Y |
N |
$312.50 |
$0.00 |
$312.50 |
1 |
$250.00 |
N |
Y |
$250.00 |
$25.00 |
$275.00 |
1 |
$250.00 |
N |
N |
$250.00 |
$0.00 |
$250.00 |
Expert Solution
Step 1
Algorithm:
- Include the iostream library. Define the main function.
- Declare integer variable nColors. Declare two character variables: lighted and oldRemoved.
- Prompt the user to input the number of colors in the sign and store it in nColors.
- If nColors is 0, output "Invalid number of colors; it must be greater than zero."
- Prompt the user if they want a lighted sign and store the response in lighted.
- Prompt the user if they need an old sign removed and store the response in oldRemoved.
- Declare a double variable basePrice and initialize it to 0.
- Use an if-else statement to determine the value of basePrice based on the value of nColors.
- Declare a double variable total and initialize it to basePrice.
- If lighted is 'y', add 25% of basePrice to total. If oldRemoved is 'y', add 10% of basePrice to total.
- Output the total price as "The price is $total".
- End the main function.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education