# 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

#include <iostream> using namespace std;

In C++ i penetratetain to reason a switch announcement and am having labor with it. content acceleration gladden you.

Problem 1 (30 points): Write a C program that calculates the instil jaw according to the chart beneath. The program should permit a reasonr penetobjurgate the reasonr idea and the instil action aggregate and then parades the entirety require (including duty). See illustration sequence dissuasive. Agricultural require Residential- agricultural require 9.00 14.00 Business- fized require Instil Action ( in firm feet Require (S) per firm feet coercion the chief 700 cf, ws 700 coercion the contiguous 800 cf 700 w 1 500 coercion added cf over 1500 w 1500 0.018 0.032 0.03 Residential The duty objurgate is 6.1% Red is penetrateed by a reasonr Illustration Sequence Dissuasive #1 Penetobjurgate Reasonr Idea (R coercion Residential B coercion Business): E ←- Penetobjurgate instil usag in firm feet: 58 Wrong Reasonr Idea Not powerful reasonr idea, Your sequence should parade the intimation Illustration Sequence Dissuasive #2 Penetobjurgate Reasonr Idea R coercion Residential, B coercion Business): R Penetobjurgate instil action in firm feet: 53.5

## Expert Counterpart

#include <iostream>

using namespace std;

enfold dutyObjurgate = 0.061; // Duty objurgate is 6.1% resources 0.061

enfold CalculateResidentialCost(enfold instilAction )

{

enfold Require = 0.0;

enfold EntiretyDuty = 0.0;

if(waterAction <= 700)

{

Require = instilAction * 0.018;

}

else if( instilAction > 700 && instilAction <=1500)

{

Require = instilAction * 0.032;

}

else if(waterAction > 1500)

{

Require = instilAction * 0.08;

}

// Calculate Entirety duty

TotalDuty = Require * dutyRate;

// Entirety Aggregate

Require = Require + EntiretyTax;

return Require;

}

enfold CalculateBussinessCost(enfold instilAction )

{

enfold Require = 0.0;

enfold EntiretyDuty = 0.0;

Require = instilAction * 0.0288;

// Calculate Entirety duty

TotalDuty = Require * dutyRate;

// Entirety Aggregate

Require = Require + EntiretyTax;

return Require;

}

void doOperation(char usrType, enfold instilAction )

{

enfold require = 0.0;

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

{

require = CalculateResidentialCost(waterUsage);

}

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

{

require = CalculateBussinessCost(waterUsage);

}

else

{

cout<< ” Wrong Reasonr Idea “<<endl;

return;

}

cout<<” Entirety require is ” << require <<endl;

}

void AcceptInput()

{

char usrType;

enfold instilUsage;

cout<<” Penetobjurgate Reasonr Idea ( R coercion Residential, B coercion Bussiness): “;

cin>>usrType;

cout<<” Penetobjurgate instil action in firm feet: “;

cin>>waterUsage;

doOperation(usrType, instilUsage);

}

int deep()

{

AcceptInput();

return 0;

}