Advertisement
Guest User

Kaizen #1

a guest
May 24th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.11 KB | None | 0 0
  1. class Customer {
  2.  
  3.     public int x;
  4.  
  5.     public double credit;
  6.  
  7.     private String name;
  8.  
  9.     public boolean isOk(){
  10.         // checks to see if the customer is an adult
  11.         if (this.x > 18){
  12.            return true;
  13.         } else {
  14.           return false;
  15.         }
  16.     }
  17.  
  18.     public CustomerToken getCustomerToken(double prop1, double prop2, String general_hash, boolean isSecure, Customer relative, double crxPercentage){
  19.         if(isSecure){
  20.           String customerHash = EncrypUtils.md5(general_hash) + " " + this.name;
  21.           if(relative != null){
  22.             customerHash = customerHash + relative.getCustomerToken();
  23.           }
  24.         } else{
  25.           String customerHash = null;
  26.         }
  27.  
  28.         // if(prop1 > prop2){
  29.         //   double overall = prop1 * 0.50 / relative.credit;
  30.         //   double overallRelative = overall + prop2;
  31.         // }
  32.  
  33.         if(prop1 > prop2 && customerHash != null){
  34.           //calculates how many times prop2 fits into fifty percent of prop1
  35.           double overall = prop1 * 0.25 / prop2;
  36.           if(!this.isOk()){
  37.             double overallRelative = overall + relative.credit;
  38.           }else{
  39.             double overallRelative = overall;
  40.           }
  41.         }
  42.  
  43.  
  44.         return new CustomerToken(customerHash, overallRelative * crxPercentage);
  45.     }
  46.  
  47.     public void calculateCredit(double value, double[] commissions, Customer relative){
  48.       String commissionsString = "";
  49.  
  50.       for(int i = 0; i < commissions.length; i++){
  51.         if(is_defined(credit) == false){
  52.           double credit = 0;
  53.         }else{
  54.           String customerHash = EncrypUtils.md5(general_hash) + " " + this.name;
  55.           if(relative != null){
  56.             customerHash = customerHash + relative.getCustomerToken();
  57.           }
  58.           double credit = (commissions[i] / value) + credit;
  59.           if(customerHash){
  60.             credit = credit + 0.10 * credit;
  61.           }
  62.         }
  63.         commissionsString = commissionsString + " " commissions[i].toString();
  64.       }
  65.       IO.print(commissionsString);
  66.       this.credit = credit;
  67.     }
  68.  
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement