Advertisement
Guest User

salesperson

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