Advertisement
Guest User

salesPerson

a guest
Dec 14th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.99 KB | None | 0 0
  1. package salesperson;
  2.  
  3. /**
  4.  *
  5.  *
  6.  * @author Josue Saldivar
  7.  */
  8. import java.util.Scanner; //allows for user input
  9.  
  10. public class SalesPerson //a class is created called SalesPerson
  11. {
  12.     //main method is created for execution of body
  13.     public static void main(String[] args) {
  14.        
  15.        
  16.         //scanner java class to get user input from console        
  17.         Scanner scnConsole = new Scanner(System.in);
  18.         System.out.println("Please enter your annual sales:");
  19.         String strUserInput = scnConsole.next();
  20.         //String is converted to Double for usability
  21.         Double.parseDouble(strUserInput);
  22.        
  23.         //the users input is stored within annualSales
  24.         double annualSales = Double.parseDouble(strUserInput);
  25.         double totalComp;
  26.         double fixedSalary = 35750;
  27.         double commissionRate = 0.12;
  28.         double commIncRate = .1375;
  29.        
  30.         int i = 0;
  31.         while(i < 1)
  32.         {
  33.             i = i +1;
  34.             if (annualSales >= 125250.00)
  35.             {
  36.                 totalComp = (annualSales * commIncRate) + fixedSalary;
  37.                 System.out.println("You met or exceeded the sales target!");
  38.                 System.out.println("Your commission of $" + totalComp);
  39.                 System.out.println("Has increased 1.25% above original 12%!");
  40.             }
  41.             if (annualSales <= 100199.99)
  42.             {
  43.                 System.out.println("Sorry, you did not earn a commission.");
  44.             }
  45.             if (annualSales < 125250.00 && annualSales >= 100200.00)
  46.             {
  47.                 totalComp = (annualSales * commissionRate) + fixedSalary;
  48.                 System.out.println("Your total compensation is");
  49.                 System.out.println("$" + totalComp);
  50.                 System.out.println("The total of your annual compensation is");
  51.                 System.out.println("Your salary plus 12% of your annual sales.");
  52.             }          
  53.         }            
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement