Problem

Understanding Nested if StatementsIn this exercise, you use what you have learned about wr...

Understanding Nested if Statements

In this exercise, you use what you have learned about writing nested if statements. This program was written for the Woof Wash dog-grooming business to calculate a total charge for services rendered. Woof Wash charges $12 for a bath, $10 for a trim cut, and $7 to clip nails. Take a few minutes to study the code that follows, and then answer Questions.

// WoofWash.cpp - This program determines if a doggy// service is provided and prints the charge.#include #include using namespace std;int main(){string service;const string SERVICE_1 = "bath";const string SERVICE_2 = "cut";const string SERVICE_3 = "trim nails";double charge;const double BATH_CHARGE = 12.00;const double CUT_CHARGE = 10.00;const double NAIL_CHARGE = 7.00;cout ≪ "Enter service: ";cin ≫ service;if(service == SERVICE_1)charge = BATH_CHARGE;else if(service == SERVICE_2)charge = CUT_CHARGE;else if(service == SERVICE_3)charge = NAIL_CHARGE;elsecharge = 0.00;if(charge > 0.00)cout ≪ "The charge for a doggy " ≪ service ≪ " is $"≪ charge ≪ endl;elsecout ≪ "We do not perform the " ≪ service≪ " service." ≪ endl;return 0;}

What is the exact output when this program executes if the user enters "BATH"?

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 4.3
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT