Program: 173745
Project: 173745
Buggy source:
/** 
 * Float a company, including a default implementation of moving cash and shares as a result of flotation. <p>Full capitalisation is implemented as in 1830. Partial capitalisation is implemented as in 1851. Other ways to process the consequences of company flotation must be handled in game-specific subclasses.
 */
protected void floatCompany(PublicCompanyI company){
  int unsoldPercentage=company.getUnsoldPercentage();
  int cash=0;
  int capitalisationMode=company.getCapitalisation();
  if (company.hasStockPrice()) {
    int capFactor=0;
    int shareUnit=company.getShareUnit();
    if (capitalisationMode == PublicCompanyI.CAPITALISE_FULL) {
      capFactor=100 / shareUnit;
    }
 else     if (capitalisationMode == PublicCompanyI.CAPITALISE_INCREMENTAL) {
      capFactor=(100 - unsoldPercentage) / shareUnit;
    }
 else     if (capitalisationMode == PublicCompanyI.CAPITALISE_WHEN_BOUGHT) {
      capFactor=0;
    }
    int price=company.getIPOPrice();
    cash=capFactor * price;
  }
 else {
    cash=company.getFixedPrice();
  }
  cash-=company.getBaseTokensBuyCost();
  company.setFloated();
  if (cash > 0) {
    new CashMove(bank,company,cash);
    ReportBuffer.add(LocalText.getText("String_Node_Str",company.getName(),Bank.format(cash)));
  }
 else {
    ReportBuffer.add(LocalText.getText("String_Node_Str",company.getName()));
  }
  if (capitalisationMode == PublicCompanyI.CAPITALISE_INCREMENTAL && company.canHoldOwnShares()) {
    List<Certificate> moving=new ArrayList<Certificate>();
    for (    Certificate ipoCert : ipo.getCertificatesPerCompany(company.getName())) {
      moving.add(ipoCert);
    }
    for (    Certificate ipoCert : moving) {
      ipoCert.moveTo(company.getPortfolio());
    }
  }
}

Fixed version (ground truth):
/** 
 * Float a company, including a default implementation of moving cash and shares as a result of flotation. <p>Full capitalisation is implemented as in 1830. Partial capitalisation is implemented as in 1851. Other ways to process the consequences of company flotation must be handled in game-specific subclasses.
 */
protected void floatCompany(PublicCompanyI company){
  int soldPercentage=getSoldPercentage(company);
  int cash=0;
  int capitalisationMode=company.getCapitalisation();
  if (company.hasStockPrice()) {
    int capFactor=0;
    int shareUnit=company.getShareUnit();
    if (capitalisationMode == PublicCompanyI.CAPITALISE_FULL) {
      capFactor=100 / shareUnit;
    }
 else     if (capitalisationMode == PublicCompanyI.CAPITALISE_INCREMENTAL) {
      capFactor=soldPercentage / shareUnit;
    }
 else     if (capitalisationMode == PublicCompanyI.CAPITALISE_WHEN_BOUGHT) {
      capFactor=0;
    }
    int price=company.getIPOPrice();
    cash=capFactor * price;
  }
 else {
    cash=company.getFixedPrice();
  }
  cash-=company.getBaseTokensBuyCost();
  company.setFloated();
  if (cash > 0) {
    new CashMove(bank,company,cash);
    ReportBuffer.add(LocalText.getText("String_Node_Str",company.getName(),Bank.format(cash)));
  }
 else {
    ReportBuffer.add(LocalText.getText("String_Node_Str",company.getName()));
  }
  if (capitalisationMode == PublicCompanyI.CAPITALISE_INCREMENTAL && company.canHoldOwnShares()) {
    List<Certificate> moving=new ArrayList<Certificate>();
    for (    Certificate ipoCert : ipo.getCertificatesPerCompany(company.getName())) {
      moving.add(ipoCert);
    }
    for (    Certificate ipoCert : moving) {
      ipoCert.moveTo(company.getPortfolio());
    }
  }
}