As per the requirement mention in the question, the java program given below.
import java.util.Scanner;
public class Electricity_Bill {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scn=new Scanner(System.in);
double unitElectrcity;
double amount;
//Enter the total number of units used by customer
System.out.println("Total number of units used by customer");
unitElectrcity=scn.nextFloat();
//total electricity used
amount=unitElectrcity*500;
System.out.println("Total amount is :"+amount+"$");
}
}
Result:-
If I am putting number of consumed units is =8
Comments
Leave a comment