1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
IrinaK [193]
3 years ago
11

Business customers pay $0.006 per gallon for the first 8000 gallons. If the usage is more than 8000 gallons, the rate will be $0

.008 per gallon after the first 8000 gallons. For example, a residential customer who has used 9000 gallons will pay $30 for the first 6000 gallons ($0.005 * 6000), plus $21 for the other 3000 gallons ($0.007 * 3000). The total bill will be $51. A business customer who has used 9000 gallons will pay $48 for the first 8000 gallons ($0.006 * 8000), plus $8 for the other 1000 gallons ($0.008 * 1000). The total bill will be $56. Write a program to do the following. Ask the user which type the customer it is and how many gallons of water have been used. Calculate and display the bill.
Computers and Technology
1 answer:
trasher [3.6K]3 years ago
4 0

Answer:

#include <bits/stdc++.h>

using namespace std;

int main()

{

   // variables

   char cust_t;

   int no_gallon;

   double cost=0;

   cout<<"Enter the type of customer(B for business or R for residential):";

   // read the type of customer

   cin>>cust_t;

   // if type is business

   if(cust_t=='b'||cust_t=='B')

   {

       cout<<"please enter the number of gallons:";

       // read the number of gallons

       cin>>no_gallon;

       // if number of gallons are less or equal to 8000

       if(no_gallon<=8000)

       {

           // calculate cost

           cost=no_gallon*0.006;

           cout<<"total cost is: $"<<cost<<endl;

       }

       else

       {

           // if number of gallons is greater than 8000

           // calculate cost

           cost=(8000*0.006)+((no_gallon-8000)*0.008);

           cout<<"total cost is: $"<<cost<<endl;

           

       }

       

   }

   

   // if customer type is residential

   else if(cust_t=='r'||cust_t=='R')

        {

           

       cout<<"please enter the number of gallons:";

       // read the number of gallons

       cin>>no_gallon;

       // if number of gallons are less or equal to 8000

       if(no_gallon<=8000)

       {

           // calculate cost

           cost=no_gallon*0.007;

           cout<<"total cost is: $"<<cost<<endl;

       }

       else

       {// if number of gallons is greater than 8000

       // calculate cost

           cost=(8000*0.005)+((no_gallon-8000)*0.007);

           cout<<"total cost is: $"<<cost<<endl;      

       }        

   }

return 0;

}

Explanation:

Ask user to enter the type of customer and assign it to variable "cust_t". If the customer type is business then read the number of gallons from user and assign it to variable "no_gallon". Then calculate cost of gallons, if  gallons are less or equal to 800 then multiply it with 0.006.And if gallons are greater than 8000, cost for  first 8000 will be multiply by 0.006 and  for rest gallons multiply with 0.008.Similarly if customer type is residential then for first 8000 gallons cost will be multiply by 0.005 and for rest it will  multiply by 0.007. Then print the cost.

Output:

Enter the type of customer(B for business or R for residential):b                                                                                            

please enter the number of gallons:9000                                                                                                                      

total cost is: $56  

You might be interested in
1. Fill in the blanks:
Anit [1.1K]

Answer:

<h2>a) computer software </h2>

<h2>b) flash drive</h2>

<h2>c) Latin "putare" </h2>

<h2>d) Hardware</h2>

<h2>e) software</h2>

hope it's helpful ✌

8 0
3 years ago
Will this solution really fix the problem?
vova2212 [387]

Answer:

yes it will

Explanation:

6 0
2 years ago
Draw a flow chart to print gratest number among two .​
bagirrra123 [75]
MYbe show a picture next time so we can see what the problem is about ?
7 0
2 years ago
Read 2 more answers
As Jason walks down the street, a large raven starts squawking at him and flapping its wings. Jason thinks to himself ‘That bird
UNO [17]

Answer:

Answer to the following question is anthropomorphism.

Explanation:

Anthropomorphism is considered as the error in the following context of the scientific reductionism. Anthropomorphize is the source of an error that needs to reconsider.

Anthropomorphism is an attribute of the human qualities, emotions, thoughts, motivation, intentions, and characteristics to the non-living beings or the nonhuman beings, things or objects.

8 0
3 years ago
Which word or phrase refers to an increasingly common method of computing and storing files?
Alecsey [184]
The answer is Cloud computing
Hope this helps-
3 0
3 years ago
Read 2 more answers
Other questions:
  • Jackson is teaching the decimal number system. He wants his students to know how to expand numbers by powers of 10. Which is the
    13·2 answers
  • Nvm, Its B.
    10·1 answer
  • SATCOM in the Ku- and Ka- bands, as well as EHF systems are adversely affected by rain (the higher the frequency, the greater th
    14·1 answer
  • Create a pseudocode program that asks students to enter a word. Call a function to compute the different ways in which the lette
    9·1 answer
  • Someone asks you for help with a computer that hangs at odd times. You turn it on and work for about 15 minutes, and then the co
    10·1 answer
  • Visual culture is an area of academic study that deals with the totality of images and visual objects produced in ____________,
    6·1 answer
  • What is the python print of (“5”+”7”)?
    10·1 answer
  • How do i use a computer (i'm 99999 years old)
    8·2 answers
  • If i hit the delete key three times what will be left
    12·1 answer
  • Which directory stores the cron configuration file?.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!