Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Customer {
- public int x;
- public double credit;
- private String name;
- public boolean isOk(){
- // checks to see if the customer is an adult
- if (this.x > 18){
- return true;
- } else {
- return false;
- }
- }
- public CustomerToken getCustomerToken(double prop1, double prop2, String general_hash, boolean isSecure, Customer relative, double crxPercentage){
- if(isSecure){
- String customerHash = EncrypUtils.md5(general_hash) + " " + this.name;
- if(relative != null){
- customerHash = customerHash + relative.getCustomerToken();
- }
- } else{
- String customerHash = null;
- }
- // if(prop1 > prop2){
- // double overall = prop1 * 0.50 / relative.credit;
- // double overallRelative = overall + prop2;
- // }
- if(prop1 > prop2 && customerHash != null){
- //calculates how many times prop2 fits into fifty percent of prop1
- double overall = prop1 * 0.25 / prop2;
- if(!this.isOk()){
- double overallRelative = overall + relative.credit;
- }else{
- double overallRelative = overall;
- }
- }
- return new CustomerToken(customerHash, overallRelative * crxPercentage);
- }
- public void calculateCredit(double value, double[] commissions, Customer relative){
- String commissionsString = "";
- for(int i = 0; i < commissions.length; i++){
- if(is_defined(credit) == false){
- double credit = 0;
- }else{
- String customerHash = EncrypUtils.md5(general_hash) + " " + this.name;
- if(relative != null){
- customerHash = customerHash + relative.getCustomerToken();
- }
- double credit = (commissions[i] / value) + credit;
- if(customerHash){
- credit = credit + 0.10 * credit;
- }
- }
- commissionsString = commissionsString + " " commissions[i].toString();
- }
- IO.print(commissionsString);
- this.credit = credit;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement