0

Hi First of all let me tell you that my programming skill aren't great and I'm still learning java. Basically I'm trying to write a program that allow the user to enter a quantity in textfield1. Then when the confirm button is pressed, it'll display the result in textfield2

int amount = 35; 

int quantity = Integer.parseInt(quantTxt.getText()); 


if e.getSource() == Confirm && quantity >= 1 ) message.setText(pounds.format((amount / 100.0) * quantity));
else { 
message.setText(""); }

I know it isn't working as I tried it but I'd like to know if it is possible to perform this calculation differently.

4
Contributors
3
Replies
17
Views
3 Years
Discussion Span
Last Post by bmwwbb54
0

That's not enough information for anyone to help. You need to post the whole code, and the complete text of any error messages. If there are no error messages but it's not working right, explain what it should do and what it actually does.

0

Hmm... I am quite sure you need to implement some of your code in actionPerformed() method somewhere but don't see it in your question... :P

0
Scanner keyboard = new scanner(System.in);
System.out.print("please enter a number: ");
textfieldone = keyboard.nextInt();
This topic has been dead for over six months. 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.