Write a program to accept the opening and closing meter reading of a month and calculate the bill for the month depending on the units consumed. (Units consumed closing meter reading - opening meter reading). The details is given below:
No of units consumed
Rate
First 100 units
nil
: Next 150 units Next 150 units 1.00 per unit 1.10 per unit
Above 400 units 1.25 per unit
Calculate and print the bill amount including Rs 200 meter rent
Answers
Explanation:
Write a program to accept the opening and closing meter reading of a month and calculate the bill for the month depending on the units consumed. (Units consumed closing meter reading - opening meter reading). The details is given below:
No of units consumed
Rate
First 100 units
answer is Rs 500
import java.util.Scanner;
public class KboatElectricBill
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter Units Consumed: ");
int units = in.nextInt();
double amt = 0.0;
if (units <= 100)
amt = units * 0.8;
else if (units <= 300)
amt = (100 * 0.8) + ((units - 100) * 1);
else
amt = (100 * 0.8) + (200 * 1.0) + ((units - 300) * 2.5);
amt += 500;
System.out.println("Units Consumed: " + units);
System.out.println("Bill
it is correct answer
please make me brilliantlist