0

Hi ,
I have created a submit button "sbutton" that should take all totals from 3 boxes and if that total is greater than 1, then it should be subtracted from 1 and the remainder is suppose to be displayed as change...this is what i have

public void actionPerformed(ActionEvent evt) {
if(evt.getSource()==sButton){
change.setText(---"I DON"T KNOW WHAT TO PUT HERE")
selections.setText("Vending....");

and in another class to add up the 3 totals i have

public String total5(){
	total5=total+total2+total3+total4;
	
	String blank =new String();
	blank="$"+total5;
		return blank;
	

	
}

so my question is how do i use the total5 to compare if it's over 1 or less and display if it's over in the "change.setText( )" text box?

Edited by bondgirl21: n/a

2
Contributors
2
Replies
5
Views
7 Years
Discussion Span
Last Post by bondgirl21
0

don't try to do that with strings.
Check whether the actual amount (number!) is >1.0 instead, much easier.

And btw, you add 4 amounts there, not 3 :)

0

don't try to do that with strings.
Check whether the actual amount (number!) is >1.0 instead, much easier.

And btw, you add 4 amounts there, not 3 :)

thanks, i figured it out.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.