Question about Computers & Internet

# Electricity bill coding in java

Please tell me the coding for calculating the electricity bill in java

Posted by on

Ad

## 1 Answer

• Level 1:

An expert who has achieved level 1.

Corporal:

An expert that hasĀ over 10 points.

Mayor:

An expert whose answer gotĀ voted for 2 times.

Problem Solver:

An expert who has answered 5 questions.

• Contributor
• 19 Answers

First think how you would solve this problem yourself on a piece of paper. Then try programming it using the things you learned (if they've given you this assignment without teaching you to multiply, subtract and use if's, drop the course).
Well here is an idea.

Take the total kilowattage and send it to a function. What the function will do is subtract 14KW from the total Kilowattage and add the amount for the first 14KW then subtract 85KW from the total KW and add the amount for the 85KW. But once you subtract the number of KW from the total make sure to check if the total KW isn't negative, if so just break out of the function and return the total due.

Or if you have formula for how much the rate grows over how many miles.

For example lets say the rate grows by \$1 every time the KW doubles you could have something like

int rate = 1; //Begining rate
int KW = 14; //First flat rate
int amount; //total amount they have to pay
while(totalKW > 0)
{
totalKW -= KW; //subtract the first rate
if(totalKW <= 0) //check if too much subtracted
break; //if so break
amount += rate; //add the rate to the total

rate += 1; // Add \$1 to the rate every time
KW *= 2; // KW is doubled
}

Posted on Jan 09, 2009

Ad

## 1 Suggested Answer

• 2 Answers

Hi,
a 6ya Technician can help you resolve that issue over the phone in a minute or two.
Best thing about this new service is that you are never placed on hold and get to talk to real repair professionals here in the US.
click here to Talk to a Technician (only for users in the US for now) and get all the help you need.
Goodluck!

Posted on Jan 02, 2017

Ad

## Add Your Answer

×

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video.

×

Loading...

## Related Questions:

1 Answer

### Friend asked to store Aston Martin Vantage8 in my garage for a few months, and will need to plug in a trickle charger. What does the trickle charger do? and how much will it add to my electric bill?

Trickle chargers keep the battery fully charged.
They usually have a small cube-shaped transformer with a cord and plug or alligator clips.
If you look on the cube part label it will tell you the "wattage" , probably around 20 watts or similar.
This means while it's in use it draws 20 watts through your electric meter, the device that calculates your electric usage/bill.
You are charged for kilowatt hours.
To calculate how many kilowatt hours the trickle is using
multiply 20 X 24 hours X 31 days in a month .
Or 14,880 about 15 kilowatt hours a month.
In Florida a KWH is about 12 cents so it would cost you about \$1.80 a month to trickle charge.

Dec 02, 2017 | Motorcycles

1 Answer

### Wanted to do a good project on java.suggest d

if u have hardware knowledge,then u can interface a 4x4 matrix keypad with printer port and make a calculator!!
i have done this project, if u need hardware assistance tell me

Jul 14, 2010 | Sun Java Programming Language (cdj-275)

1 Answer

### How to program calculator in java

Hello,
If the question is : how to make a programmable calculator run a program written in Java, the amswer is : you cannot. Maybe the newer ones.

But if you are looking for the source code of a Java applet that simulates a calculator, then maybe you should launch a Google search with keywords Java calculator and see what you get. I do not want to spoil your fun by supplying a link to what my search returned.
Hope it helps.

Oct 09, 2009 | Canon Office Equipment & Supplies

1 Answer

### F700v java activation code?

you cannot do that use the java download option beawre you may need to pay for the games

Aug 17, 2009 | Samsung SGH-E900 Cellular Phone

1 Answer

### Calculator in java

<FORM NAME="CALCULATOR">
<TABLE BORDER=4>
<TR>
<TD>
<INPUT TYPE="text" NAME="Input" Size="16">
<br>
</TD>
</TR>
<TR>
<TD>
<INPUT TYPE="button" NAME="one" VALUE=" 1 " OnClick="Calc.Input.value += '1'">
<INPUT TYPE="button" NAME="two" VALUE=" 2 " OnCLick="Calc.Input.value += '2'">
<INPUT TYPE="button" NAME="three" VALUE=" 3 " OnClick="Calc.Input.value += '3'">
<INPUT TYPE="button" NAME="plus" VALUE=" + " OnClick="Calc.Input.value += ' + '">
<br>
<INPUT TYPE="button" NAME="four" VALUE=" 4 " OnClick="Calc.Input.value += '4'">
<INPUT TYPE="button" NAME="five" VALUE=" 5 " OnCLick="Calc.Input.value += '5'">
<INPUT TYPE="button" NAME="six" VALUE=" 6 " OnClick="Calc.Input.value += '6'">
<INPUT TYPE="button" NAME="minus" VALUE=" - " OnClick="Calc.Input.value += ' - '">
<br>
<INPUT TYPE="button" NAME="seven" VALUE=" 7 " OnClick="Calc.Input.value += '7'">
<INPUT TYPE="button" NAME="eight" VALUE=" 8 " OnCLick="Calc.Input.value += '8'">
<INPUT TYPE="button" NAME="nine" VALUE=" 9 " OnClick="Calc.Input.value += '9'">
<INPUT TYPE="button" NAME="times" VALUE=" x " OnClick="Calc.Input.value += ' * '">
<br>
<INPUT TYPE="button" NAME="clear" VALUE=" c " OnClick="Calc.Input.value = ''">
<INPUT TYPE="button" NAME="zero" VALUE=" 0 " OnClick="Calc.Input.value += '0'">
<INPUT TYPE="button" NAME="DoIt" VALUE=" = " OnClick="Calc.Input.value = eval(Calc.Input.value)">
<INPUT TYPE="button" NAME="div" VALUE=" / " OnClick="Calc.Input.value += ' / '">
<br>
</TD>
</TR>
</TABLE>
</FORM>

eNJOY

Jul 01, 2009 | Aquabot Robotic Pool Cleaner

1 Answer

### Code for method parseInt() in java

parseInt(java.lang.String, int)

This code takes two arguments, a string constructor from the Java language and an integer. Its purpose is to parse (meaning de-construct or disassemble into component parts) one data type into another.

Here is an example of a Java program to specify and print out the dimensions of a rectangle, taken from the page http://www.roseindia.net/java/beginners/entervaluesfromkeyboard.shtml:

class Rectangle{
int length, breadth;
void show(int x, int y){
length = x;
breadth = y;
}
int calculate(){
return(length * breadth);
}
}
public class EnterValuesFromKeyboard{
public static void main(String[] args) {
Rectangle rectangle = new Rectangle();
int a = Integer.parseInt(args[0]);
int b = Integer.parseInt(args[1]);
rectangle.show(a, b);
System.out.println(" you have entered these values : " + a + " and " + b);
int area = rectangle.calculate();
System.out.println(" area of a rectange is : " + area);
}
}

Apr 09, 2009 | Sun Java Programming Language (cdj-275)

1 Answer

### Calculate a bill

Hi you can Apply below mention formula
=ABS(SUM(COUNTIF(RANGE,"CATAGARI")-(COUNTIF(RANGE,"CATAGARI")))

RANGE = FROM WHICH CELL TO YOU WANT TO APPLY THIS FORMULA TO TILL WHICH CELL.
CATAGARI = WHAT DO U WANT < FOR FOR FIRST > FOR SECOND

May 22, 2008 | Excel (SS8SATAS5128400R)

## Open Questions:

#### Related Topics:

2,366 people viewed this question

## Ask a Question

Usually answered in minutes!

Level 3 Expert

7733 Answers

Level 3 Expert

102366 Answers

Level 3 Expert

14162 Answers

Loading...