Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java programming Scenario You have just started a sales job for company COP Inc. Your pay consists of a base salary and a commission. The

Java programming

Scenario

You have just started a sales job for company COP Inc. Your pay consists of a base salary and a commission. The base salary is $5,000 per month. The scheme shown below is used to determine the commission rate.

Sales Amount Commission Rate

--------------------------------------------------------------------

$0.00-$5,000 8%

$5,000.01 - $10,000 10%

$10,000.01- and above 12%

Note that this is a graduated rate, meaning your first $5,000 in sales nets you 8% commission and the next $5,000 you get 10%.

Let's do an example. Say you sold $25,000 in a month. That means you would receive: ($5,000*8%)+($5,000*10%)+($15,000*12%)+$5,000 = ($400) + ($500) + ($1,800) + $5,000 = $7,700.

What about $8,000 in sales? That would be ($5,000 * 8%) + ($3,000 * 10%) + $5,000 = ($400) + ($300) + ($5,000) = $5,700.

Objective

We are going to write a program that performs these calculations and outputs a table of values showing how much money someone will make given an amount of sales that month. You will start with the sales amount $1,000 and increment it by $1,000 up to $20,000 in sales (see the table below for an example output).

You will create a function that looks like the following:

public static double computeIncome(double salesAmount)

Given a sales amount it will calculate the amount of money earned that month. Don't forget to add the base salary of $5,000!

Example Output:

image text in transcribed

Note: I do not require that your output matches mine (for example tabbed and with $), but the calculations have to be correct!

image text in transcribed

Submission Submit your source code (java file), not your full project. If you are using Eclipse and having trouble finding your source code, it is usually at //src where Workspace path is where you setup the workspace and Project Name is the name of your project. I advise you to follow coding standards that produces clean code for your own benefit and practice. However, I do not require it. That is, you are not required to add any particular headers or comments, but I encourage you to follow style practices you have learned. Tips The main function is pretty simple, just a loop that goes from 1000 to 20000 and repeatedly calls the function computelncome and outputs to the console. The difficult part will be what goes in the computelncome function. There are a lot of ways you can solve this problem, but here are some tips to help out. 1. The commission runs in tiers, you will need some if statements to determine if the amount is inside of a particular tier or greater than it. 2. If you are within a tier, you need to add to the returned amount a calculation of (salesAmount maxFromPreviousTier) (percent). For example if the value is within the second tier, it would be (salesAmount 5000) 0.1 3. If your amount is greater than the tier maximum then you are adding the following (maximumAmount maxFromPreviousTier) (percent). For example if salesAmount is greater than the first tier's maximum (5000) you would add the value (5000-0) 0.08-400. If your salesAmount is greater than the second tier maximum (10000) you would add (10000-5000) * 0.1 = 500

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

25.0 m C B A 52.0 m 65.0 m

Answered: 1 week ago