Applet

please help

Page 1 of 1

0 Replies - 773 Views - Last Post: 06 April 2007 - 02:59 AM Rate Topic: -----

#1 gius78  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 05-April 07

Applet

Posted 06 April 2007 - 02:59 AM

Hallo people im still stuck on this applet....
Im tryint to show in the status bar the amount of customers for the day and the total taking but the program wont add for me. Help!!


public void calculate(){

String hoursStr = hoursTxt.getText();// pass the contents of the text field into a variable
double hours = Double.parseDouble (hoursStr);//convert from string to double
double over3H=0, fee=5,maxH = 15.5,minH = 3,total=0;//set variables for calculations
int customer=1;// variable to increase counter
DecimalFormat df= new DecimalFormat("0.00");// format number for 2 decimal places


if (hours > minH){ // if hours value is bigger than 3

over3H = ((hours - minH)*2);// x amount of hours minus the 3 standard hours by 2 euro
fee = over3H + fee; // x fee plus the standard fee of 5 euro per 3 hours
price.setText(" " + df.format(fee) +" ");// display fee in text field
hoursTxt.setText("");//clear text field
hoursTxt.requestFocus();//set focus to text field

}


if (hours >= maxH){
price.setText(" 30.00 ");
hoursTxt.setText("");
hoursTxt.requestFocus();
fee= 30.00;
}

if (hours <= minH){
price.setText(" 5.00 ");
hoursTxt.setText("");
hoursTxt.requestFocus();
fee = 5.00;
}
customer++;
total= total+fee;
showStatus("Todays Customers: "+customer+
" Total payments: "+ df.format(total)+" ");
public void calculate(){

String hoursStr = hoursTxt.getText();// pass the contents of the text field into a variable
double hours = Double.parseDouble (hoursStr);//convert from string to double
double over3H=0, fee=5,maxH = 15.5,minH = 3,total=0;//set variables for calculations
int customer=1;// variable to increase counter
DecimalFormat df= new DecimalFormat("0.00");// format number for 2 decimal places


if (hours > minH){ // if hours value is bigger than 3

over3H = ((hours - minH)*2);// x amount of hours minus the 3 standard hours by 2 euro
fee = over3H + fee; // x fee plus the standard fee of 5 euro per 3 hours
price.setText(" " + df.format(fee) +" ");// display fee in text field
hoursTxt.setText("");//clear text field
hoursTxt.requestFocus();//set focus to text field

}


if (hours >= maxH){
price.setText(" 30.00 ");
hoursTxt.setText("");
hoursTxt.requestFocus();
fee= 30.00;
}

if (hours <= minH){
price.setText(" 5.00 ");
hoursTxt.setText("");
hoursTxt.requestFocus();
fee = 5.00;
}
customer++;
total= total+fee;
showStatus("Todays Customers: "+customer+
" Total payments: "+ df.format(total)+" ");


Is This A Good Question/Topic? 0
  • +

Page 1 of 1