• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Calculating widget costs

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Marcel Goulart
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok. So, is it all working ok now? do you need anymore help?
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic