Residential and business customers are paying different rates for water usage. Residential customers pay $0.005 per gallon for the first 6000 gallons. If the usage is more than 6000 gallons, the rate will be $0.007 per gallon after the first 6000 gallons. 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.

Answers

Answer 1
Answer:

Answer:

// here is program in Java.

// import package

import java.util.*;

// class definition

class Main

{

   // main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

   // variable

   int gall;

   double cost=0;

       // object to read value from user

    Scanner scr=new Scanner(System.in);

     // ask user to enter type

    System.out.print("Enter customer type  (R for residential or B for business ):");

    // read type of customer

       char t=scr.next().charAt(0);

       if(t=='r'||t=='R')

       {

           System.out.print("enter the number of gallons:");

           //read number of gallons

           gall=scr.nextInt();

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

           if(gall<=6000)

            {

           // calculate cost

           cost=gall*0.007;

           // print cost

           System.out.println("total cost is: "+cost);

             }

           else

           {

           // calculate cost

            cost=(6000*0.005)+((gall-6000)*0.007);

            // print cost

            System.out.println("total cost is: "+cost);

           }

       }

       else if(t=='b'||t=='B')

       {

           System.out.print("enter the number of gallons:");

           //read number of gallons

           gall=scr.nextInt();

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

           if(gall<=8000)

            {

           // calculate cost

           cost=gall*0.006;

           // print cost

           System.out.println("total cost is: "+cost);

             }

           else

           {// calculate cost

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

            // print cost

            System.out.println("total cost is: "+cost);

           }

       }

   }catch(Exception ex){

       return;}

}

}

Explanation:

Ask user to enter the type of customer and assign it to variable "t" with scanner object.If the customer type is business then read the number of gallons from user and assign it to variable "gall". Then calculate cost of gallons, if   gallons are less or equal to 8000 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 6000 gallons cost will be multiply by 0.005 and for rest it will  multiply by 0.007. Then print the cost.

Output:

Enter customer type  (R for residential or B for business ):r

enter the number of gallons:8000

total cost is: 44.0


Related Questions

No Browsing History While using the browser on your tablet, you realize that it is not keeping a history of websites you have visited. Why might this be happening, and what is the first step you will take to correct this problem? Phishing Scam You just received an email message from someone requesting personal identification information. Believing the message was legitimate, you provided the requested information to the original sender. You now realize, however, that you might have fallen victim to a phishing scam. What are your next steps? Suspicious File Attachment You receive an email message that appears to be from someone you know. When you try to open the attachment, nothing happens. You attempt to open the attachment two more times without any success. Several minutes later your computer is running slower and you are having trouble running apps. What might be wrong? Antivirus Software Outdated After starting your computer and signing in to the operating system, a message is displayed stating that your virus definitions are out of date and need to be updated. What are your next steps? Laptop's Physical Security You plan to start taking your laptop to school so that you can record notes in class. You want to make sure, however, that your computer is safe if you ever step away from it for a brief period of time. What steps can you take to ensure the physical security of your laptop?
What is not recyclable in ahybrid carhydrogen carpetrol car
Write statements that declare inFile to be an ifstream variable and outFile to be an ofstream variable.
The computer output for integer programs in the textbook does not include reduced costs, dual values, or sensitivity ranges because these variables are not meaningful for integer programs. TrueFalse
Write an algorithm which gets a number N, and prints all the natural numbers less than or equal N. 3.

Complete the sentence about a presentation delivery method. A(n) ____ allows you to transmit your presentations over the Internet using ____.

1: A. Presentation software
B. webcast
C. external monitor

2: A. Projectors
B. CDs
C. Streaming technology

Answers

A Presentation software allows you to transmit your presentation over the internet using CDs

Answer:

A Presentation software allows you to transmit your presentation over the internet using CDs??????????????????C

You have been asked to write a two-page report that explains the extent to which the IT department can configure the cryptographic features of Word 2010. What is the process involved in configuring encryption?

Answers

Answer:Encryption is the process

of translating plain text data into something that appears to be random and meaningless. A symmetric key is used during both the encryption and decryption process. To decrypt a particular piece of ciphertex, the key that was used to encrypt the data must be used.

Types of encryption

1.Symmetric encryption :This is also known as public key encryption. In symmetric encryption, there is only one key, and all communication patties use the same key for encryption and decryption.

2.Asymmetric encryption :This is foundational technology for SSL(TLS)

How encryption is being configured

Encryption uses algorithms to scramble your information. It is then transmitted to the receiving party, who is able to decode the message with a key.

Explanation:

Write a program that takes an integer as input, representing a year in school. Output "Elementary school" for 0-5, "Middle school" for 6-8, "High school" for 9-12, "College" for 13-16, and "Post-secondary" for 17 and higher. Output "Invalid" for negative input. If the input is 7, the output is:

Answers

In python:

year = int(input("Enter the school year: "))

if 0 <= year <= 5:

   print("Elementary school")

elif 6 <= year <= 8:

   print("Middle school")

elif 9 <= year <= 12:

   print("High School")

elif 13 <= year <= 16:

   print("College")

elif year >= 17:

    print("Post-secondary")

else:

   print("Invalid")

I hope this helps!

Write a statement that assigns total_coins with the sum of nickel_count and dime_count. Sample output for 100 nickels and 200 dimes is: 300

Answers

The statement which gives the sum of nickel and dime is written below :

total_coins = nickel_count + dime_count

The statement required is written using Python 3 :

  • We could write these as a function :

deftotal(nickel_count, dime_count) :

total_coins =dime_count+nickel_count

print(total_coins)

total(100, 200)

#the function total takes in two arguments(number of nickels and number of dimes)

#assigns the varibale total_coins to the sum of nickel_count and dime_count

  • We could also write this in the form of a program which prompts users to enter values :

nickel_count = int(input('Enter count of nickel : '))

# User is prompted to enter number of nickels

dime_count = int(input('Enter count of dime : '))

# User is prompted to enter number of dimes

total_coins = nickel_count + dime_count

#assigns the varibale total_coins to the sum of nickel_count and dime_count

print(total_coins)

#outputs the value of total_coins

Learn more : brainly.com/question/17615351

Answer:

total_coins = nickel_count + dime_count

Explanation:

The statement that performs the operation in the question is total_coins = nickel_count + dime_count

Full Program (Written in Python)

nickel_count = int(input("Nickel Count: "))

dime_count = int(input("Dime Count: "))

total_coins = nickel_count + dime_count

print("Total coins: ",total_coins)

The first two lines prompt user for nickel and dime count respectively

The third line adds the two coins categories together

The last line prints the total count of coins

3. If B3=6 and D5=8, what would the following function return? IF(B3>D5, "Closed", D5-B3) *A. "Closed"
B. -2
C. "Open"
D. +2

Answers

Answer:

D. +2

Explanation:

The given function is an IF function where the first argument is a logical test, the second argument is the result if the logical test is true and the third argument is the result if the logical test is false. Depending on whether the result of the logical test is true or false, the respective value will be returned.

IF(logical_test, value_if_true, value_if_false)

In this case, the logical test first compares the value of B3 and D5. As B3 is not greater than D5, the result is false and the value for false will be returned. The value for false result of the logical test is equated by D5-B3 which is equal to 2. Thus the result of the IF function is +2.

Hello, Good Works mate!

Answer: B) -2
*The result will be negative.

Kind Regards

How can you represent a graphic element in a wireframe?You can specify a graphic element by using an)

Answers

Answer:

The answer is "in the form of design, color and graphic".

Explanation:

The wireframe is also recognized as 'skeleton', it is a static, low-fidelity description of various layouts, which provides shapes to the component. It is indeed a visualization of even an interface using only basic shapes.

It is a 2D illustration of a site user interface, which primarily focuses on capacity planning and priority of information, features available, and role expectations like, storyboards which do usually not include design, color, or graphics.

Answer:

box

Explanation:

i just took the quiz and that's the correct answer they're looking for :)

Other Questions