Question about Computers & Internet
Please tell me the coding for calculating the electricity bill in java
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
a 6ya expert 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 repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
Posted on Jan 02, 2017
Tips for a great answer:
Jan 26, 2013 | Computers & Internet
Mar 12, 2011 | Computers & Internet
Apr 17, 2010 | Microsoft Windows Vista Home Premium with...
Jul 03, 2009 | Microsoft Computers & Internet
Jan 21, 2009 | Microsoft Windows Vista Ultimate Edition
Sep 23, 2008 | Computers & Internet
Jan 23, 2017 | Team Computers & Internet
Jan 23, 2017 | The Computers & Internet
2,358 people viewed this question
Usually answered in minutes!