CommissionCalculation/build/classes/.netbeans_automatic_build
CommissionCalculation/build/classes/.netbeans_update_resources
CommissionCalculation/build/classes/commissioncalculation/CommissionCalculation.rs
CommissionCalculation/build/classes/commissioncalculation/SalesPerson.rs
CommissionCalculation/build/classes/CommissionCalculation.classpublicsynchronizedclass CommissionCalculation {
public void CommissionCalculation();
publicstatic void main(String[]);
}
CommissionCalculation/build/classes/SalesPerson.classpublicsynchronizedclass SalesPerson {
privatefinal double fixedSalary;
privatefinal double commissionRate;
privatefinal double salesTarget;
privatefinal double accelerationfactor;
private String name;
private double totalComm;
private double annualSales;
public SalesPerson saleperson;
public double getTotalComm();
public void setTotalComm(double);
public SalesPerson getSaleperson();
public void setSaleperson(SalesPerson);
public String getName();
public void setName(String);
public void SalesPerson();
public void SalesPerson(String, double, double);
public void SalesPerson(double);
public double getAnnualSales();
public void setAnnualSales(double);
public double getCommission();
public double getAnnualCompensation();
}
CommissionCalculation/build.xml
Builds, tests, and runs the project CommissionCalculation.
CommissionCalculation/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
META-INF/MANIFEST.MF
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.9.2
Created-By: 1.7.0_25-b15 (Oracle Corporation)
NetBeans-Own-Library: true
org/netbeans/modules/java/j2seproject/copylibstask/Bundle.properties
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
#
# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
# Other names may be trademarks of their respective owners.
#
# The contents of this file are subject to the terms of either the GNU
# General Public License Version 2 only ("GPL") or the Common
# Development and Distribution License("CDDL") (collectively, the
# "License"). You may not use this file except in compliance with the
# License. You can obtain a copy of the License at
# http://www.netbeans.org/cddl-gplv2.html
# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
# specific language governing permissions and limitations under the
# License. When distributing the software, include this License Header
# Notice in each file and include the License file at
# nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the GPL Version 2 section of the License file that
# accompanied this code. If applicable, add the following below the
# License Header, with the fields enclosed by brackets [] replaced b.
2. public SalesPerson getSaleperson();
public void setSaleperson(SalesPerson);
public String getName();
public void setName(String);
public void SalesPerson();
public void SalesPerson(String, double, double);
public void SalesPerson(double);
public double getAnnualSales();
public void setAnnualSales(double);
public double getCommission();
public double getAnnualCompensation();
}
CommissionCalculation/build.xml
Builds, tests, and runs the project CommissionCalculation.
CommissionCalculation/lib/CopyLibs/org-netbeans-modules-
java-j2seproject-copylibstask.jar
META-INF/MANIFEST.MF
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.9.2
Created-By: 1.7.0_25-b15 (Oracle Corporation)
NetBeans-Own-Library: true
3. org/netbeans/modules/java/j2seproject/copylibstask/Bundle.prop
erties
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR
THIS HEADER.
#
# Copyright 1997-2010 Oracle and/or its affiliates. All rights
reserved.
#
# Oracle and Java are registered trademarks of Oracle and/or its
affiliates.
# Other names may be trademarks of their respective owners.
#
# The contents of this file are subject to the terms of either the
GNU
# General Public License Version 2 only ("GPL") or the
Common
# Development and Distribution License("CDDL") (collectively,
the
# "License"). You may not use this file except in compliance
with the
# License. You can obtain a copy of the License at
# http://www.netbeans.org/cddl-gplv2.html
# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
# specific language governing permissions and limitations under
the
# License. When distributing the software, include this License
Header
# Notice in each file and include the License file at
# nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
# particular file as subject to the "Classpath" exception as
provided
# by Oracle in the GPL Version 2 section of the License file
that
# accompanied this code. If applicable, add the following below
the
4. # License Header, with the fields enclosed by brackets []
replaced by
# your own identifying information:
# "Portions Copyrighted [year] [name of copyright owner]"
#
# Contributor(s):
#
# The Original Software is NetBeans. The Initial Developer of
the Original
# Software is Sun Microsystems, Inc. Portions Copyright 1997-
2006 Sun
# Microsystems, Inc. All Rights Reserved.
#
# If you wish your version of this file to be governed by only
the CDDL
# or only the GPL Version 2, indicate your decision by adding
# "[Contributor] elects to include this software in this
distribution
# under the [CDDL or GPL Version 2] license." If you do not
indicate a
# single choice of license, a recipient has the option to
distribute
# your version of this file under either the CDDL, the GPL
Version 2 or
# to extend the choice of license to its licensees as provided
above.
# However, if you add GPL Version 2 code and therefore,
elected the GPL
# Version 2 license, then the option applies only if the new code
is
# made subject to such option by the copyright holder.
TXT_README_FILE_NAME=README.TXT
TXT_README_FILE_CONTENT======================
===n
BUILD OUTPUT DESCRIPTIONn
5. ========================n
n
When you build an Java application project that has a main
class, the IDEn
automatically copies all of the JARn
files on the project's classpath to your project's dist/lib folder.
The IDEn
also adds each of the JAR files to the Class-Path element in the
applicationn
JAR file's manifest file (MANIFEST.MF).n
n
To run the project from the command line, go to the dist folder
andn
type the following:n
n
java -jar '"{0}'" n
n
To distribute this project, zip up the dist folder (including the
lib folder)n
and distribute the ZIP file.n
n
Notes:n
n
* If two JAR files on the project classpath have the same name,
only the firstn
JAR file is copied to the lib folder.n
* Only JAR files are copied to the lib folder.n
If the classpath contains other types of files or folders, these
files (folders)n
are not copied.n
* If a library on the project's classpath also has a Class-Path
elementn
specified in the manifest,the content of the Class-Path element
has to be onn
the project's runtime path.n
* To set a main class in a standard Java project, right-click the
6. project noden
in the Projects window and choose Properties. Then click Run
and enter then
class name in the Main Class field. Alternatively, you can
manually type then
class name in the manifest Main-Class element.
org/netbeans/modules/java/j2seproject/copylibstask/CopyFiles.c
lasspackage org.netbeans.modules.java.j2seproject.copylibstask;
publicsynchronizedclass CopyFiles extends
org.apache.tools.ant.Task {
private java.io.File todir;
private java.io.File iftldtodir;
private String files;
private String manifestproperty;
public void CopyFiles();
public void execute() throws
org.apache.tools.ant.BuildException;
private boolean containsTLD(java.io.File);
public String getFiles();
public void setFiles(String);
public java.io.File getToDir();
public void setToDir(java.io.File);
public java.io.File getIfTLDToDir();
public void setIfTLDToDir(java.io.File);
public String getManifestProperty();
public void setManifestProperty(String);
static void <clinit>();
}
org/netbeans/modules/java/j2seproject/copylibstask/CopyLibs.cl
asspackage org.netbeans.modules.java.j2seproject.copylibstask;
publicsynchronizedclass CopyLibs extends
org.apache.tools.ant.taskdefs.Jar {
7. privatestaticfinal String LIB = lib;
privatestaticfinal String ATTR_CLASS_PATH = Class-Path;
privatestaticfinal String MANIFEST = META-
INF/MANIFEST.MF;
privatestaticfinal String INDEX = META-INF/INDEX.LIST;
privatestaticfinal String UTF_8 = UTF-8;
privatestaticfinal String UTF8 = UTF8;
org.apache.tools.ant.types.Path runtimePath;
org.apache.tools.ant.types.Path excludeFromCopy;
private boolean rebase;
public void CopyLibs();
public void
setRuntimeClassPath(org.apache.tools.ant.types.Path);
public org.apache.tools.ant.types.Path
getRuntimeClassPath();
public void
setExcludeFromCopy(org.apache.tools.ant.types.Path);
public org.apache.tools.ant.types.Path
getExcludeFromCopy();
public boolean isRebase();
public void setRebase(boolean);
public void setEncoding(String);
public void execute() throws
org.apache.tools.ant.BuildException;
private boolean rebase(java.io.File, java.io.File);
privatestatic boolean
isSigned(org.apache.tools.ant.taskdefs.Manifest);
privatestatic void copy(java.io.InputStream,
java.io.OutputStream) throws java.io.IOException;
privatestatic boolean isUTF8(String);
static void <clinit>();
}
org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml
15. 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
37. Must select one file in the IDE or set run.class
Must select one file in the IDE or set run.class
Must select one file in the IDE or set debug.class
38. 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.
Must select one file in the IDE or set profile.class
This target only works when run from inside the NetBeans
IDE.
39. This target only works when run from inside the NetBeans
IDE.
This target only works when run from inside the NetBeans
IDE.
40. Must select one file in the IDE or set run.class
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
43. Some tests failed; see details above.
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
44. 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
Must select one file in the IDE or set applet.url
49. # 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}/CommissionCalculation.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
javac.processorpath=
${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=
53. SalesPerson salesPerson =newSalesPerson();
double sale1 =0,sale2 =0;
double compensation1 =0,compensation2 =0;
String name1,name2;
ArrayList<SalesPerson> array=newArrayList<SalesPerson>();
System.out.print("Enter the number of sales person record : ");
int records = keyInput.nextInt();
for(int i=0;i<records;i++)
{
//prompt the user to enter the annual sales
System.out.print("Enter the Name of Sales Person : ");
String name = keyInput.next();
System.out.print("Enter the annual sales : ");
double sale = keyInput.nextDouble();
salesPerson.setAnnualSales(sale);
//Calculating the Compensation
double totalcompensation=salesPerson.getAnnualCompensation(
);
System.out.println("The total annual compensation : "+totalcom
pensation);
array.add(newSalesPerson(name,sale,totalcompensati
on));
}
System.out.println("ArraySize:"+array.size());
System.out.println("Enter name of first sales person for compari
son:");
name1 = keyInput.next();
for(SalesPerson array1 : array){
if(array1.getName().equalsIgnoreCase(name1))
{
compensation1=array1.getAnnualCompensation();
54. sale1=array1.getAnnualSales();
}
}
System.out.println("Enter name of second sales person for comp
arison:");
name2 = keyInput.next();
for(SalesPerson array1 : array){
if(array1.getName().equalsIgnoreCase(name2))
{
compensation2=array1.getAnnualCompensation();
sale2=array1.getAnnualSales();
}
}
if(sale1>sale2)
{
System.out.println("Compensation Difference:"+(compensation1
-compensation2));
System.out.println(""+name2+" should increase its sale by"+(sal
e1-sale2)+" to earn as much as "+name1+"");
}
elseif(sale1<sale2)
{
System.out.println("Compensation Difference:"+(compensation2
-compensation1));
System.out.println(""+name1+" should increase its sale by"+(sal
e2-sale1)+" to earn as much as "+name2+"");
}
else
System.out.println(""+name1+" earn same as much as "+name2+
"");
}
}
56. //default constructor
publicSalesPerson(){
annualSales =0.0;
}
publicSalesPerson(StringName,double sale,doubleComm){
name=Name;
totalComm=Comm;
annualSales=sale;
}
//parameterized constructor
publicSalesPerson(double aSale){
annualSales = aSale;
}
//getter method for the annual sales
publicdouble getAnnualSales(){
return annualSales;
}
//method to set the value of annual sale
publicvoid setAnnualSales(double aSale){
annualSales = aSale;
}
//method to calculate and get commission
publicdouble getCommission()
{
if(annualSales<(0.80*salesTarget))
{
return0;
}
57. elseif(annualSales>=(0.80*salesTarget)&& annualSales<600000
)
{
return annualSales *(commissionRate/100.0);
}
else
{
int count=0;
for(doubleSales=salesTarget;Sales<=annualSales;Sales+=5000)
{
count=count+1;
}
return(((annualSales)*(commissionRate*Math.pow(1.2,count)))/
100);
}
}
//method to calculate and get annual compensation
publicdouble getAnnualCompensation(){
return fixedSalary + getCommission();
}
}
* To change this license header, choose License Headers in
Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package week4;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.util.Scanner;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
58. import javax.swing.JTable;
/**
*
*
* @author Maricela
*/
public class Week4 {
public Week4 () {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
//Show yearly gross pay
int firstNumber = 1;
int scndNumber = 3;
int fixedSalary = 5000;
System.out.println(fixedSalary + " is the yearly gross pay
of a sales person.");
// Show the fact that a sales person will also earn 14% pay of
any sales.
System.out.println("A sales person will also receive an
additional 2.45% of all sales made for the year.");
// Calculate the total sum of the salary plus the commission
earned plus accelerated rate.
System.out.println("The total of a sales person's earning's for
the year is $" + fixedSalary + ", plus an 2.45 percent
commission on all sales for that year.");
// Way of input by keyboard.
Scanner keyboard = new Scanner(System.in);
// Get the sale's person's annual sales.
double salesAmount; //Amount sold for the year
59. System.out.print("What was your total sales amount? ");
System.out.println(fixedSalary + " is the yearly gross
pay of a sales person.");
// Show the fact that a sales person will also earn 2.45% pay of
any sales.
System.out.println("A sales person will also receive an
additional 2.45% of all sales made for the year.");
// Calculate the total sum of the salary plus the commission
earned.
System.out.println("The total of a sales person's earning's for
the year is $" + fixedSalary + ", plus an 2.45 percent
commission on all sales for that year.");
Scanner keyboard;()
keyboard = new Scanner(System.in);
// Get the sale's person's annual sales.
double salesAmount; //Amount sold for the year
System.out.print("What was your total sales amount? ");
}
public void main args(String[] ) { // Indicate the yearly gross
pay.
int firstNumber = 1;
int secondNumber = 3;
int fixedSalary = 55000;
System.out.println(fixedSalary + " is the yearly gross pay of a
sales person.");
// Show the fact that the current sales target for every
salesperson is $700,000. The sales incentive will only start
when 80% of the sales target is met.
System.out.println("A sales person will also receive an
additional 2.45% of all sales made for the year.");
// Calculate the total sum of the salary plus the commission
earned.
System.out.println("The total of a sales person's earning's for
the year is $" + fixedSalary + ", 2.45 percent commission starts
60. when 80% of the sales target is met.");
// Way of input by keyboard.
Scanner keyboard = new Scanner(System.in);
// Get the sale's person's annual sales.
double salesAmount; //Amount sold for the year
System.out.print("What was your total sales amount? ");
salesAmount = keyboard.nextDouble();
//Example: Sale's Person Response is 165000 in annual sales.
// Calculate the sales incentive earned.
double saleIn; //Total earned ytd.
int spResponse = 700000;
saleIn = (spResponse) * .245;
System.out.println("The total incentive is $" + saleIn);
// Calculate the total income for the year.
int totalAnualComp = 2.45% + 500000;
System.out.println("The total annual compensation is $" +
totalAnualComp );
}
public class table extends JFrame {
JTable table;
public table() {
setLayout (new FlowLayout());
String[] columnNames = {"Total Sales", "Total
Compensation"};
object data = {
/* {"100,000", " Value"},
{"105,000", "Calculated Value"},
{"110,000", "Calculated Value"},
{"115,000", "Calculated Value"},
{"120,000", "Calculated Value"},
{"125,000", "Calculated Value"},
{"130,000", "Calculated Value"},
{"135,000", "Calculated Value"},
{"140,000", "Calculated Value"},
{"145,000", "Calculated Value"},
{"150,000", "Calculated Value"},*/
61. };
table = new JTable(data, columnNames);
table.setPreferredScrollableViewportSize(new Dimension(500,
50));
table.setFillsViewportHeight(true);
JScrollPane scrollpane = new JScrollPane(table);
add(scrollpane);
}
/**
*
* @param args
*/
public void main(String args[]) {
table gui = new table();
gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gui.setSize(400,200);
gui.setVisible(true);
gui.setTitle("Commission Table");
}
}
public class Salesperson {
public static void main(String[] args) {
int count = 0;
int index = 0;
Scanner scan = new Scanner (System.in);
String prompt = ("Enter the salesperson's names: ");
System.out.print ("This program will ask you to enter your
name. Enter the salesperson's names. How many are" + "there");
int amount = scan.nextInt();
String[] name = new String[amount];
String[] secondname = new String[amount];
System.out.print ("You entered" +amount+ "the names of your
salespersons.");
System.out.println ("");
for (index = 0; index < amount; index++)
62. {
System.out.print("Enter next name: ");
name[index] = scan.next();
}
System.out.println ("");
System.out.println ("Then enter salary * commission + 2.45
percent if sales reach 80 pecent of 500,000: ");
System.out.println ("");
for (index = name.length - 1; index >= 0; index--)
{
}
System.out.println ("");
for (String names2 : name)
{
System.out.println (names2+"");
}