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)+" €");
Appletplease help
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote


|