PHP Classes

File: sample.php

Recommend this page to a friend!
  Classes of Axel Strembel   Queue Theory   sample.php   Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: Sample
Class: Queue Theory
Calculate several queue theory factors
Author: By
Last change: comments
Date: 18 years ago
Size: 2,971 bytes
 

Contents

Class file image Download
<form name="form1" method="post" action="">
  <table border="0" align="center" cellpadding="2" cellspacing="2">
    <tr>
      <td><div align="right">&lambda;</div></td>
      <td><input name="lam" type="text" id="lam" size="3" value="<?=$_POST['lam']?>"></td>
    </tr>
    <tr>
      <td><div align="right">&mu;</div></td>
      <td><input name="mu" type="text" id="mu" size="3" value="<?=$_POST['mu']?>"></td>
    </tr>
    <tr>
      <td><div align="right">c</div></td>
      <td><input name="c" type="text" id="c" size="3" value="<?=$_POST['c']?>"></td>
    </tr>
    <tr>
      <td><div align="right">n</div></td>
      <td><input name="n" type="text" id="n" size="3" value="<?=$_POST['n']?>"></td>
    </tr>
    <tr>
      <td colspan="2"><input type="submit" name="Submit" value="Calcular"></td>
    </tr>
  </table>
</form>
<table border="0" align="center" cellpadding="2" cellspacing="2">
  <tr>
    <td><p>
  <?
   
include('Colas.class.php');
    if(isset(
$_POST['lam']) && isset($_POST['lam']) && $_POST['lam'] != '' && $_POST['mu'] != '' )
    {
        if (!
$_POST['c']) $_POST['c'] = 1;
        echo
'<h2>(M/M/1):(FIFO/&infin;/&infin;)</h2>';
       
       
// Instance of the class using MM1
       
$colita = new ColaMM1($_POST['lam'],$_POST['mu']);
        echo(
'&lambda; -> ' . $colita->Lambda() . '<br>');
        echo(
'&mu; -> ' . $colita->_Mu . '<br>');
        echo(
'&rho; -> ' . $colita->Rho(). '<br>');
        echo(
'P0 -> ' . $colita->P0() . '<br>');
        echo(
'P'. $_POST['n'] .' -> ' . $colita->Pn($_POST['n']) . '<br>');
        echo(
'Ls -> ' . $colita->Ls() . '<br>');
        echo(
'Lq -> ' . $colita->Lq() . '<br>');
        echo(
'Ws -> ' . $colita->Ws() . '<br>');
        echo(
'Wq -> ' . $colita->Wq() . '<br>');
   
        echo
'<h2>(M/M/2):(FIFO/&infin;/&infin;)</h2>';
       
       
// Instance of the class using MM2
       
$colita = new ColaMM2($_POST['lam'],$_POST['mu']);
        echo(
'&lambda; -> ' . $colita->Lambda() . '<br>');
        echo(
'&mu; -> ' . $colita->_Mu . '<br>');
        echo(
'&rho; -> ' . $colita->Rho(). '<br>');
        echo(
'P0 -> ' . $colita->P0() . '<br>');
        echo(
'P'. $_POST['n'] .' -> ' . $colita->Pn($_POST['n']) . '<br>');
        echo(
'Ls -> ' . $colita->Ls() . '<br>');
        echo(
'Lq -> ' . $colita->Lq() . '<br>');
        echo(
'Ws -> ' . $colita->Ws() . '<br>');
        echo(
'Wq -> ' . $colita->Wq() . '<br>');
   
        echo
'<h2>(M/M/C):(FIFO/&infin;/&infin;)</h2>';
       
       
// Instance of the class using MM1
       
$colita = new ColaMMC($_POST['lam'],$_POST['mu'], $_POST['c']);
        echo(
'&lambda; -> ' . $colita->Lambda() . '<br>');
        echo(
'&mu; -> ' . $colita->_Mu . '<br>');
        echo(
'c -> ' . $colita->_c . '<br>');
        echo(
'&rho; -> ' . $colita->Rho(). '<br>');
        echo(
'P0 -> ' . $colita->P0() . '<br>');
        echo(
'P'. $_POST['n'] .' -> ' . $colita->Pn($_POST['n']) . '<br>');
        echo(
'Ls -> ' . $colita->Ls() . '<br>');
        echo(
'Lq -> ' . $colita->Lq() . '<br>');
        echo(
'Ws -> ' . $colita->Ws() . '<br>');
        echo(
'Wq -> ' . $colita->Wq() . '<br>');
    }
?>
</p>
</td>
  </tr>
</table>