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

# Java and netbean week 3 Salesperson Java™ Application Part II

Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
I really need help with this assignment I am really struggling can someone please help me.  I need to make this table and the coding I have is a mess.  We are using NetBeansIDE 8.1 which I have never used.  But here is my problem i need help with.  the code I have started with is below the question which was for the previous weeks homework which I think is correct.

The company has recently changed its total annual compensation policy to improve sales.
A salesperson will continue to earn a fixed salary of  \$50,000. The current sales target for every salesperson is \$110,000.
The sales incentive will only start when 80% of the sales target is met. The current commission is 5 percent of total sales.
If a salesperson exceeds the sales target, the commission will increase based on an acceleration factor. The acceleration factor is 1.5.
The application should ask the user to enter annual sales, and it should display the total annual compensation.
The application should also display a table of potential total annual compensation that the salesperson could have earned, in \$5000 increments above the salesperson's annual sales, until it reaches 50% above the salesperson's annual sales.
Sample Table: Assuming a total annual sales of \$100,000, the table would look like this:

Total Sales
Total Compensation
100,000
<<Program calculated value>>
105,000
<<Program calculated value>>
110,000
<<Program calculated value>>
115,000
<<Program calculated value>>
120,000
<<Program calculated value>>
125,000
<<Program calculated value>>
130,000
<<Program calculated value>>
135,000
<<Program calculated value>>
140,000
<<Program calculated value>>
145,000
<<Program calculated value>>
150,000
<<Program calculated value>>
The Java application should also meet these technical requirements:
The application should have at least one class, in addition to the application's controlling class.
The source code must demonstrate the use of conditional and looping structures.
There should be proper documentation in the source code.

Marshal
Posts: 79236
377
• 1
• Number of slices to send:
Optional 'thank-you' note:
Welcome to the Ranch
You appear to have posted the same post twice, so I deleted it. I shall try adding code tags to your post. Always use the tags; you will be able to see how much better the post looks.
At this stage, forget all about code. Write down on paper how you are going to calculate the different earnings. Once you have got it on paper, simplify it until it is all in words of one syllable. Then you can try turnign it into code, and it will be much easier.

jeff cantrell
Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
I was trying to find out where to turn the code tags on but couldnt find them. i couldnt find where to delete the second pose either sorry about that.

jeff cantrell
Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
this is what I come up with out of breaking down the question that I need for the problem

fixed salary of 50000
target is 110000
incentive >80% then it will start
Commission is 5% of total sales
if exceed the target ^commission by 1.5%

Sheriff
Posts: 7125
184
• Number of slices to send:
Optional 'thank-you' note:
What you have is great.  I would put that in a method call calculateAnuualSalary.  But let me back up.

You have this from the instructions:

The application should ask the user to enter annual sales, and it should display the total annual compensation.

From this I would break the problem down like this:
• Get annual sales from the user
• Calculate annual salary
• Display annual salary

• Each one of these would be a method (have you learned methods?)  The first method might be getAnnaulSales(), the second might be calculateAnnaulSales(), etc.  Then write the steps for the methods.

You may decide that some of the tasks don't need a method, like "display annual salary" in this case would be just one line, but what if this were a GUI or a Web App?  It's important to know that the task "display annual salary" could be its own method.

jeff cantrell
Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
So I have updated my code and here is what I have so far.  I am having a little trouble with getting the calculations for the total compensations on the right of my table and then I am having trouble getting my table to stop looping I know I have to give it a false statement somewhere  also how do I get it the if and else statements to say yes and no for the incentive if it is earned.  I am just having these three issues really....

Knute Snortum
Sheriff
Posts: 7125
184
• Number of slices to send:
Optional 'thank-you' note:
There are a lot of things wrong with the code above, but I think the first problem is formatting.  You don't get an error for bad formatting, but it is a bug none the less.  Here is a link on how to format your code.  To format all the code in NetBeans, press Alt + Shift + F.

Once you format the code, you can see you have two classes, the first with several inner classes and main() methods.  This is a problem.  You only should have one main() method for your entire project and it should do one thing: launch the project.  Here is a wiki on how to get your code out of the main() method.

There is no Java construct called a "table".  You probably mean the array of arrays variable called "data".  Java is case sensitive, so the type "object" should be "Object".

jeff cantrell
Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
SO what am I needing to do is change classes and make sure there are only one class or two I am so lost now.

Campbell Ritchie
Marshal
Posts: 79236
377
• Number of slices to send:
Optional 'thank-you' note:

Knute Snortum wrote:. . . you have two classes, the first with several inner classes and main() methods.  This is a problem.  . . .

There is probably another problem there, caused largely by your inconsistent indentation. Please go back and indent your code properly with the right line lengths. More details here. You may have created those classes as inner classes unintentionally because you have all the { and } in the wrong places. People think we are being fussy going on about indentation, but experience shows that wrong indentation can introduce errors into your code, and also makes those errors much more difficult to find.

jeff cantrell
Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:

jeff cantrell
Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
is that format better I have to turn it in from the java document and I had copied it from there sorry about that.  I dont think your being fussy.  I really do need help with this and no worries I want the best help I can get in order to learn this correctly.

jeff cantrell
Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
Also I have another question do I need to have another table somewhere else in order for this to work or will it work from the code.  I don't have to create a table separately do I?

jeff cantrell
Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
the only three lines that I get an error are 53,55,57 so I dont know what to do there

Sheriff
Posts: 17644
300
• Number of slices to send:
Optional 'thank-you' note:
Do you really have to use a GUI table to display the results? Honestly, you don't even have the basic solution figured out yet.

And FYI, a factor of 0.5 represents a 50% commission.  The salesmen will love you for writing a program like that but your boss will likely be very unhappy when he finds out about the mistake you made.

jeff cantrell
Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
Your right I did make that mistake I changed it just now wow.  I got the second week part done where it ask for  this  portion in the third week and I was having the trouble with the table if you want to know the truth.  the second week was

Campbell Ritchie
Marshal
Posts: 79236
377
• Number of slices to send:
Optional 'thank-you' note:
It only looks slightly better.
Get rid of all comments which don't tell you anything you can't tell already with a 3″ look.
Change all // comments more than about 30 letters long into /* comments */; these are intended for things longer and can span several lines.
Only two / characters. Not three.
Get rid of all the GUI code until you have it working from the command line. And don't use flow layout. I think it is a bad layout.
Break all the long lines; you correctly added a + between two Strings but didn't go onto a new line. Remember that you have to include spaces for example + " ...
Don't write System.out.println(""); write System.out.println();
It will look more like this:-Don't try to correct the indentation. You shou‍ld indent the code and space it and use the correct line lengths as you write it.
There is something wrong about you having four }s at the end of your main method.
Class names begin with CapitalLetters: not table but Table. Why are you adding a table object to the scroll pane? That looks like a mistake. It is often a mistake to do anything with a GUI after setVisible. The setVisible call shou‍ld usually be the last line.

jeff cantrell
Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
Your right I did make that mistake I changed it just now wow.  I got the second week part done where it ask for  this  portion in the third week and I was having the trouble with the table if you want to know the truth.  the second week was

Junilu Lacar
Sheriff
Posts: 17644
300
• Number of slices to send:
Optional 'thank-you' note:
I would say a lot of the delay you experienced in getting answers to your main questions was due to poor formatting of your code. Since you're using NetBeans, all you really need to do is to press Alt + Shift + F.  This makes NetBeans do all the hard work for you.

I sense some panic in your posts. That's not going to help you right now. If this is due to be submitted within the next couple of days, it's probably already too late now. You can still salvage this, but you have to be willing to throw away most of what you've done.

The main problem I see is your lack of organization.  If you write code the way you have written it so far, then you will quickly get lost in the mess that you make. And quite frankly, it is a mess. If you were trying to build a robot, what you did is equivalent to taking a bunch of parts and materials you think you need and dumping them all on a table. Then you try to make a working robot out of that big, jumbled pile. That's not going to work.

What you need to do is organize. Break down the big problem into multiple smaller problems. Then tackle each small problem in relative isolation. I say "relative" because you still have to think about how everything will come together in the end. Like say with a robot, you have smaller problems of head, legs, arms, torso. You can build each section independently but you need to think about what you're going to do to connect the head to the torso, the legs to the torso, the arms to the torso.  The analogy I'm trying to get at here is that the torso is your "driver" class.  The head, legs, and arms could be other class(es) you're required to write besides your driver class.

Knute already kind of gave you a hint on what smaller problems you'll have to figure out.

My question to you is: Are you willing to throw away (most of) your current code and start over?

Campbell Ritchie
Marshal
Posts: 79236
377
• Number of slices to send:
Optional 'thank-you' note:
As before, get rid of all those comments. They are only slightly less useless than this sort of thing:-That doesn't explain why you are counting from 3 or setting the text to "Jeff".
You cannot get that sort of code you posted to work at all. All your figures are local to the main method and have no existence outside it. This is probably the most object‑oriented way to do it: create a SalesPerson class with figures for salary, and methods to calculate the salary. Create instances representing people who have sold \$100000, \$110000, \$120000 etc, and get their salaries from those objects.

I see you have a class called table and a field called table; such duplicate naming is a sure‑fire recipe for disaster.

jeff cantrell
Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
The Salesperson earns a fixed annual salary of \$50000.0.
The Salesperson will receive a commission of 5%.
Enter annual sales: 60
The annual sales of the salesperson is \$30.0 using a 5% commission.
The total annual compensation of the salesperson is: \$50030.0.
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - illegal start of expression
at CommissionCalculation1.main(CommissionCalculation1.java:46)
C:\Users\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 6 seconds)

jeff cantrell
Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
Ok I changed some things like you had said to change but I didnt take out the gui like you mentioned is the only thing that I didnt change I think..

jeff cantrell
Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
here is the output of it without the table pulling up.

The Salesperson earns a fixed annual salary of \$50000.0.
The Salesperson will receive a commission of 5%.
Enter annual sales: 60
The annual sales of the salesperson is \$30.0 using a 5% commission.
The total annual compensation of the salesperson is: \$50030.0.
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - illegal start of expression
at CommissionCalculation1.main(CommissionCalculation1.java:46)
C:\Users\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 6 seconds)

Knute Snortum
Sheriff
Posts: 7125
184
• Number of slices to send:
Optional 'thank-you' note:
You still have three main() methods, one in CommissionCalculation1, one in Salesperson, and one in Table.  You can't declare a public class inside another class; put Salesperson in a separate file.  The same goes for Table.

Junilu Lacar
Sheriff
Posts: 17644
300
• Number of slices to send:
Optional 'thank-you' note:
Ok, so auto-formatting only helped a little bit. You shouldn't declare your classes like that. There can only be ONE top-level public class in a compilation unit (a *.java file) and that public class must have the same name as the file name.  So, assuming you have a file called CommissionCalculation1.java, then the only top-level public class you can declare in it is CommissionCalculation1.

Basically, the general structure of your code should look something like this:

This is what I meant earlier by "organizing" - you need to break down the problem and compartmentalize your thoughts and code.

Rancher
Posts: 4801
50
• Number of slices to send:
Optional 'thank-you' note:
"Uncompilable source code'

Netbeans will highlight the compilation errors it has, and if there's any red markers then you really shouldn't bother trying to run the code as you'll just get the above error.

jeff cantrell
Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
so your saying it should look something like this not have the public before the classes only in front of the commissioncalculation1 and then the rest should just be class and the name of the class correct

Junilu Lacar
Sheriff
Posts: 17644
300
• Number of slices to send:
Optional 'thank-you' note:

jeff cantrell wrote:so your saying it should look something like this not have the public before the classes only in front of the commissioncalculation1 and then the rest should just be class and the name of the class correct

Getting warmer.  Why do you still have main() methods in the supporting classes though?  Your controller class should be the only one with a main() method. Like I said in the comments, this is where you orchestrate what happens in your program. The code in the main method should read like a story outline. Right now, it doesn't.

Here's a sample of what I mean by "orchestrating":

Do you see a main() method in the supporting classes? No, right?

The only main() method in the program is in SorcererApprentice.  The code in main kind of tells the "story" of what's happening in the program. It says, first a bunch of Broom objects are conjured up. That happens in the createBrooms() method. Then a bunch of Buckets are conjured up, which happens in the createBuckets() method. Then I have all these Broom objects start sweeping. That happens in the sweepTheRoom() method. Then I have all those Buckets fill the pool, which happens in the fillThePool() method.

YOU, as the programmer, are the playright who comes up with this story and script.  If you don't organize your thoughts and write up a coherent script, nobody will know what's happening, nobody will know their roles, when they should come in and do things, and how they will coordinate their actions with the things that other cast members are doing.  It will be chaos and a mess, as you already see with the code you have right now.

So, again, go back to the drawing board and plan out your story. Identify who your cast of characters are, their roles and what specifically each of them will do.

Junilu Lacar
Sheriff
Posts: 17644
300
• Number of slices to send:
Optional 'thank-you' note:
One thing that might lead you astray: Trying to thinking in terms of real-world objects. Sometimes it's good and helpful, sometimes it's not so helpful.

In organizing your thoughts about your program and the problem it's trying to solve, it's helpful to start by identifying certain aspects or dimensions of the problem:

1.  Data/Information
2.  Actions/Calculations
3.  Responsibilities

Object-Oriented Programming and thinking in terms of objects is not necessarily about modeling the real world in your program. Rather, it's about coming up with the right abstractions that will help you organize these three aspects of your program. Sometimes these abstractions correspond to things in the real world, sometimes they are pure inventions of the imagination. The common theme though is that you can think of these abstractions as "entities" (objects) that know how to do things (perform actions/calculations) based on things that they know and remember (data/information). The combination of knowing data/information and knowing actions/calculations is what makes up an entity's responsibilities.

From the problem statement, you can identify a number of data items:

The company has recently changed its total annual compensation policy to improve sales.
A salesperson will continue to earn a fixed salary of  \$50,000. The current sales target for every salesperson is \$110,000.
The sales incentive will only start when 80% of the sales target is met. The current commission is 5 percent of total sales.
If a salesperson exceeds the sales target, the commission will increase based on an acceleration factor. The acceleration factor is 1.5.
The application should ask the user to enter annual sales, and it should display the total annual compensation.
The application should also display a table of potential total annual compensation that the salesperson could have earned, in \$5000 increments above the salesperson's annual sales, until it reaches 50% above the salesperson's annual sales.
Sample Table: Assuming a total annual sales of \$100,000, the table would look like this

Data/Information will be represented in your program as one of these:
1. A variable
2. A constant

Actions and calculations can also be identified:

The company has recently changed its total annual compensation policy to improve sales.
A salesperson will continue to earn a fixed salary of  \$50,000. The current sales target for every salesperson is \$110,000.
The sales incentive will only start when 80% of the sales target is met. The current commission is 5 percent of total sales.
If a salesperson exceeds the sales target, the commission will increase based on an acceleration factor. The acceleration factor is 1.5.
The application should ask the user to enter annual sales, and it should display the total annual compensation.
The application should also display a table of potential total annual compensation that the salesperson could have earned, in \$5000 increments above the salesperson's annual sales, until it reaches 50% above the salesperson's annual sales.

Assigning responsibilities is probably the hardest part of organizing an object-oriented program. You have to ask questions like these:

1. What program entity (for simplicity, I'll just write "who" from here onwards) should ask the user to enter annual sales?
2. Who should determine when the acceleration factor should be applied? What information is needed to do this?
3. Who should determine when the incentive should start to be awarded? What information is needed to do this?
4. Who should display the total compensation? What information is needed?
5. Who should calculate the total compensation? What information is needed?
6.  ... and so on

There are many more questions that you can ask to help you figure out how to break down the large job and organize it into many small, inter-related jobs that can be orchestrated to get things done. Notice, however, that each question about action/calculation is paired with the question of what information is needed. This hints at the combination of "things you do with the things you know" making up the "responsibilities" of an entity/object.

(continued)

Junilu Lacar
Sheriff
Posts: 17644
300
• Number of slices to send:
Optional 'thank-you' note:
In this case, my feeling is that trying to use a "SalesPerson" as the abstraction to which you assign the various responsibilities in this program will create a cognitive dissonance - a mismatch in what you instinctively know a SalesPerson should or shouldn't do.

In the real world, sales people don't go around calculating their own commissions (well, they probably do but it's not a official thing). Rather, someone in the sales office does those calculations and that's what actual payouts are based on. Salespeople simply report their numbers to the sales office. There, someone else does the official calculations for commissions and incentives and such. Using an abstraction named SalesPerson creates a mental conflict that is difficult to ignore, even if you try to consciously bend your thinking to fit your code's narrative.

I think that a more abstract entity will be better suited for this problem. This entity still has somewhat of a real-world equivalent, only it's not so much a person as it is a role. Think about what an entity called the PayCalculator should be able to do:

1. You can tell it what the annual sales amount is and it would remember that amount.
2. Based on the annual sales that it was given, it can tell whether or not a sales target was met
3. Based on the annual sales that it was given, it can tell whether or not sales incentives should start to be awarded
4. Based on the annual sales that it was given, it can calculate the commensurate commission to award
5. Based on the annual sales that it was given, it can determine whether or not to use an acceleration factor to calculate commission to award
6. ... and so on

Now, imagine that you had a number objects like this in your program.  You could give one of them the actual annual sales that a salesperson has provided. That's one of the requirements, right?  Then, you could give another one of those objects a hypothetical annual sales amount and have it calculate what would have been the total compensation based on that. You could give another object yet another hypothetical annual sales amount and do the same kind of calculations. In fact, you could create a whole bunch of PayCalculator objects and have them each take care of all calculations related to whatever annual sales amount you give each of them. Then you could go around and tell each object in turn, "Please show the total compensation that you calculated for the annual sales amount that I gave you earlier."  That's another requirement, right?

Junilu Lacar
Sheriff
Posts: 17644
300
• Number of slices to send:
Optional 'thank-you' note:

I wrote: you could create a whole bunch of PayCalculator objects and have them each take care of all calculations related to whatever annual sales amount you give each of them. Then you could go around and tell each object in turn, "Please show the total compensation that you calculated for the annual sales amount that I gave you earlier."  That's another requirement, right?

And here's what parts of this narrative might look like as Java code:

Junilu Lacar
Sheriff
Posts: 17644
300
• Number of slices to send:
Optional 'thank-you' note:

jeff cantrell wrote:Your right I did make that mistake I changed it just now wow.

Doesn't look like you changed it correctly to me. That still gives salespeople a 50% commission rate. See line 32.

jeff cantrell
Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
i did change it I keep copying the wrong thing when I send the .5

Campbell Ritchie
Marshal
Posts: 79236
377
• Number of slices to send:
Optional 'thank-you' note:

Junilu Lacar wrote:. . . Object-Oriented Programming and thinking in terms of objects is not necessarily about modeling the real world in your program.  . . .

But a lot of object‑oriented programming does behave like the real world. You ask real world salespeople how much they have sold and you pay real world salespeople a salary.

Junilu Lacar
Sheriff
Posts: 17644
300
• Number of slices to send:
Optional 'thank-you' note:

Campbell Ritchie wrote:

Junilu Lacar wrote:. . . Object-Oriented Programming and thinking in terms of objects is not necessarily about modeling the real world in your program.  . . .

But a lot of object‑oriented programming does behave like the real world. You ask real world salespeople how much they have sold and you pay real world salespeople a salary.

But where in the real world can you find a series of characters that can tell you how long it is? Where can you find a number that can compare itself to another number and give you an indication of whether it is less than, equal to, or greater than that number? Many, if not not most, of the objects/classes we use and create in our programs don't have real-world counterparts. They are abstractions which, to a large extent, are simply anthropomorphic inventions. They allow us to frame our thinking and perspective in a certain way and imagine doing things like "asking" a String "How long are you?" by writing someString.length(). Even that is subject to a different perspective if you think about it as "telling" a String to determine how many characters it contains and report back the results. When dealing with a Number, we imagine "telling" it to convert itself to a byte value by writing someNum.byteValue().

Besides, I did say "not necessarily" and "Sometimes it's good and helpful, sometimes it's not so helpful."

The usefulness of real-world objects comes out of our experiences with them. We can relate our experience and understanding of how real-world objects behave to our understanding of how analogous objects in our program would/should behave. The analogies are useful to the extent in which they help us organize our ideas and assign responsibilities properly. However, all analogies start to break down at some point and become less useful. If you carry them too far, analogies can even become harmful. Just look at what happened with the Debt metaphor, for example.

People have different backgrounds, perspectives, perceptions, and interpretations. One person may not have any problems with the idea of a SalesPerson object calculating its own commission. Others, on the other hand, may have some past experience with accounting systems and the thought of a salesperson in the real world calculating their own pay raises a red flag and that bias, however unfounded it may be in the context of the program, is difficult to get over. Calling the abstraction a SalePerson is like that for me, it's distracting and it disrupts my thought process. You may think that's lame and it probably is but I'd rather not deal with it regardless. So if we were doing collaborative development, I would probably say "Can we just call it PayCalculator, because it bothers me that we're letting a SalesPerson calculate their own commission. Where are the checks and balances, right? I know it sounds silly but just humor me."

Junilu Lacar
Sheriff
Posts: 17644
300
• Number of slices to send:
Optional 'thank-you' note:

Campbell Ritchie wrote:You ask real world salespeople how much they have sold and you pay real world salespeople a salary.

If you spend a little time parsing this out into something you can implement as a program design and Java code, some questions will come up:

1. Who is "You" here? Who is asking a SalesPerson object for their sales numbers?

2. Similarly, who is the "you" that is paying a SalesPerson his/her salary?  Is this "you" actually paying the salary or calculating the amount to be paid?

This is why I like the analogy of me, the programmer, being an "orchestrator" or "director" of things that are happening in the program. The cast of characters in the symphony or play that is my program are the objects to which I have assigned certain responsibilities.

Here's kind of what goes on in my head as I'm design/writing the code:

Ok, I need to get the user to enter their sales numbers. Let's write a static method for that:

Now, who should calculate the total compensation? Ok, let's have a PayCalculator() do that. Let's have that guy display the results, too.

Wait, what if we needed a different display format? What if we need a bunch of different formats? Maybe we need somebody else to be responsible for the formatting part.

Hmm, that name doesn't look right there. Maybe I should rename it...

Ok, that makes more sense now.

Now let's see what these guys can do...

and so on.

You might find my use of phrases like "let's have that guy do it" peculiar but in this imaginary world I'm creating, I think of the objects as sentient beings that I can create and direct. Therefore, I give them names that reflect the responsibilities that I give them and I make sure that the names I give fit the entire narrative that I'm trying to relate in the program.

In the real world, a pay calculation is simply an algorithm that someone would follow. In the program, that "someone" becomes the object to which I have delegated the responsibility of "knowing" and following the algorithm. The object then becomes this almost animate "thing" that I can simply invoke to do the heavy lifting for me. So, an algorithm, which is an inanimate and abstract idea in the real-world becomes a PayCalculation object, an almost tangible, seemingly sentient entity with capabilities and behavior in the program.  This, to me, is what object-orientation is about.

jeff cantrell
Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
ok lets back everything up a bit I did this for week two and this is what I came up with and it is correct for the assignment I am struggling with the table portion for week three which is what the assignment I ask questions about is added on to this.  So can we start with that section of it.

jeff cantrell
Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
this was week 2's assignment question

Write a Java application using NetBeans Integrated Development Environment (IDE) that calculates the total annual compensation of a salesperson. Consider the following factors:
A salesperson will earn a fixed salary of  \$50,000.
A salesperson will also receive a commission as a sales incentive. Commission is a percentage of the salesperson's annual sales. The current commission is 5 percent of total sales.
The total annual compensation is the fixed salary plus the commission earned.
The Java application should meet these technical requirements:
The application should have at least one class, in addition to the application's controlling class (a controlling class is where the main function resides).
There should be proper documentation in the source code.
The application should ask the user to enter annual sales, and it should display the total annual compensation.

jeff cantrell
Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
this is week 3's assignment

Modify the Week Two Java application using NetBeans IDE to meet these additional and changed business requirements:
The company has recently changed its total annual compensation policy to improve sales.
A salesperson will continue to earn a fixed salary of  \$50,000. The current sales target for every salesperson is \$110,000.
The sales incentive will only start when 80% of the sales target is met. The current commission is 5 percent of total sales.
If a salesperson exceeds the sales target, the commission will increase based on an acceleration factor. The acceleration factor is 1.5.
The application should ask the user to enter annual sales, and it should display the total annual compensation.
The application should also display a table of potential total annual compensation that the salesperson could have earned, in \$5000 increments above the salesperson's annual sales, until it reaches 50% above the salesperson's annual sales.
Sample Table: Assuming a total annual sales of \$100,000, the table would look like this:

Total Sales
Total Compensation
100,000
<<Program calculated value>>
105,000
<<Program calculated value>>
110,000
<<Program calculated value>>
115,000
<<Program calculated value>>
120,000
<<Program calculated value>>
125,000
<<Program calculated value>>
130,000
<<Program calculated value>>
135,000
<<Program calculated value>>
140,000
<<Program calculated value>>
145,000
<<Program calculated value>>
150,000
<<Program calculated value>>
The Java application should also meet these technical requirements:
The application should have at least one class, in addition to the application's controlling class.
The source code must demonstrate the use of conditional and looping structures.
There should be proper documentation in the source code.