• Post Reply Bookmark Topic Watch Topic
  • New Topic

A basic GUI commission calculator  RSS feed

 
M Gerber
Greenhorn
Posts: 29
Chrome Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, I am supposed to write a program that calculates the total annual compensation for a salesman using user input for the salary, sales, and commission rate (list of 3 predefined commission rates. have to display in dollar format the amount of commission and total annual salary.


CommCalc class




CalcTest method



I know that i have to fix some of the semantics .
I have this code that I made earlier, is there an easy way to make it into a GUI interface? Or will I have to go throughthe code lines to add the JOptionPane?
And I am a little confused on how to make a list (array) for the commission rate.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shouldn't the package declaration come before the imports?
 
M Gerber
Greenhorn
Posts: 29
Chrome Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I should have said that I am using NetBeans 8, that is where it put them.
 
M Gerber
Greenhorn
Posts: 29
Chrome Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code will compile and run, I am just stuck on incorporating it into a JOptionPane or another GUI interface, could I just add code to the original?
Also the commission rate should be in a list (of 3 choices) and I am a little green(horn) in making arrays.
 
Rico Felix
Ranch Hand
Posts: 411
5
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should create a separate class to represent the view which will be the front-end of the application containing the labels, text fields and buttons for user interaction... Create another class to control the interaction between the user events in the view class components and how these events will interact with the interface of the CommCalc class to get the desired functionality...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!