Q3. A power distribution company charges its consumers depending on the type of customer: 1- Class A or 2- Class B, the amount to be charged for Class A is based on the following: Consumption (in kwh) Charge per kwh 5 – 10.99 1 OMR 11-15.99 2 OMR 16 and above 3 OMR Class A customer is charged 7% more than Class B. Total bill is subject to 4% tax. Write a C program to input for the type of customer and the consumption. Output the total consumption, tax, and the total amount to be paid by the customer. Display all values using 3 decimal places. Add a do-while so that the program should run continuously until the user decides to stop.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

please also screen shot the output with abilitey to copy the code from your answer

Q3. A power distribution company charges its consumers depending on the type of customer:
1- Class A or 2- Class B, the amount to be charged for Class A is based on the following:
Consumption (in kwh)
Charge per kwh
5 – 10.99
1 OMR
11-15.99
2 OMR
16 and above
3 OMR
Class A customer is charged 7% more than Class B. Total bill is subject to 4% tax. Write a C
program to input for the type of customer and the consumption. Output the total consumption,
tax, and the total amount to be paid by the customer. Display all values using 3 decimal
places. Add a do-while so that the program should run continuously until the user decides to
stop.
Transcribed Image Text:Q3. A power distribution company charges its consumers depending on the type of customer: 1- Class A or 2- Class B, the amount to be charged for Class A is based on the following: Consumption (in kwh) Charge per kwh 5 – 10.99 1 OMR 11-15.99 2 OMR 16 and above 3 OMR Class A customer is charged 7% more than Class B. Total bill is subject to 4% tax. Write a C program to input for the type of customer and the consumption. Output the total consumption, tax, and the total amount to be paid by the customer. Display all values using 3 decimal places. Add a do-while so that the program should run continuously until the user decides to stop.
Expert Solution
Step 1

C program to calculate the total payable amount by a customer on the power consumption.

There are two types of customers.

One is Class A type and the other is Class B type.

The charges for the Class A type consumption are:

Computer Engineering homework question answer, step 1, image 1

The charges for Class A type customer is 7% more than the Class B type customer.

A 4% tax is applied to the total bill.

Display the total consumption, tax, and the total amount payable by a customer.

Step 2

prompt the user to enter the class type.

Store the class type in the variable named customerType.

prompt the user to enter the consumption

Store the consumption in the variable named consumption.

Calculate the charges.

If the user wants to calculate the charges for class B subtract 7% from the charges.

Calculate the tax on charges.

Calculate the total amount by adding the tax amount in the consumption charges.

display the total consumption.

display the tax amount.

Display the total amount.

Use the do-while loop to run the program continued until the user wants to stop.

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY