Question: Design the flowchart of this program. #include #include using namespace std; //function prototype float fee_1 (); float fee_2 (int total_unit); float fee_3 (int total_unit); float

Design the flowchart of this program.

#include #include using namespace std; //function prototype float fee_1 (); float fee_2 (int total_unit); float fee_3 (int total_unit); float fee_4 (int total_unit); float charge(float total_bill);

int main () { string name, address; int i = 1; int month; int total_unit = 0; float total_bill = 0.0; int code; //input of user information cout<<"\t\tELECTRIC BILL"<>month; cout<>unit[month]; total_unit = total_unit + unit [month]; i++; } if (total_unit < 0) { cout<<"Input is invalid. Please try again."<= 0 && total_unit <= 10) { total_bill=fee_1(); //function call for 1st case } else if (total_unit > 10 && total_unit <= 100) { total_bill=fee_2(total_unit); //function call for 2nd case } else if (total_unit > 100 && total_unit <= 150) { total_bill=fee_3(total_unit); //function call for 3rd case } else { total_bill=fee_4(total_unit); //function call for 4th case } cout<<" The total bill for "<>code; //final output cout<<" ********************************************************** "; cout<<" Name\t: "<

return 0; }

float fee_1 () //user defined-function for 1st case { float bill; bill = 2.50; //minimum RM2.50 is charged for usage of 10 units or less return bill; }

float fee_2 (int total_unit) //user defined-function for 2nd case { float bill; bill = total_unit * 0.25; //25 cents is charged for the first 100 units return bill; }

float fee_3 (int total_unit) //user defined-function for 3rd case { float bill; bill = (100 * 0.25) + ((total_unit - 100) * 0.30); //25 cents is charged for the first 100 units, and 30 cents for the enxt 50 units return bill; }

float fee_4 (int total_unit) //user defined-function for 4th case { float bill; bill = (100 * 0.25) + (50 * 0.30) + ((total_unit - 150) * 0.35); //25 cents is charged for the first 100 units, 30 cents for the enxt 50 units, and 35 cents for units over 150 units return bill; }

float charge(float total_bill) //user defined-function for payment option { float after_charge; after_charge = total_bill * 1.02; //2% charge for at counter option return after_charge; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!