A salesperson earns a 20 commission on weekly sales of 5000
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.....

