A salesperson earns a 20 commission on weekly sales of 5000

A salesperson earns a 20% commission on weekly sales of $5000 or more or a 10% commission on weekly sales of $3000 or more. Most salespeople regularly sell about $2000 a week. These salespeople do not receive a commission. Using Net Beans write a CLI application that does the following: Accepts a salesperson\'s weekly sales amount. Calculates the commission based on the scenario above. Outputs the salesperson\'s weekly sales and commission.

Solution

package ex3classid;

public class EX3classID {

public static void main(String[] args) {
ex3classid.comission cs = new ex3classid.comission();
try {
Float.parseFloat(args[0]);
} catch (Exception ex) {
System.out.println(\" \\t Please Fill SalsePerson\'s Weekly Salse amount\ \");
System.out.println(ex.toString());

System.exit(1);
}
Float d = Float.parseFloat(args[0]);
if (d > 3000) {
Float c = cs.comission(d);
System.out.println(\"SalsePerson\'s Weekly Sales Amount is: \\t \" + Float.parseFloat(args[0]) + \"$\");
System.out.println();
System.out.println(\"Based On Weekly Sales Total Commission is : \\t\" + c + \"$\");
System.out.println(\"\ Thank You!!! \ \");
}
if (d < 2000) {
System.out.println(\"\");
System.out.print(\"Based On Weekly Sales Sales Amount is: \\t \" + Float.parseFloat(args[0]) + \"$\" + \"\\t which is <3000 so you are not getting nay comission\");
System.out.println(\"\ Thank You!!! \ \");
}
}

}

class comission {

Float c;

public Float comission(Float d) {
if (d >= 5000) {
c = (float) (d * .20);
}
if ((d >= 3000) && (d <= 4999)) {
c = (float) (d * .10);
}
if (d < 3000) {
c = (float) 0;
}
return c;
}
}

OUTPUT-

SalsePerson\'s Weekly Sales Amount is:    3500.0$

Based On Weekly Sales Total Commission is :    350.0$

Thank You!!!

How to Set value in CLI using NetBeans

rightclick project name--->select properties tab ------>click on the run navigator on left hand side-->then fill the value in the arguments textBox.....

 A salesperson earns a 20% commission on weekly sales of $5000 or more or a 10% commission on weekly sales of $3000 or more. Most salespeople regularly sell abo
 A salesperson earns a 20% commission on weekly sales of $5000 or more or a 10% commission on weekly sales of $3000 or more. Most salespeople regularly sell abo

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site