Java Task #4 – What is your correct commission? You are in sales and you receive
ID: 3936647 • Letter: J
Question
Java
Task #4 – What is your correct commission?
You are in sales and you receive a bonus based on your sales.
As your input, ask a user to enter the dollar amount of their sales.
For your output: If the dollar value is less than $5000.00, they receive no commission
If the dollar value is between $5000.00 and $9999.99, they receive 10% commission
If the dollar value is greater than or equal to $10,000, they receive 20% commission
Display the calculated bonus for the salesperson (bonus = sales * commission)
Provide the source code.
Explanation / Answer
BonusTest.java
import java.util.Scanner;
public class BonusTest {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter the dollar amount of their sales: ");
double sales = scan.nextDouble();
double commission = 0;
if(sales < 5000){
commission = 0;
}
else if(sales >=5000 && sales <9999.99){
commission = 10;
}
else {
commission = 20;
}
double bonus = sales * commission/100;
System.out.println("Bonus is "+bonus);
}
}
Output:
Enter the dollar amount of their sales: 7000
Bonus is 700.0
Enter the dollar amount of their sales: 12000
Bonus is 2400.0
Enter the dollar amount of their sales: 4000
Bonus is 0.0
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.