| | |
trouble with method call
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Mar 2009
Posts: 3
Reputation:
Solved Threads: 0
hi im a new memeber .iv started learning java recently. i was wondering could anyone help with this problem because i just cant seem to work out where i'm going wrong. its my method call thats giving me the proplem...i think. if anybody has any solutions i would be grateful
import javax.swing.*;
public class EurekaWater{
public static void main(String args[]){
String userInput,waterQty;
Double input,quantityWater, fee;
userInput=JOptionPane.showInputDialog("enter number of home Owners");
input=Double.parseDouble(userInput);
for(int count=0; count<input; count++)
{
waterQty=JOptionPane.showInputDialog("Enter quantity of water user in cubic feet");
quantityWater=Double.parseDouble(waterQty);
if(quantityWater<=1000){
fee=FlatRate; }
else if (quantityWater>1000&&quantityWater<=2000){
fee=FlatRatePlus;
}
else if (quantityWater>2000&&quantityWater<=3000){
fee=FlatPlusPlus; }
else {
fee=HigherRate; }
JOptionPane.showMessageDialog(null,fee);
}
}
public static double FlatRate()
{
return 15.0;
}
public static double FlatRatePlus (double units)
{
double cost=(units-1000)*.0175+15;
return cost;
}
public static double FlatPlusPlus (double units)
{
double cost=((units-2000)*.02)+22.50;
return cost;
}
public static double HigherRate (double units)
{ double cost;
return cost=70;
}
}![]() |
Similar Threads
- How to call Client.java from HTML? (Java)
- Trouble with SOAP and xslt (RSS, Web Services and SOAP)
- more game trouble- need high score system (Java)
- C# IE Toolbar talking to C++ BHO (C#)
- Having Some Trouble with Methods (Java)
- Noob : Input Stream Trouble (Java)
- Forms authorization, only want a few links (ASP.NET)
- login working in IE but not mozilla? (ASP.NET)
Other Threads in the Java Forum
- Previous Thread: problem with implementing MVC
- Next Thread: Help with Dynamic graphs Graphs
| Thread Tools | Search this Thread |
911 actionlistener addressbook android api append applet application array arrays automation binary block bluetooth character chat class client code component consumer csv database desktop eclipse error fractal ftp game givemetehcodez graphics gui html ide image input integer j2me japplet java javaarraylist javac javaee javaprojects jmf jni jpanel julia linked linux list loop mac map method methods mobile netbeans newbie number objects online oriented panel print printf problem program programming project projects properties recursion replaydirector reporting researchinmotion rotatetext rsa scanner screen se server set size sms sort sql string swing template test threads time title tree tutorial-sample ubuntu update windows working





