Java program to calculate electricity bill



Program

package com.candidjava;

public class ElectricBill
{
	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("CHENNAI ELECTRICITY LTD, CHENNAI");
		System.out.println("Units Consumed : " + units);
		System.out.println("Total Bill : " + bill);
	}
}

Output

CHENNAI ELECTRICITY LTD, CHENNAI

Units Consumed : 123

Total Bill : 615



Related Post

Comments

arjun
         plz explain a bit more imformativley
arjun
         as fast as u can plz... need to do the project
sohi
         please give a 200 line program on an electricity bill using methods
sohi
         please provide is fast as I had to do my project

©candidjava.com