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:
Nov 11, 2010 | Sun Java Programming Language (cdj-275)
Jul 14, 2010 | Sun Java Programming Language (cdj-275)
Oct 09, 2009 | Canon Office Equipment & Supplies
Jul 01, 2009 | Aquabot Robotic Pool Cleaner
Apr 09, 2009 | Sun Java Programming Language (cdj-275)
Sep 23, 2008 | Computers & Internet
May 22, 2008 | Excel (SS8SATAS5128400R)
Feb 25, 2008 | Computers & Internet
2,359 people viewed this question
Usually answered in minutes!