Computer Science, asked by harry3960, 5 months ago

An electricity board charges the bill depending on the number of units consumed as follows:

Sales units Commission charge

First 100 units 40p per unit

Next 200 units 60p per unit

Above 300 units Re 1 per unit

Meter rent is also charged from each customer which is Rs 250/- . Write a Java program to take the input as

sales unit by the user and print the bill for a customer according to the commission charge along with the fixed meter rent???

Answers

Answered by keyboardavro
5

Answer:

Explanation:

import java.util.Scanner;

class bill {

  public static void main(String[] args) {

      Print("Enter units consumed in kWh: \n");

      Scanner getInput = new Scanner(System.in);

      Print(Calculate_Bill(getInput.nextDouble()));

      getInput.close();

  }

  public static double Calculate_Bill(double kWh) {

      double bill;

      if (kWh <= 100) {

          bill = kWh * 5.5d;

      } else if (kWh >= 100 && kWh <= 200) {

          bill = kWh * 6.0d;

      } else {

          bill = kWh * 7.0d;

      }

      return bill;

  }

  public static void Print(Object _object_) {

      System.out.print(_object_);

  }

}

Similar questions