In class lab alespeople that work for the XYZ Company earn a commission on their
ID: 3869775 • Letter: I
Question
In class lab alespeople that work for the XYZ Company earn a commission on their monthly sales amount. 1. S The commission sion is stepped as shown in the following table. The commission is the earned percentage rate times their monthly sales amount. Earned Percentage rate 10 Monthy sales 10.000 or more less than 10000 but greater than or equal to 2,500 /Less than 2,500 Write a program that inputs a salespersons last name and monthly sales amount. Using nested if and /or if else statements, calculate and display a salesperson's monthly commission. 2. a. Before generating any code create an algorithm (your plan) for the problem. Document your algorithm. Generate code based on your algorithm. b. 3. Test your program using the following three cases. James Brown's monthly sales were 14,500. Mary Smith's monthly sales were2400 and Frank Jones monthly sales were 500. Verify your J program calculates correct commissions Turn in your algorithm, source code and results.Explanation / Answer
Algorithm:
Step1: Start
Step2: Read last name and sales amount
Step3: Check sales amount greater than the 10000 than the commission is 10
Step4: Compute and store commission=(salesAmount*10)/100;
Step5: Display commission
Step6:Stop
Source Code:
import java.util.*;
import java.lang.*;
import java.io.*;
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
String lastName;
int salesAmount;
double commission;
Scanner Sc=new Scanner(System.in);
System.out.println("Enter the Last Name");
lastName=Sc.nextLine();
System.out.println("Enter the sales amount");
salesAmount=Sc.nextInt();
if(salesAmount>10000)
{
commission=(salesAmount*10)/100;
}
else if(salesAmount<10000 && salesAmount>=2500)
{
commission=(salesAmount*6)/100;
}
else
{
commission=(salesAmount*3)/100;
}
System.out.println("The commission for the "+lastName+" is " +commission);
}
}
Output:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.