File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Calculating widget costs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Calculating widget costs" Watch "Calculating widget costs" New topic
Author

Calculating widget costs

Marcel Goulart
Greenhorn

Joined: Oct 14, 2012
Posts: 6
I am doing a homework assignment and I have to create a GUI that calculates the cost of an imaginary widget at a user specified price the only things that dont change is the percentage of tax(7.5%) and shipping costs(which is $9.95).
I am having an issue with the text fields doing the arithmetic and then displaying it.

Here is my code so far.
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1083
    
  10

Hi Marcel,
Welcome to the Ranch!

You have mentioned you have an issue. What is it? Are you getting errors/exceptions when running the code? You need to provide us more details about the problem.
I see that you are getting the values from the textfield and converting it to the data type. I think you should proceed with writing the calculation code.

Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Marcel Goulart
Greenhorn

Joined: Oct 14, 2012
Posts: 6
Thank you for the welcome Ranganathan, I figured it out last night. I had a couple things in the wrong spot. I'll upload the correct code.

Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1083
    
  10

Ok. So, is it all working ok now? do you need anymore help?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38726
    
  23
Marcel Goulart wrote:Thank you for the welcome Ranganathan, I figured it out last night. I had a couple things in the wrong spot. I'll upload the correct code.
. . .
Well done sorting it out , but that code needs a lot of editing if you want lots of marks. Get rid of all the tabs and excess blank lines, and make sure all code inside {} lines up vertically. We have some suggestions about formatting, which you might do well to look at.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calculating widget costs