Search This Blog

UI/UX Design | Web Development | Mobile Application Development

Whether you need UI/ UX design, web development services, or mobile app development services, Qaabil Digitals will be more than happy to help you. We work with top software developers, designers, and project managers. We tailor our services to suit your exact needs. We closely look at your company, listen to your story, and bring about the best ideas and solutions that can help you drive solid results. We don’t just produce work that works. We produce work that matters. Get a quote now Or Talk to us

Saturday 5 November 2011

Develop a java program to generate the Electricity bill. The program have three member functions, Getdata(): to accept the block number, flat name, name and number of units, Calc(): calculate the total cost, Display(): display the bill in proper format ( name, units , total charges). If the total is greater than RM 150 then additional surcharge 15% is added (by Fikri Fieda)


import java.util.*;
class ebill
{
public static void main (String args[])
{
customerdata ob = new customerdata();
ob.Getdata();
ob.Calc();
ob.Display();

}
}

class customerdata
{
Scanner in = new Scanner (System.in);
Scanner ins = new Scanner (System.in);
String cname,fname;
int bn;
double units,tbill;

void Getdata()
{
System.out.print ("\n\t Enter block number = ");
bn = in.nextInt();
System.out.print ("\n\t Enter flate name = ");
fname = ins.nextLine();
System.out.print ("\n\t Enter customer name = ");
cname = ins.nextLine();
System.out.print ("\n\t Enter total consumed units = ");
units = in.nextDouble();
}

void Calc()
{
if (units<100)
tbill=0.40*units;
else if (units>100 && units<300)
tbill=0.50*units;
else
tbill=0.60*units;
if (tbill>150)
tbill+=tbill*0.15;
}

void Display()
{
System.out.println ("\n\t Customer name = "+cname);
System.out.println ("\n\t Total units = "+units);
System.out.println ("\n\t Total bill = RM "+tbill);
}
}

9 comments:

  1. Hey there I am so thrilled I found your weblog, I really found you by accident, while I was researching on Google for something else,
    Anyhow I am here now and would just like to say thanks
    for a tremendous post and a all round entertaining blog (I also love the
    theme/design), I don’t have time to look over it all
    at the minute but I have book-marked it and also added your
    RSS feeds, so when I have time I will be back to read a lot more,
    Please do keep up the superb work.
    Also visit my web page :: professional forex signals

    ReplyDelete
  2. Hi! This is kind of off topic but I need some help from an established blog.

    Is it very difficult to set up your own blog? I'm not very techincal but I can figure things out pretty fast. I'm thinking about making my own but I'm not sure where to start. Do you have any tips or suggestions? Many thanks
    Also visit my webpage : Dr Charles DC

    ReplyDelete
  3. i need to do tracking of the electricity bill. how will i do that please help. urgent. show how to create it...

    ReplyDelete
  4. i need electricity bill tracking status code i.e(creating a file,searching a file ,check wether the customer cleared his last months due or not,displaying coustomers record) help me please

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete

Share