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]
4 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]4 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
The presentation ____ determines the formatting characteristics of fonts and colors.
Alex Ar [27]
The presentation theme determines the formatting characteristics of fonts and colors.
4 0
4 years ago
What is the output of the first and second print statements?
Alenkinab [10]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

 When you will run the given code of java in this question. You will get an error and nothing will get printed in the response of the result. Because, in Java, you can't add the two array objects. The reason behind it, java does not support operator overloading. You cannot use the plus operator to add two arrays in Java . It will give you the compile-time error.

There is a method to add two arrays in the Java program is to iterate over them and add individual elements and store them into a new array. This also becomes complex, if you having arrays of different sizes.  To go through this method, you have to build a method that will through an illegal exception in case of a mismatch in the sizes of the arrays.

As in the given code, when you execute the first print statement:

System.out.println(num1.get(0)+1);

It will produce error because first type is object and second is int. So, you cannot add object and int value.

When you will execute the given second print statement:

System.out.println(num1.get(1)+ num2.get(0));

it will also produce error, because you cannot add object in Java using + binary operator because in this statement first and second type are both objects.  

6 0
3 years ago
What is the highest payed country
DiKsa [7]
I think its New Zealand 
4 0
4 years ago
Write a program that calculates the amount of money in a savings account that earns a guaranteed yearly interest rate. The progr
White raven [17]

Solution :

# Reading principle amount from user

$\text{accountPresentValue}$ = eval($\text{inpu}t("$Enter principle amount: "))

# Reading time duration in number of year from user

years = eval(input("Enter time duration in number of year: "))

# Reading interest rate from user

annualInterestRate = eval(input("Interest rate: "))

# calculating futureValue using user input data

futureValue = accountPresentValue * (1 + annualInterestRate / 100) ** years

# printing calculated futureValue to console

print("Final balance =",futureValue)

7 0
3 years ago
The most common approach for making individual analysis is to:
stiks02 [169]

Answer:

A)predict future organizational needs.

Explanation:

It is important to perform a SWOT analysis. Which helps us predict future business needs. Highlighting strengths, weaknesses, opportunities and threats.

  1. analyzing its internal characteristics (Weaknesses and Strengths).
  2. external situation (Threats and Opportunities) in a square matrix.
8 0
3 years ago
Other questions:
  • How to analyze time complexity of a code?
    5·1 answer
  • Which of the following is real job title on the interactive media career pathway?
    12·2 answers
  • Mary is an aspiring web designer. Which degree she should opt for to strengthen her portfolio? A. bachelor’s degree in computer
    11·1 answer
  • A business traveler notices there is an extra connector between the keyboard and the computer, in a business center. She has mos
    12·1 answer
  • How many bits are required to store the text of the number "97" in ASCII?'
    5·2 answers
  • Question 11
    9·1 answer
  • Read the Python program below: num1 = int(input()) num2 = 10 + num1 * 2 print(num2) num1 = 20 print(num1) Question 1 When this p
    6·1 answer
  • An algorithm whose worst-case time complexity is bounded above by a polynomial function of its size is called a(n)
    13·1 answer
  • What are five (5) things about this career choice that appeals to you?
    7·1 answer
  • 1 point
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!