• Post Reply Bookmark Topic Watch Topic
  • New Topic

I believe this is a set/get problem. will not call or return variable  RSS feed

Cherokee Nelson
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 2 salespersons classes to utilize a calculations class with only one set of calculations. I am trying to get the salesperson's information send it to calculation return the values to the salepersonInformation class and display the results. When I attempt to use both salespersons classes for calculations I get sruck in a loop. The loop asks for the first sales persons annual sales repeatedly for a random amount then displays the results with an obscure value for sales person two's annual sales. I hope I have explained this well enough for someone to help. Once I fix what I have I need to add an array listing the sales projections for each sales person. I believe I need an interface to fix the connections between the classes first. Please help and thank you Here is my code so far.

I have muffed up my original design attempting to get the &^%&^%&^ thing to work.

My second Salesperson class utilizes the same variables. I have not changed the return methods on the second Salesperson class. I am not sure which of the two is written correctly for acquiring the correct connection.

Each Salesperson gets their names and annual sales form a UserInput class.

The annual sales value is called from the Salespeople's classes and then I am attempting to get the annual sales commission calculated.

My calculations class will have an array to build a list of projections to it. I have noted the changes I have attempted to fix the connection.

I am using this class to get each salespersons values and display the results. I am calling one salespersons actions then the other to keep the values separate


A main method calls the SalPersonCalcControl class to activate.

I am so lost and I really feel like my original design would have worked if I could figure out the connection problem. Please help. Thank you

Winston Gutkowski
Posts: 10575
Eclipse IDE Hibernate Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cherokee Nelson wrote:I have 2 salespersons classes to utilize a calculations class with only one set of calculations....

Let me stop you right there, because you've already fallen into the "how" trap - that is: you're already thinking about how you're going to code this before you know WHAT you want to do.

Second: That is a fabulous amount of code to write, only to discover that you've made a serious mistake and may have to scrap the whole thing.
So: Lesson 1: DON'T start coding until you KNOW what you want to do.

My advice: Back up and explain the problem you're trying to solve to us. In English, not in Java-ese. I suspect you will have been given some instructions, so maybe the best thing is to show those to us.

However, from what I can see, you have three classes (UserInput, Salesperson1 and Salesperson2) that are related to each other, but you haven't included any form of relationship. And now - after the fact - you're trying to tie them together to use common code.

So: How are they related? It would seem that all your "users" are sales people, so perhaps Salesperson1 should extend UserInput (and perhaps a better name would be User). Or maybe UserInput is a utility class for a "user" of your program to enter all sorts of information that it requires - nothing wrong with that either - but it's very difficult for us to work out just by looking at your code.

How are Salesperson1 and Salesperson2 related? Those names don't tell us anything - and they should. For example, is one a "commission" salesman, and the other a salaried employee?

These are the sorts of thing you should already know before you write your first line of code.

But for the moment, back up and explain your problem as I suggested above. Then we have somewhere to start.


  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!