Mona Stout wrote:My instructor marked me off for not having an extra class, but the book had said that the JOptionPane was a class.
Mona Stout wrote:That means that my classes should be: Personal Information, Calculation, and Table.
That was last week.Mona Stout wrote:. . . I have not asked for help until last night. . . .
It is understandable, you just learning. Now about the code, we need to be honest - not much improved. It seems you misunderstand the concept.Mona Stout wrote:Just so that you know I was not ignoring you and that I am taking your information to heart, as this is why I came here to get help. Is this better?
Afraid not. Wherever name is, it should have private access, so you cannot access it outside its own class. If Person is a class, then that code suggests that name is static, which means all Persons share the same name. If there is a Name class, you should not give it a no‑arguments constructor. I mentioned that here yesterday. Please read the whole thread. You want to be able to writeMona Stout wrote:. . . Is this better?
. . .
Mona Stout wrote:Personal information
– What is your name?
– What is your annual salary?
– What are your annual sales? // target for all sales persons is $120,000
// if the sales person exceeds incentive increases by 1.25%
Calculation
- Calculate sales * incentive = commission (if sales is 80% met)/ if not no incentive
- Calculate total compensation = commission + salary
No. When exceeds, it means, when they sell more than their target is. Starting from 120.000,01.Mona Stout wrote:The incentive kicks in if they get $120,000 then they get an additional 1.25%
Mona Stout wrote:– What are your annual sales? // target for all sales persons is $120,000
// if the sales person exceeds incentive increases by 1.25%
Ok, Mona, now you started actually analyse your problem. I see CR already gave you test cases. I just checked few posts above, so it could help you to concentrate on a parts, which you have to come up:
SalesPerson class
Mona Stout wrote:
Personal information
– What is your name?
– What is your annual salary?
– What are your annual sales? // target for all sales persons is $120,000
// if the sales person exceeds incentive increases by 1.25%
Calculation
- Calculate sales * incentive = commission (if sales is 80% met)/ if not no incentive
- Calculate total compensation = commission + salary
You have to decide that. I provided calculations based on your provided requirements. Campbell Ritchie probably as well, but only him could confirm that.Mona Stout wrote:So are we in agreement that the math is now correct via the above posts?
Write down classes names separated by comma again, so we could see once again.Mona Stout wrote:I have the classes defined correctly?
Yes, you can put two SalesPerson objects to an array if it is a part of your requirements. If not, then not necessarily if you're going to have only 2 persons.The SalesPerson class has to have two people for an Array/Array List comparison
Don't use "label them" phrase. Use - "instance".Mona Stout wrote:So I would have to label them SalesPerson1 and SalesPerson2, correct?
I don't know what you book says, but, in your current case - yes.Mona Stout wrote:Then do a set() and get() for each one of them.
Does this apply for everything that I do for one I have to write for both or did I misunderstand that part in the book?
Do you mean that there have to be two instances of sales person and they are put into a List<SalesPerson>? I hope you do. That would of course be inside an instance of a different class, sales force, sales department, company or whatever. Your variable names should start with s not S. If they are in a List you can get away without names, because they would be salespeople[i] or salespeople.get(i). If you have the option to use a List, do that in preference to an array. Remind yourself of the capabilities of Lists in the Java™ Tutorials. Remind yourself of how to compare objects also in the Java™ Tutorials.Mona Stout wrote: . . .
The SalesPerson class has to have two people for an Array/Array List comparison
So I would have to label them SalesPerson1 and SalesPerson2,
. . .
Write down classes names separated by comma again, so we could see once again.
Yes, you can put two SalesPerson objects to an array if it is a part of your requirements
Implement this class first. Test as Campbell Ritchie told you yesterday or before yesterday. Then you'll see yourself if Process is needed.Mona Stout wrote:The classes that I came up with were Person
Do as CR mentioned 1 post above.Mona Stout wrote:The assignment requires that an Array/Array list be used to compare two individuals
Yes. But it is no longer needed as you need to add them to Array or ArrayList. Check again CR post (1 above).Mona Stout wrote:Does this mean it could be SalesPerson1 since a variable can have pretty much any name?
Two reasons not to use Process.Mona Stout wrote:. . .
The classes that I came up with were Person, Process.
Yes and no. In theory you can call a variable anything which is not the name of a class nor a keyword, but you want a name making its meaning clear. Actually you can call a variable by the name of a class, like here:-But things will go horribly wrong if you give that class a main method.. . .
Does this mean it could be SalesPerson1 since a variable can have pretty much any name?
Mona Stout wrote:So when I get home tonight does this mean that you want me to start coding this? You keep saying to test this but before you told me to stop coding and write everything on paper so that is what I have done. I know that you told me to not worry about due dates so I'm trying not to, but it is coming down to the wire.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
For better to give the sales person class a proper toString method then you can simply writeDylan Stout wrote: . . .
Mona Stout wrote:// target for all sales persons is $120,000
Everybody's invited. Except this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
|