Reusability

profilejaego
commissioncalculation2.zip

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.class

                public 
                synchronized 
                class CommissionCalculation {
    
                public void CommissionCalculation();
    
                public 
                static void 
                main(String[]);
}

            

CommissionCalculation/build/classes/SalesPerson.class

                public 
                synchronized 
                class SalesPerson {
    
                private 
                final double 
                fixedSalary;
    
                private 
                final double 
                commissionRate;
    
                private 
                final double 
                salesTarget;
    
                private 
                final 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 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 DESCRIPTION\n\ ========================\n\ \n\ When you build an Java application project that has a main class, the IDE\n\ automatically copies all of the JAR\n\ files on the project's classpath to your project's dist/lib folder. The IDE\n\ also adds each of the JAR files to the Class-Path element in the application\n\ JAR file's manifest file (MANIFEST.MF).\n\ \n\ To run the project from the command line, go to the dist folder and\n\ 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 first\n\ 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 element\n\ specified in the manifest,the content of the Class-Path element has to be on\n\ the project's runtime path.\n\ * To set a main class in a standard Java project, right-click the project node\n\ in the Projects window and choose Properties. Then click Run and enter the\n\ class name in the Main Class field. Alternatively, you can manually type the\n\ class name in the manifest Main-Class element.

org/netbeans/modules/java/j2seproject/copylibstask/CopyFiles.class

                    package org.netbeans.modules.java.j2seproject.copylibstask;

                    public 
                    synchronized 
                    class 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.class

                    package org.netbeans.modules.java.j2seproject.copylibstask;

                    public 
                    synchronized 
                    class CopyLibs 
                    extends org.apache.tools.ant.taskdefs.Jar {
    
                    private 
                    static 
                    final String 
                    LIB = lib;
    
                    private 
                    static 
                    final String 
                    ATTR_CLASS_PATH = Class-Path;
    
                    private 
                    static 
                    final String 
                    MANIFEST = META-INF/MANIFEST.MF;
    
                    private 
                    static 
                    final String 
                    INDEX = META-INF/INDEX.LIST;
    
                    private 
                    static 
                    final String 
                    UTF_8 = UTF-8;
    
                    private 
                    static 
                    final 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);
    
                    private 
                    static boolean 
                    isSigned(org.apache.tools.ant.taskdefs.Manifest);
    
                    private 
                    static void 
                    copy(java.io.InputStream, java.io.OutputStream) 
                    throws java.io.IOException;
    
                    private 
                    static boolean 
                    isUTF8(String);
    
                    static void 
                    <clinit>();
}

                

org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml

CommissionCalculation/lib/nblibraries.properties

libs.CopyLibs.classpath=\ ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar libs.CopyLibs.displayName=CopyLibs Task libs.CopyLibs.prop-version=2.0

CommissionCalculation/manifest.mf

Manifest-Version: 1.0 X-COMMENT: Main-Class will be added automatically by build

CommissionCalculation/nbproject/build-impl.xml

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 Must set javac.includes No tests executed. Must set JVM to use for profiling in profiler.info.jvm Must set profiler agent JVM arguments in profiler.info.jvmargs.agent Must select some files in the IDE or set javac.includes To run this application from the command line without Ant, try: java -jar "${dist.jar.resolved}" 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 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. This target only works when run from inside the NetBeans IDE. This target only works when run from inside the NetBeans IDE. 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 Must select some files in the IDE or set javac.includes 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 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 Must select one file in the IDE or set applet.url

CommissionCalculation/nbproject/genfiles.properties

build.xml.data.CRC32=8683aaba build.xml.script.CRC32=fbd9ff97 [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=8683aaba nbproject/build-impl.xml.script.CRC32=92729e04 nbproject/[email protected]

CommissionCalculation/nbproject/private/private.properties

compile.on.save=true user.properties.file=C:\\Users\\aakash\\AppData\\Roaming\\NetBeans\\8.0\\build.properties

CommissionCalculation/nbproject/private/private.xml

file:/C:/Users/aakash/Documents/NetBeansProjects/CommissionCalculation/src/CommissionCalculation.java file:/C:/Users/aakash/Documents/NetBeansProjects/CommissionCalculation/src/SalesPerson.java

CommissionCalculation/nbproject/project.properties

annotation.processing.enabled=true annotation.processing.enabled.in.editor=false annotation.processing.processor.options= annotation.processing.processors.list= annotation.processing.run.all.processors=true annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output build.classes.dir=${build.dir}/classes build.classes.excludes=**/*.java,**/*.form # This directory is removed when the project is cleaned: build.dir=build build.generated.dir=${build.dir}/generated build.generated.sources.dir=${build.dir}/generated-sources # Only compile against the classpath explicitly listed here: build.sysclasspath=ignore build.test.classes.dir=${build.dir}/test/classes build.test.results.dir=${build.dir}/test/results # Uncomment to specify the preferred debugger connection transport: #debug.transport=dt_socket 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}/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=\ ${javac.classpath}:\ ${build.classes.dir} javac.test.processorpath=\ ${javac.test.classpath} javadoc.additionalparam= javadoc.author=false javadoc.encoding=${source.encoding} javadoc.noindex=false javadoc.nonavbar=false javadoc.notree=false javadoc.private=false javadoc.splitindex=true javadoc.use=true javadoc.version=false javadoc.windowtitle= main.class=commissioncalculation.CommissionCalculation manifest.file=manifest.mf meta.inf.dir=${src.dir}/META-INF mkdist.disabled=false platform.active=default_platform run.classpath=\ ${javac.classpath}:\ ${build.classes.dir} # Space-separated list of JVM arguments used when running the project. # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. # To set system properties for unit tests define test-sys-prop.name=value: run.jvmargs= run.test.classpath=\ ${javac.test.classpath}:\ ${build.test.classes.dir} source.encoding=UTF-8 src.dir=src test.src.dir=test

CommissionCalculation/nbproject/project.xml

org.netbeans.modules.java.j2seproject CommissionCalculation .\lib\nblibraries.properties

CommissionCalculation/src/CommissionCalculation.java

CommissionCalculation/src/CommissionCalculation.java

import  java . text . NumberFormat ;
import  java . util . ArrayList ;
import  java . util . Scanner ;

public   class   CommissionCalculation  
{
     public   static   void  main ( String  args [])
         {
             final   double  salesTarget = 600000 ;
            //create an object of Scanner class to get the keyboard input
             Scanner  keyInput  =   new   Scanner ( System . in );
            //for currency format
             NumberFormat  numberFormat  =   NumberFormat . getCurrencyInstance ();
            //creating an object of SalesPerson class
             SalesPerson  salesPerson  =   new   SalesPerson ();
             double  sale1  =   0 , sale2  =   0 ;
             double  compensation1  =   0 , compensation2  =   0 ;
             String  name1 , name2 ;
             ArrayList < SalesPerson >  array = new   ArrayList < 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 : " + totalcompensation );       
                array . add ( new   SalesPerson ( name , sale , totalcompensation ))   ;
            }
            
             System . out . println ( "ArraySize:" + array . size ());
            
            
            
             System . out . println ( "Enter name of first sales person for comparison:" );
            name1  =   keyInput . next ();
             for   ( SalesPerson  array1  :  array )   {
                 if ( array1 . getName (). equalsIgnoreCase ( name1 ))
                 {
                    compensation1 = array1 . getAnnualCompensation ();
                    sale1 = array1 . getAnnualSales ();
                 }
             }
             System . out . println ( "Enter name of second sales person for comparison:" );
            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" +   ( sale1 - sale2 ) + " to earn as much as " + name1 + "" );
             }
             else   if ( sale1 < sale2 )
             {
                 System . out . println ( "Compensation Difference:"   + ( compensation2 - compensation1 ));
                 System . out . println ( "" + name1 + " should increase its sale by" +   ( sale2 - sale1 ) + " to earn as much as " + name2 + "" );
             }
             else
                 System . out . println ( "" + name1 + " earn same as much as " + name2 + "" );
            
         }
}

CommissionCalculation/src/SalesPerson.java

CommissionCalculation/src/SalesPerson.java


public   class   SalesPerson   {
    
     private   final   double  fixedSalary   =   120000.00 ;
     private   final   double  commissionRate  =   1.2 ;
     private   final   double  salesTarget = 600000 ;
     private   final   double  accelerationfactor = 1.20 ;
     private   String  name ;
     private   double  totalComm ;
     private   double  annualSales ;
     public   SalesPerson  saleperson ;

     public   double  getTotalComm ()   {
         return  totalComm ;
     }

     public   void  setTotalComm ( double  totalComm )   {
         this . totalComm  =  totalComm ;
     }

     public   SalesPerson  getSaleperson ()   {
         return  saleperson ;
     }

     public   void  setSaleperson ( SalesPerson  saleperson )   {
         this . saleperson  =  saleperson ;
     }
       
     public   String  getName ()   {
         return  name ;
     }

     public   void  setName ( String  name )   {
         this . name  =  name ;
     }

     //default constructor
     public   SalesPerson ()   {
        annualSales  =   0.0 ;
     }
    
      public   SalesPerson ( String   Name ,   double  sale , double   Comm )   {
         name = Name ;
         totalComm = Comm ;
         annualSales = sale ;
     }


     //parameterized constructor
     public   SalesPerson ( double  aSale )   {
        annualSales  =  aSale ;
     }
    

     //getter method for the annual sales
     public   double  getAnnualSales (){
         return  annualSales ;
     }

     //method to set the value of annual sale
     public   void  setAnnualSales ( double  aSale )   {
        annualSales  =  aSale ;
     }

     //method to calculate and get commission
     public   double  getCommission ()
     {
         if ( annualSales <   ( 0.80 * salesTarget ))
         {
             return   0 ;
         }
         else   if ( annualSales >=   ( 0.80 * salesTarget )   &&  annualSales <   600000 )
         {  
             return  annualSales  *   ( commissionRate / 100.0 );
         }
         else
         {
           int  count = 0 ;
           for ( double   Sales = salesTarget ; Sales <= annualSales ; Sales += 5000 )
             {
                count = count + 1 ;
             }
             return   ((( annualSales )   * ( commissionRate * Math . pow ( 1.2 , count ))) / 100 );
         }   
     }
    
     //method to calculate and get annual compensation
     public   double  getAnnualCompensation (){
         return  fixedSalary   +  getCommission ();
     }

}