Answer to Question #103521 in Java | JSP | JSF for Shirisha

Question #103521
An electricity board charges the bill according to the number of units consumed and the rate as given below write a program in java to accept the total number of units consumed by a customer and calculate the bill assume that a meter rent of rs 500 is charged from the customer
1
Expert's answer
2020-02-26T11:13:48-0500

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



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS