Homework Solution: In C++ i have to use a switch statement and am having trouble with it. please help thank you….

    In C++ i have to use a switch statement and am having trouble with it. please help thank you.Problem 1 (30 points): Write a C program that calculates the water bill according to the chart below. The program should let a user enter the user type and the water usage amount and then displays the total cost (including tax). See sample code execution. Fixed cost Residential- fixed cost 9.00 14.00 Business- fized cost Water Usage ( in cubic feet Cost (S) per cubic feet for the first 700 cf, ws 700 for the next 800 cf 700 w 1 500 for additional cf above 1500 w 1500 0.018 0.032 0.03 Residential The tax rate is 6.1% Red is entered by a user Sample Code Execution #1 Enter User Type (R for Residential B for Business): E ←- Enter water usag in cubic feet: 58 Wrong User Type Not valid user type, Your code should display the message Sample Code Execution #2 Enter User Type R for Residential, B for Business): R Enter water usage in cubic feet: 53.5
    Problem 1 (30 points): Write a C program that calculates the water bill according to the chart below. The program should let a user enter the user type and the water usage amount and then displays the total cost (including tax). See sample code execution. Fixed cost Residential- fixed cost 9.00 14.00 Business- fized cost Water Usage ( in cubic feet Cost (S) per cubic feet for the first 700 cf, ws 700 for the next 800 cf 700 w 1 500 for additional cf above 1500 w 1500 0.018 0.032 0.03 Residential The tax rate is 6.1% Red is entered by a user Sample Code Execution #1 Enter User Type (R for Residential B for Business): E ←- Enter water usag in cubic feet: 58 Wrong User Type Not valid user type, Your code should display the message Sample Code Execution #2 Enter User Type R for Residential, B for Business): R Enter water usage in cubic feet: 53.5

    Expert Answer

     
    #include <iostream> using namespace std;

    In C++ i enjoy to representation a switch proposition and am having embarrassment with it. fascinate succor gladden you.Problem 1 (30 points): Write a C program that calculates the breathe-into beak according to the chart underneath. The program should suffer a representationr invade the representationr model and the breathe-into experience aggregate and then evidences the sum consume (including rebuke). See scantling statute dissuasive. Urban consume Residential- urban consume 9.00 14.00 Business- fized consume Breathe-into Experience ( in firm feet Consume (S) per firm feet coercion the pristine 700 cf, ws 700 coercion the contiguous 800 cf 700 w 1 500 coercion joined cf over 1500 w 1500 0.018 0.032 0.03 Residential The rebuke rebuke is 6.1% Red is invadeed by a representationr Scantling Statute Dissuasive #1 Invade Representationr Model (R coercion Residential B coercion Business): E ←- Invade breathe-into usag in firm feet: 58 Wrong Representationr Model Not substantial representationr model, Your statute should evidence the missive Scantling Statute Dissuasive #2 Invade Representationr Model R coercion Residential, B coercion Business): R Invade breathe-into experience in firm feet: 53.5

    Problem 1 (30 points): Write a C program that calculates the breathe-into beak according to the chart underneath. The program should suffer a representationr invade the representationr model and the breathe-into experience aggregate and then evidences the sum consume (including rebuke). See scantling statute dissuasive. Urban consume Residential- urban consume 9.00 14.00 Business- fized consume Breathe-into Experience ( in firm feet Consume (S) per firm feet coercion the pristine 700 cf, ws 700 coercion the contiguous 800 cf 700 w 1 500 coercion joined cf over 1500 w 1500 0.018 0.032 0.03 Residential The rebuke rebuke is 6.1% Red is invadeed by a representationr Scantling Statute Dissuasive #1 Invade Representationr Model (R coercion Residential B coercion Business): E ←- Invade breathe-into usag in firm feet: 58 Wrong Representationr Model Not substantial representationr model, Your statute should evidence the missive Scantling Statute Dissuasive #2 Invade Representationr Model R coercion Residential, B coercion Business): R Invade breathe-into experience in firm feet: 53.5

    Expert Retort

     

    #include <iostream>

    using namespace std;

    wrap rebukeRebuke = 0.061; // Rebuke rebuke is 6.1% media 0.061

    wrap CalculateResidentialCost(wrap breathe-intoExperience )

    {

    wrap Consume = 0.0;

    wrap SumRebuke = 0.0;

    if(waterExperience <= 700)

    {

    Consume = breathe-intoExperience * 0.018;

    }

    else if( breathe-intoExperience > 700 && breathe-intoExperience <=1500)

    {

    Consume = breathe-intoExperience * 0.032;

    }

    else if(waterExperience > 1500)

    {

    Consume = breathe-intoExperience * 0.08;

    }

    // Calculate Sum rebuke

    TotalRebuke = Consume * rebukeRate;

    // Sum Aggregate

    Consume = Consume + SumTax;

    return Consume;

    }

    wrap CalculateBussinessCost(wrap breathe-intoExperience )

    {

    wrap Consume = 0.0;

    wrap SumRebuke = 0.0;

    Consume = breathe-intoExperience * 0.0288;

    // Calculate Sum rebuke

    TotalRebuke = Consume * rebukeRate;

    // Sum Aggregate

    Consume = Consume + SumTax;

    return Consume;

    }

    void doOperation(char usrType, wrap breathe-intoExperience )

    {

    wrap consume = 0.0;

    if(usrModel == ‘R’ || usrModel == ‘r’)

    {

    consume = CalculateResidentialCost(waterUsage);

    }

    else if(usrModel == ‘B’ || usrModel == ‘b’)

    {

    consume = CalculateBussinessCost(waterUsage);

    }

    else

    {

    cout<< ” Wrong Representationr Model “<<endl;

    return;

    }

    cout<<” Sum consume is ” << consume <<endl;

    }

    void AcceptInput()

    {

    char usrType;

    wrap breathe-intoUsage;

    cout<<” Invade Representationr Model ( R coercion Residential, B coercion Bussiness): “;

    cin>>usrType;

    cout<<” Invade breathe-into experience in firm feet: “;

    cin>>waterUsage;

    doOperation(usrType, breathe-intoUsage);

    }

    int main()

    {

    AcceptInput();

    return 0;

    }