This document contains code for a Java program that calculates total compensation for a salesperson based on their fixed salary, sales commission, and total sales. It includes classes for the total compensation program and salesperson salary. The main method gets input for total sales from the user and calls methods to calculate commission and total compensation, outputting a table of sales amounts and compensation. Methods are included to calculate commission based on sales targets, calculate total compensation as fixed salary plus commission, and initialize default values.
8. Must set src.dir
Must set test.src.dir
Must set build.dir
Must set dist.dir
Must set build.classes.dir
Must set dist.javadoc.dir
Must set build.test.classes.dir
Must set build.test.results.dir
Must set build.classes.excludes
Must set dist.jar
29. To run this application from the command line without
Ant, try:
java -jar "${dist.jar.resolved}"
30. Must select one file in the IDE or set run.class
Must select one file in the IDE or set run.class
31. Must select one file in the IDE or set debug.class
Must select one file in the IDE or set debug.class
Must set fix.includes
This target only works when run from inside the NetBeans
IDE.
32. Must select one file in the IDE or set profile.class
This target only works when run from inside the NetBeans
IDE.
This target only works when run from inside the NetBeans
IDE.
This target only works when run from inside the NetBeans
IDE.
34. Must select some files in the IDE or set test.includes
Must select one file in the IDE or set run.class
Must select one file in the IDE or set applet.url
35.
36. Must select some files in the IDE or set javac.includes
Some tests failed; see details above.
37. Must select some files in the IDE or set test.includes
Some tests failed; see details above.
Must select some files in the IDE or set test.class
Must select some method in the IDE or set test.method
Some tests failed; see details above.
Must select one file in the IDE or set test.class
Must select one file in the IDE or set test.class
Must select some method in the IDE or set test.method
38. Must select one file in the IDE or set applet.url
Must select one file in the IDE or set applet.url
40. build.xml.script.CRC32=a1d039ff
[email protected]
# This file is used by a NetBeans-based IDE to track changes in
generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will
never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=91aea9c2
nbproject/build-impl.xml.script.CRC32=66654014
nbproject/[email protected]
Total Compensation/nbproject/private/private.properties
user.properties.file=C:UsersChuckAppDataRoamingNet
Beans8.2build.properties
Total Compensation/nbproject/private/private.xml
file:/F:/Total%20Compensation/src/TotalCompensation/TotalCo
mpensation.java
Total Compensation/nbproject/project.properties
annotation.processing.enabled=true
42. debug.classpath=
${run.classpath}
debug.test.classpath=
${run.test.classpath}
# Files in build.classes.dir which should be excluded from
distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/TotalCompensation.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
includes=**
jar.compress=false
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
46. * Week 3 Individual Assignment
*
*/
packageTotalCompensation;
import java.util.Scanner;
publicclassTotalCompensation
{
/**
* @param args
* the command line arguments
*/
publicstaticvoid main(String[] args){
double totalSales;
Salesperson_Salary salesPersonSalary =newSalesperson_Salary(
);
/* This reads the users input values for annual sales */
Scanner reader =newScanner(System.in);
System.out.print("nEnter total Sales: ");
totalSales = reader.nextDouble();
/* This formats the total sales and compensation table and displ
ays it */
System.out.format("%-
15s%30s %n","Total Sales","Total Compensation");
System.out.format("%-
15s%30s %n","===========","==================");
for(double s = totalSales; s <=(1.5* totalSales); s +=20000){
/* This function is called to calculate the commission for the sal
esperson */
salesPersonSalary.calculate_Commission(s);
/* This function is called to calculate the total compensation for
the
47. salesperson */
salesPersonSalary.calculate_Total_Compensation();
System.out.format("%-
15s%25sn", s, salesPersonSalary.totalComp);
}
}
}
classSalesperson_Salary{
int fixedSalary;
double commission;
double totalComp;
double salesTarget =150000;
double accelerationFactor =0.17;
/* This is the constructor to initialize the default values */
publicSalesperson_Salary(){
fixedSalary =85000;
commission =0;
totalComp = fixedSalary + commission;
}
/* This function is used to calculate the commission for the sale
sperson */
void calculate_Commission(double totalSales){
/* The sales incentive will only start when 80% of the sales targ
et is met */
if(totalSales <0.8* salesTarget)
commission =0;
/* This caculates the commission for totalSales <= the sales targ
et but over 80% */
elseif(totalSales <= salesTarget)
commission =0.15* totalSales;
/* This calculates the totalSales with 15 % commission and an a
dditional 2% */
else
48. commission = totalSales * accelerationFactor;
}
/* This function is to calculate the total compensation for the sa
lesperson */
void calculate_Total_Compensation(){
totalComp = fixedSalary + commission;
/* Total Compensation is sum of fixed salary and commission */
}
}