• Post Reply Bookmark Topic Watch Topic
  • New Topic

Basic Arithmetic syntax, such as adding doubles and integers  RSS feed

 
Josh Andersen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm making a basic shopping cart program. where i select my checkboxes and have to have the input of the textfields be multiplying by the integers.
my problem is the code that needs to be inputted for it.... I'm running Netbeans
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my problem is the code that needs to be inputted for it
Did you try writing code and ran into a particular issue? Or you want help on how to start coding to get user input?
 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
Josh Andersen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just getting started... im not sure how to
1. have the computer to analyze the input of the Jtextfield.
2. input the syntax for the combining the the values.
 
Paul Clapham
Sheriff
Posts: 22819
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you would write some code which does that. But it seems to me you're fishing for somebody else to do that for you, and we don't do that here. Read these FAQ entries to see what I mean: NotACodeMill, DoYourOwnHomework, ShowSomeEffort. However if I've misinterpreted your intentions, then go ahead and post some code which you want to discuss. Or if you have a specific question which doesn't involve any code, then go ahead and post that question.
 
Josh Andersen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fishing might be a little harsh, but I'm trying to learn it and my book is dead confusing me. like i got a double result = double * JTextField; and it isnt working. and once i try to set my JTextField to > 0 it gives me an error. theres my problem.
 
Josh Andersen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But i will look at the sample code for guidance... thank you
 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you have inside a text field is text (a String). You cannot use that as a number, but there are methods in the wrapper classes, e.g. this one, which can turn text into a number.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!