小说网 找小说 无限小说 烟雨红尘 幻想小说 酷文学 深夜书屋

How Rich Are You in the World?

HOW RICH ARE YOU?

Use the codes below ,you can find where you sit in the  richest people list  in world.

 

 

 

  1. Sub  Showhowrichyouare()
  2. Getit InputBox( "Please  enter your annual income(USD)" "info" , 6000)
  3. End   Sub
  4. Sub  Getit( ByVal  myincome  As   Long 'Input
  5. 'myincome = myincome * 0.145465 ' RMB to USD
  6. Dim  i  As   Long , bindex  As   Long , sumx  As   Double , sumy  As   Double , sumxy  As   Double , sumx2  As   Double
  7. Dim  people, money, slope  As   Double , intb  As   Double , pos, percent, msg  As   String
  8. If  myincome < 100  Then  pos = 5780722892#: percent = 99.9:  GoTo  showmsg
  9. If  myincome > 200000  Then  pos = 107565: percent = 0.001:  GoTo  showmsg
  10. people = Array(0, 600000, 1200000, 3000000, 4500000, 5100000, 5395000, 5700000, 5940000, 5999990)
  11. money = Array(50, 400, 500, 850, 1486.67, 2182.35, 25000, 33700, 47500, 202000)
  12. For  i = 0  To  9
  13. If  myincome < money(i)  Then  bindex = i - 1:  Exit   For
  14. Next
  15. sumx = people(bindex) + people(bindex + 1)
  16. sumy = money(bindex) + money(bindex + 1)
  17. sumxy = people(bindex) * money(bindex) + people(bindex + 1) * money(bindex + 1)
  18. sumx2 = people(bindex) ^ 2 + people(bindex + 1) ^ 2
  19. slope = (2 * sumxy - sumx * sumy) / (2 * sumx2 - sumx ^ 2)
  20. intb = (sumy - slope * sumx) / 2
  21. pos = Round(6000000000# - ((myincome - intb) / slope) * 1000, 0)
  22. percent = Format((pos / 6000000000#) * 100,  "0.00" )
  23. showmsg:
  24. msg =  "Your annual income is $"  & myincome &  " now"  & vbCrLf & vbCrLf
  25. msg = msg &  "You are the "  & pos &  " richest person in the world!"  & vbCrLf & vbCrLf
  26. msg = msg &  "You're in the TOP "  & percent &  "% richest people in the world!"  & vbCrLf & vbCrLf & vbCrLf
  27. msg = msg & Right(Space(200) &  "YOU" , 2 * Round(100 - percent, 0)) & vbCrLf & Right(Space(200) &  "↓" , 2 * Round(100 - percent, 0)) & vbCrLf
  28. msg = msg &  String (100,  "*" ) & vbCrLf
  29. msg = msg &  "<--POOREST------------------------------------THE WHOLE POPULATION OF THE WORLD!--------------------------------RICHEST-->"
  30. MsgBox msg, ,  "How Rich are you?"
  31. End   Sub
  32.     

It returns:

 

 

 

 

About The Source:

 

 

 

HOW RICH ARE YOU?



Every year we gaze enviously at the lists of the richest people in world.
Wondering what it would be like to have that sort of cash. But where
would you sit on one of those lists? Here's your chance to find out.

Just enter your annual income into the box below and hit 'show me the money'

MY ANNUAL INCOME         
 
The information above is from an instring web:  http://www.globalrichlist.com/index.php
 
 
 
  1. /* 
  2. *   Author: Simon Kallgard 
  3. *   Revised by Mattias Gunneras 2005-11-15 
  4. *   Revised by Mattias Gunneras 2006-06-19 
  5. */  
  6. // declare variables 
  7. var  ourpoor; 
  8. var  ourrich; 
  9. var  strInput; 
  10. var  strIncome; 
  11. var  strPlace2; 
  12. var  redman_startpos = 21; 
  13. var  redman_lastpos = 714; 
  14. var  redman_stepsize = 7; 
  15. var  minDollarToCalc = 100; 
  16. var  maxDollarToCalc = 200000; 
  17. // Detect browser 
  18. ns4 = (document.layers)?  true : false  
  19. ns6 = (document.getElementById)?  true : false  
  20. ie4 = (document.all)?  true : false  
  21. // the os 
  22. var  agt = navigator.userAgent.toLowerCase(); 
  23. var  iswin = (agt.indexOf( "win" )!=-1); 
  24. var  ismac = (agt.indexOf( "mac" )!=-1); 
  25. var  isopera = (agt.indexOf( "opera" )!=-1); 
  26. // setup for calculations further down. 
  27. totalPopulation = 6000000000; 
  28. avarageYearlyIncome = 5000; 
  29. totalWorldwideYearlyIncome = totalPopulation * avarageYearlyIncome; 
  30. // Setup relationship between money and population 
  31. peopleBlock =  new  Array(0, 600000, 1200000, 3000000, 4500000, 5100000, 5395000, 5700000, 5940000, 5999990);   // (X axel) 
  32. moneyBlock  =  new  Array(50, 400,    500,     850,     1486.67, 2182.35, 25000,   33700,   47500,   202000);  // (Y axel) 
  33. // returns array with 
  34. //  [0] = SLOPE, m 
  35. //  [1] = y-int, b 
  36. //  [2] = R 
  37. function  calcTrendRSquare (arrX, arrY) { 
  38.     
  39.      var  n = arrX.length;    
  40.      var  sumX = 0; 
  41.      var  sumY = 0; 
  42.      var  sumXY = 0; 
  43.      var  sumX2 = 0; 
  44.      var  sumY2 = 0; 
  45.         
  46.      for  ( var  i = 0; i < arrX.length; i++){ 
  47.         sumX += arrX[i]; 
  48.         sumY += arrY[i]; 
  49.         sumXY += arrX[i] * arrY[i]; 
  50.         sumX2 += Math.pow(arrX[i],2); 
  51.         sumY2 += Math.pow(arrY[i],2); 
  52.     } 
  53.     
  54.      var  sumX2_2 = Math.pow(sumX,2); 
  55.      var  sumY2_2 = Math.pow(sumY,2); 
  56.     
  57.      var  slope_m = (n * sumXY - sumX * sumY) / (n * sumX2 - sumX2_2); 
  58.      var  yInt_b  = (sumY - slope_m * sumX) / n; 
  59.      var  r       = (n * sumXY - sumX * sumY) / Math.sqrt((n * sumX2 - sumX2_2) * (n * sumY2 - sumY2_2)); 
  60.     
  61.      var  returnArray =  new  Array(slope_m, yInt_b, r); 
  62.      return  returnArray; 
  63.                           
  64. function  getPeoplePoorer(bIndex, income) { 
  65.         
  66.          // get the R-square Trend 
  67.          var  people =  new  Array(peopleBlock[bIndex], peopleBlock[bIndex+1]); 
  68.          var  money  =  new  Array(moneyBlock[bIndex], moneyBlock[bIndex+1]); 
  69.         
  70.          var  rSquare = calcTrendRSquare(people, money); 
  71.         
  72.         
  73.          var  peoplePoorer = ((income + (rSquare[1]*-1)) / rSquare[0]) * 1000; 
  74.          return  peoplePoorer; 
  75.         // peoplePoorer = (((strInput*1) - 253.95)/0.0002) * 1000 
  76. }    
  77. arrDidYouKnow =  new  Array(); 
  78. arrDidYouKnow[0] =  "The world's 225 richest people now have a combined wealth of $1 trillion."  
  79. " That's equal to the combined annual income of the world's 2.5 billion poorest people"
  80. arrDidYouKnow[1] =  "Three billion people live on less than $2 per day while 1.3 billion get by on less than"  
  81. " $1 per day. Seventy percent of those living on less than $1 per day are women."
  82. arrDidYouKnow[2] =  "Three decades ago, the people in well-to-do countries were 30 times better off than"  
  83. " those in countries where the poorest 20 percent of the world's people live. By 1998, this gap had"  
  84. " widened to 82 times."
  85. arrDidYouKnow[3] =  "Microsoft CEO Bill Gates has more wealth than the bottom 45 percent of American"  
  86. " households combined."
  87. // open popup window 
  88. function  open_window(qs) { 
  89.     // the width and height 
  90.    width = 400; 
  91.    height = 300; 
  92.     
  93.     //get the top left corner for the popup 
  94.    sx = screen.width/2 - width/2; 
  95.    sy = screen.height/2 - height/2; 
  96.     
  97.     // open the popup window 
  98.    window.open( 'download.php?' +escape(qs), '' , 'width=' +width+ ',height=' +height+',resizable=no,toolbar=0, 
  99. location=0,directories=0,status=0,menubar=0,scrollbars=auto,screenX= '+sx+' ,screenY= '+sy+' ,top= '+sy+' ,left='+sx); 
  100. // if submitted 
  101. function  fnSubmit() { 
  102.     
  103.     // error check 
  104.     if  (document.priceForm.strIn.value ==  "" ) { 
  105.        new  Effect.Shake( 'infield' ); 
  106.       layerWrite( 'error' null 'Please type in your income.' ); 
  107.        return   false
  108.    } else
  109.       layerWrite( 'error' null '' ); 
  110.    } 
  111.     
  112.    ourpoor =  false
  113.    ourrich =  false
  114.     
  115.     // array 
  116.    arrPlace =  new  Array(); 
  117.    strPlace2 =  ""
  118.     
  119.    arrPlaceRicher =  new  Array(); 
  120.    strPlaceRicher2 =  ""
  121.     
  122.     // the input 
  123.    strInput = document.priceForm.strIn.value; 
  124.    currency = document.priceForm.currency.value; 
  125.     
  126.     // remove dots 
  127.    strInput = strInput.replace( "." , "" ); 
  128.    strInput = strInput.replace( "," , "" ); 
  129.    strInput = strInput.replace( " " , "" ); 
  130.    strIncome = strInput.toString(); 
  131.     
  132.    strHourly=(Math.floor((strInput / 1440)* 100)/ 100); 
  133.     // convert currency so we can calculate with us dollars. 
  134.     // currancy rates updated June 20th 2006. source: http://www.di.se 
  135.     if  (currency ==  "uk" ) { 
  136.       strInput = strInput * 1.8412; 
  137.       strCurrency =  "┬г"
  138.    }  else   if  (currency ==  "can" ) { 
  139.       strInput = strInput * 0.8961; 
  140.       strCurrency =  "$"
  141.    }  else   if  (currency ==  "euro" ) { 
  142.       strInput = strInput * 1.257; 
  143.       strCurrency =  "€" ;    
  144.    }  else   if  (currency ==  "jpn" ) { 
  145.       strInput = strInput * 0.008698; 
  146.       strCurrency =  "¥" ;    
  147.    }  else   if  (currency ==  "us" ) { 
  148.       strCurrency =  "$"
  149.    } 
  150.     // validate input    
  151.     if  (isNaN(strInput)) { 
  152.        
  153.        // not valid 
  154.        new  Effect.Shake( 'infield' ); 
  155.       layerWrite( 'error' null 'Please type in your income.' ); 
  156.        
  157.    }  else  { 
  158.       layerWrite( 'error' null '' ); 
  159.        
  160.        
  161.         /* 
  162.       * strPlace is actually how many people that are poorer than you. 
  163.       * calculate place and percent 
  164.       */  
  165.        
  166.        
  167.        
  168.        
  169.          // get the index to play with 
  170.        var  blockIndex = 0; 
  171.          for  ( var  i = 0; i < moneyBlock.length; i++) { 
  172.              if (strInput < moneyBlock[i]){ 
  173.                 blockIndex = i-1; 
  174.                  break
  175.             } 
  176.         } 
  177.        
  178.           
  179.           strPlace = getPeoplePoorer(blockIndex, (strInput * 1)); 
  180.           // convert to string 
  181.          strPlace = strPlace.toString(); 
  182.     
  183.           // get the right digits 
  184.          strPlace = strPlace.substring(0,10); 
  185.           
  186.           // make number again 
  187.          strPlace = (strPlace * 1); 
  188.          strPlace_1 = strPlace; 
  189.          strPlace = 6000000000 - strPlace; 
  190.           
  191.           // calculate percentage    
  192.          strPercentagePoorer = (strPlace / 6000000000) * 100; 
  193.          strPercentagePoorer = Math.floor(strPercentagePoorer * 100) / 100; 
  194.              
  195.           // people richer 
  196.             strPlaceRicher = strPlace; 
  197.              
  198.              // people poorer 
  199.             strPlace = strPlace_1; 
  200.           
  201.           // convert to string again 
  202.          strPlace = strPlace.toString(); 
  203.          strPlaceRicher = strPlaceRicher.toString(); 
  204.          strIncome = strIncome.toString(); 
  205.           
  206.           // for the popupwindow 
  207.          tempPlace = strPlaceRicher; 
  208.           
  209.          strPlace2 = addSpaces(strPlace); 
  210.          strPlaceRicher2 = addSpaces(strPlaceRicher); 
  211.           
  212.           
  213.        if  (strInput <=minDollarToCalc) {  // no output if less than $100 / day 
  214.          ourpoor =  true
  215.          strPercentagePoorer = 1;  
  216.       }  else   if  (strInput >maxDollarToCalc ) {   // no output if more than 200 000 dollars / day 
  217.          ourrich =  true
  218.          strPercentagePoorer = 99; 
  219.       } 
  220.        
  221.        //  calc hour salary 
  222.        var  hourSalary = strInput / 1872; 
  223.           
  224.        
  225.        // set text for the copybox 
  226.        var  copybox =  "<span class='blackheader'>RICHER THAN YOU THINK? </span><br/><br/>"
  227.     
  228.       copybox +=  "How do you feel about that? A bit richer we hope. Richer and ready to give some of"  
  229. " your newly found wealth to those who need it most. It not hard - just slip your hand in your pocket and"  
  230. " pull out something special. Something that can help redress the balance - and also make you feel"  
  231. " uncommonly good. Many peoples lives could be happier if you donated just"
  232.       copybox +=  "<strong> one hour's salary </strong> (approx <strong><span class='red'>$"
  233.  addDecimals(hourSalary, 2) + "</span></strong> - UK estimate).<br/><br/>"
  234.        
  235.       copybox +=  "All you have to do is make a choice.<br/><br/>"
  236.        
  237.       copybox +=  "<strong><span class='red'>$8</span></strong> could buy you 15 organic apples"  
  238. " OR 25 fruit trees for farmers in Honduras to grow and sell fruit at their local market.<br/><br/>"
  239.        
  240.       copybox +=  "<strong><span class='red'>$30</span></strong> could buy you an ER DVD Boxset"  
  241. " OR a First Aid kit for a village in Haiti.<br/><br/>"
  242.        
  243.       copybox +=  "<strong><span class='red'>$73</span></strong> could buy you a new mobile"  
  244. " phone OR a new mobile health clinic to care for AIDS orphans in Uganda.<br/><br/>"
  245.       copybox +=  "<strong><span class='red'>$2400</span></strong> could buy you a second"  
  246. " generation High Definition TV OR schooling for an entire generation of school children in an Angolan"  
  247. " village.<br/><br/>"
  248.        
  249.        
  250.        
  251.        
  252.        
  253.        
  254.        if  (ourpoor ==  true  ) { 
  255.           // if you are poor 
  256.        
  257.           // change copybox copy if poor 
  258.           var  copybox =  "<br><br>"
  259.            copybox +=  ""
  260.          copybox +=  "<strong>Poor countries lose around £1.3 billion everyday as a direct"  
  261. " result of trade policies that put profits before people.</strong><br><br>"
  262.        
  263.          copybox +=  "People whose lives could be dramatically improved or even saved if global"  
  264. " trade rules were made fairer.<br><br>"
  265.          copybox +=  "<strong>By working together - through Make Poverty History we can help"  
  266. " make the difference between poverty and prosperity for millions of people.</strong><br><br>"
  267.          copybox +=  "This is a crucial time to campaign for trade justice. The World Trade"  
  268. " Organisation - one of the main organisations governing international trade - holds its biennial"  
  269. " summit on 13-18 December 2005, in Hong Kong.<br><br>"
  270.     
  271.          strPlaceRicher2 =  "5,780,722,892" ;     
  272.             strPercentagePoorer =  "99.9"
  273.          tempPlace =  "5780722892"
  274.          strPlace2 =  "5,780,722,892"
  275.          currpos = redman_startpos; 
  276.           
  277.       }  else   if  (ourrich ==  true  ) { 
  278.        
  279.           // if you are very rich 
  280.           
  281.          strPlaceRicher2 =  "107,565"
  282.          strPercentagePoorer =  "0.001"
  283.          tempPlace =  "107565"
  284.          strPlace2 =  "107,565"
  285.          currpos = redman_lastpos; 
  286.           
  287.        
  288.       }  else   if  (ourpoor ==  false  && ourrich ==  false ) { 
  289.           // if you are within the acceptable range 
  290.                
  291.                             
  292.           // get the stepnumber 
  293.           var  stepNbr = Math.round(((100 - strPercentagePoorer) * 0.01) * 100); 
  294.           
  295.           // get the pixel pos for arrow redman 
  296.          currpos = Math.round(stepNbr * redman_stepsize) + redman_startpos; 
  297.        
  298.       } 
  299.        
  300.        
  301.        // set DID YOU KNOW?  text 
  302.        var  didyou = arrDidYouKnow[Math.round(Math.random() * 3)]; 
  303.        
  304.        var  downloadlink =  "<a href='download.php?" +tempPlace+ "' onFocus='blur();'>Click here"  
  305. "</a> to download the code you'll need" ;       
  306.        
  307.        var  tmpIncome = addSpaces(strIncome); 
  308.        
  309.        //remove comma if less then 999. 
  310.        if (strIncome <= 999){ 
  311.         tmpIncome = tmpIncome.replace( "," , "" ); 
  312.         }       
  313.        
  314.        // set html for boxes 
  315.        var  nbrRichest1 =  "= " + strPlaceRicher2; 
  316.        var  nbrRichest2 = strPlaceRicher2; 
  317.        var  nbrPercent =  "TOP " + strPercentagePoorer + "%"
  318.        
  319.        
  320.        // dont print infoboxes to page if poor 
  321.        if (!ourpoor){ 
  322.         layerWrite( 'nbrRichest1' null , nbrRichest1); 
  323.         layerWrite( 'nbrRichest2' null , nbrRichest2); 
  324.         layerWrite( 'nbrPercent' null , nbrPercent); 
  325.       } 
  326.        
  327.        
  328.        // main box with lots of copy 
  329.       layerWrite( 'copybox' null , copybox); 
  330.        
  331.        // Did you know 
  332.       layerWrite( 'didyou' null , didyou); 
  333.        
  334.        // link to download page. 
  335.       layerWrite( 'downloadlink' null , downloadlink); 
  336.        
  337.        
  338.        // the little box down on page. 
  339.       layerWrite( 'helpboxrichest' null , strPlaceRicher2); 
  340.        
  341.        // move to right place on line 
  342.        // and shows the resultblock 
  343.           
  344.       fn_move_pos(currpos); 
  345.        
  346.        
  347.    } 
  348. // reverses a string of text 
  349. function  reverse(value) { 
  350.     for  ( var  text =  '' ,i=value.length-1;i>-1;i=i-1){ 
  351.        text += value.charAt(i); 
  352.       } 
  353.   
  354.     return  text; 
  355. function  addDecimals(value, nbrOfDecimals) { 
  356.    value = value.toString(); 
  357.     var  dotIndex = value.lastIndexOf( '.' ); 
  358.     if  (dotIndex < 0){ 
  359.        var  decimal =  ""
  360.        for  (i=0;i<nbrOfDecimals;i++) 
  361.          decimal +=  "0"
  362.    } else
  363.        return  value.substring(0,dotIndex+nbrOfDecimals+1); 
  364.    }          
  365. // display answer 
  366. function  layerWrite(id,nestref,text) { 
  367.     
  368.     if  (ns4) { 
  369.        var  lyr = (nestref)? 
  370.       eval( 'document.' +nestref+ '.document.' +id+ '.document' ) : document.layers[id].document 
  371.       lyr.open() 
  372.       lyr.write(text) 
  373.       lyr.close() 
  374.    } 
  375.     
  376.     if  (ie4) { 
  377.       document.all[id].innerHTML = text; 
  378.    } 
  379.     
  380.     // NS 6 
  381.     if  (ns6) { 
  382.       document.getElementById(id).innerHTML = text; 
  383.    } 
  384. function  addSpaces(str) { 
  385.       
  386.        // reverse the string 
  387.       str = reverse(str); 
  388.           
  389.           // make array 
  390.           for  (i=0; i<str.length; i++) { 
  391.             arrPlace[i] = str.charAt(i); 
  392.           } 
  393.           
  394.           var  str2 =  ""
  395.           // add spaces 
  396.           for  (i=0; i < str.length; i++) { 
  397.              if  ((i == 2) || (i == 5 && (str.length != 6)) || (i == 8 && (str.length != 9))) { 
  398.                str2 = str2 + arrPlace[i] +  ","  
  399.             }  else  { 
  400.                str2 = str2 + arrPlace[i]; 
  401.             } 
  402.          } 
  403.              
  404.           // reverse it back again and return. 
  405.           
  406.       str = reverse(str2); 
  407.           
  408.           return  str; 
  409. // includes the news 
  410. function  fnInclude() { 
  411.     
  412.     if  (ie4) { 
  413.       document.all.news.style.visibility =  'visible'
  414.        if  (iswin) { 
  415.       document.all.news.style.top = 795; 
  416.       }  else  { 
  417.       document.all.news.style.top = 775; 
  418.       } 
  419.      }  else   if  (ns4) { 
  420.       document.news.visibility =  'show'
  421.       document.news.top = 795; 
  422.     }  else   if  (ns6) { 
  423.       document.getElementById( 'news' ).style.visibility =  'visible'
  424.       document.getElementById( 'news' ).style.top = 795; 
  425.    } 
  426. // hides the news 
  427. function  fnIncludeHide() { 
  428.     
  429.     if  (ie4) { 
  430.       document.all.news.style.visibility =  'hidden'
  431.        if  (iswin) { 
  432.       document.all.news.style.top = 795; 
  433.       }  else  { 
  434.       document.all.news.style.top = 775; 
  435.       } 
  436.      }  else   if  (ns4) { 
  437.       document.news.visibility =  'hide'
  438.       document.news.top = 795; 
  439.     }  else   if  (ns6) { 
  440.       document.getElementById( 'news' ).style.visibility =  'hidden'
  441.       document.getElementById( 'news' ).style.top = 795; 
  442.    } 
  443. // moves the position graphic AND shows the resultblock 
  444. function  fn_move_pos(topos) { 
  445.     
  446.     var  nowpos = 0; 
  447.     
  448.     if  (ie4) { 
  449.        nowpos = document.all.redman.style.left; 
  450.       document.all.resultblock.style.display =  'block'
  451.       document.all.resultblock.style.visibility =  'visible'
  452.     }  else   if  (ns4) { 
  453.         nowpos = document.redman.left; 
  454.       document.resultblock.visibility =  'show'
  455.       document.resultblock.display =  'block'
  456.     }  else   if  (ns6) { 
  457.       nowpos = document.getElementById( 'redman' ).style.left; 
  458.       document.getElementById( 'resultblock' ).style.display =  'block'
  459.       document.getElementById( 'resultblock' ).style.visibility =  'visible'
  460.    } 
  461.     
  462.     if (!nowpos){ 
  463.       nowpos = redman_startpos; 
  464.    } else
  465.       nowpos = nowpos.substring(0, nowpos.indexOf( 'p' )); 
  466.    } 
  467.     
  468.     if (ie4 && ismac && !isopera){ 
  469.       document.all.redman.style.left = topos; 
  470.    } else
  471.       endpos = topos - nowpos; 
  472.        new  Effect.ScrollTo( 'resultblock' ,{duration: 1.0}); 
  473.        new  Effect.MoveBy( 'redman' , 0, endpos,{duration: 1.3, queue:  'end' }); 
  474.    } 
  475.     
  476.     return   false
  477.     
  478. function  hide_pos() { 
  479.     if  (ie4) { 
  480.       document.all.arr.style.visibility =  'hidden'
  481.       document.all.line.style.visibility =  'hidden'
  482.    }  else   if  (ns4) { 
  483.       document.arr.visibility =  'hide'
  484.       document.line.visibility =  'hide'
  485.     }  else   if  (ns6) { 
  486.       document.getElementById( 'arr' ).style.visibility =  'hidden'
  487.       document.getElementById( 'line' ).style.visibility =  'hidden'
  488.    } 
  489. function  whatkey() { 
  490.     if  (ie4 || ns6) { 
  491.       thekey = window.event.keyCode; 
  492.              
  493.        if  (thekey == 13 && iswin) { 
  494.          fnSubmit(); 
  495.       } 
  496.    } 

posted on 2008-12-08 20:18  王峰炬  阅读(252)  评论(0编辑  收藏  举报

导航