Java Assignment and 3 page paper for Jaque

profilejohndoe74
student_b_-_week_4.zip

LockmanCommission.java

LockmanCommission.java

import  java . util . Scanner ;   //Imports the scanner utility which we will use for
                           //user input.

import  java . text . DecimalFormat ;   //Imports the formatting for decimal.

/**
 * This program calculates an employee's Annual Compensation for
 * Lockman Computer Sales.
 */

public   class   LockmanCommission   {
    
     public   static   void  main ( String [] args )
     {
         double   Annual ;   //This will hold the amount of annual sales given
         double   Annual2 ;
         double   Total ;
         double   Difference ;
         Difference   =   0 ;
        
      DecimalFormat  dollar  =   new   DecimalFormat ( "#,##0.00" );   //Decimal formatting.
    
     final   int  NUM_EMPLOYEES  =   2 ;   //Number of employees.
    
     double []   Sales   =   new   double [ NUM_EMPLOYEES ];
    
     Scanner  keyboard  =   new   Scanner ( System . in );
    
     //////////////////////////////////////////////////
     String   Employee1 ;
     System . out . println  ( "----------------------------" );
     System . out . print ( "Please enter employee LAST NAME ONLY: " );
     Employee1   =  keyboard . next ();
    
     System . out . print ( "Please enter Annual Sales : $" );  
     Annual   =  keyboard . nextDouble ();
            
     SalesCommission   Final   =
            new   SalesCommission ( Annual );   //Creating a new instance of our class.
           
     System . out . println ( Employee1 );
    
        
     System . out . println  ( "Total Compensation $"   //Printing to the user.
           +  dollar . format ( Final . getTotal ()));   //Formatting and calling the
              Sales [ 0 ]   =   Final . getTotal ();
     System . out . println  ( "----------------------------" );
                    
             
     //////////////////////////////////////////////////
     String   Employee2 ;
     System . out . println  ( "----------------------------" );
     System . out . print ( "Please enter employee LAST NAME ONLY: " );
     Employee2   =  keyboard . next ();
    
     System . out . print ( "Please enter Annual Sales : $" );  
     Annual2   =  keyboard . nextDouble ();
            
     SalesCommission   Final2   =
            new   SalesCommission ( Annual2 );   //Creating a new instance of our class.
           
     System . out . println ( Employee2 );
    
        
     System . out . println  ( "Total Compensation $"   //Printing to the user.
           +  dollar . format ( Final2 . getTotal ()));   //Formatting and calling the
              Sales [ 1 ]   =   Final2 . getTotal ();  
     System . out . println  ( "----------------------------" );
             
     ///////////////////////////////////////////////////
             
      if   ( Sales [ 0 ]   >   Sales [ 1 ]){
          Difference   =   (( Annual   -   Annual2 )   +   1 );
      System . out . println  ( "----------------------------" );
      System . out . println  ( Employee2 );
      System . out . println  (( "You needed $"   +  dollar . format ( Difference )));
      System . out . println  ( "to exceed" );
      System . out . println  ( Employee1 );
      System . out . println  ( "----------------------------" );}
     
     
      if   ( Sales [ 0 ]   <   Sales [ 1 ]){
          Difference   =   (( Annual2   -   Annual )   +   1 );
      System . out . println  ( "----------------------------" );
      System . out . println  ( Employee1 );
      System . out . println  (( "You needed $"   +  dollar . format ( Difference )));
      System . out . println  ( "to exceed" );
      System . out . println  ( Employee2 );
      System . out . println  ( "----------------------------" );}
         
    
     }
    
}

SalesCommission.java

SalesCommission.java

/**
 * Week 3 Individual - Simple Commission Calculation Program Part I
 * PRG/420
 * Liwei Jiang
 * by Travis Lockman
 * travislockman @email .phoenix.edu
 * 8/9/2014
 */


/**
 * This class computes the Total Annual Compensation for an employee
 * based on salary, commission rate, and annual sales with new incentive.
 * It also presents the employee with a table showing potential commission.
 */



public   class   SalesCommission   {    //Declaring my class name.

    private   double   Salary ,   //Salary of employee.
                   Commission ,   //Commission rate of employee.
                   Annual ,   //Annual Sales.
                   Total ;   //Total yearly compensation.
                  
                 
                  
   
   
    private   void  setSalary ()   //Setting the Salary as a static value.
    {
        Salary   =   120000 ;
    }
   
    private   void  setCommission ()   //Setting the Commission as a static value.
    {
        Commission   =   .06 ;
    }
   
                  
    /**
    * From what I understand, this allows me to call the Annual
    * variable in the next file.
    */
    public   SalesCommission ( double  A )
    {
        Annual   =  A ;
       calculateTotal ();   //Declares my method name.
       
    }
   
    private   void  calculateTotal ()   //Defines my method,  Calculation.
    {
       setSalary ();
       setCommission ();
       
        if   ( Annual   <   400000 )   //If statements have been added to perform new calculations.
            Total   =   Salary ;
           
       
        if   (( Annual   >   400000 )   &&   ( Annual   <=   500000 ))
            Total   =   Salary   +   ( Commission * Annual );
           
       
        if   ( Annual   >   500000 )
            Total   =   Salary   +   (( Commission * 1.25 ) * ( Annual ));
           
    }
   
    public   double  getTotal ()   //Declaring the getTotal method.
    {
        return   Total ;   //Instructing the machine to output the value for Total.
    }
   
   
   
}

Success.jpg