Q002 Calculate Electricity Bill - Program in Java
Q002 Calculate Electricity Bill - Program in Java
import java.util.Scanner;
sc.nextLine();
netAmount = 100;
System.out.println("\nElectricity Bill");
sc.close();
float amount;
} else {
return amount;
return 0;
return 1.20f;
return 1.50f;
} else if (units >= 400 && units < 600) {
return 1.80f;
} else {
return 2.00f;
Output:
Calculate Electricity Bill
Enter Customer ID: 1001
Enter the name of the customer: Sana
Enter the unit consumed by the customer: 800
Electricity Bill
Customer ID :1001
Customer Name :Sana
Unit Consumed :800
Amount Charges @Rs. 2 per unit :1600
Surcharge Amount :240
Net Amount to be paid :1840