Write a Java Program to Calculate electricity bil

Write a Java Program to Calculate electricity bill

Write a Java Program to Calculate electricity bill

Program

public class Main 
{
    public static void main(String[] args) 
    {
        int units = 123;
        int bill = 0;
        if (units > 100) 
        {
            if (units >= 200) 
            { 
                if (units > 300) 
                { 
                    bill = units * 8; 
                } 
                else
                {
                    bill = units * 6;
                }
            } 
            else
            {
                bill = units * 5;
            }
        
        }
        System.out.println("Units Consumed : " + units); 
        System.out.println("Total Bill : " + bill);
    }
}



Output:

Units Consumed : 123
Total Bill : 615



More Questions


30 . Write a Java Program to Find the sum of the digits of a number
31 . Write a Java Program to Calculate electricity bill
32 . Write a Java Program to find Armstrong number
33 . Write a java Program to print Armstrong number between 1 to 1000
34 . Write a java Program to Print given number in words
35 . Write a java Program to check the given number is Palindrome or not
36 . Write a java Program to print palindrome number upto N numbers
37 . Write a java Program to print N prime numbers and find sum and average
38 . Write a Java Program to find largest number in an array
39 . Write a Program to find second largest number in an array
40 . Write a Program to Find largest and smallest number in an array in java



For latest job updates join Telegram Channel: https://t.me/sateeshm

Apply For The Job

Apply For Job

Java Material

Python Material

PLSQL Material

.Net Material

Java Practice Programs

400 Java Programs