コード例 #1
0
ファイル: geography.php プロジェクト: kevinqi34/AP-Calculator
<?php

include '../Template/Swiki.php';
$calculator = new calculator();
$title = "IB Geography HL/SL";
$keywords = "IB Geography, Geography, Geography SL, Geography HL, IB score, IB Calculator, IB tests, college prep, IB courses, IB Exam, IB prep";
$js = "../js/ibgeography.js";
$css = "../css/styleib.css";
$affiliate = '<iframe style="width:120px;height:240px;margin-left:calc(50% - 60px);margin-top:150px;" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src="//ws-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&OneJS=1&Operation=GetAdHtml&MarketPlace=US&source=ac&ref=tf_til&ad_type=product_link&tracking_id=spere-10-20&marketplace=amazon&region=US&placement=0198389159&asins=0198389159&linkId=3HKJTD5BFVPIDHI7&show_border=true&link_opens_in_new_window=true"></iframe>';
$content = '
<h2>Geography HL/SL<img src="../images/Globe.png" alt="Globe"></h2>

<div id="calculator">

		<div class="calculate">
			<h3>Enter your scores below</h3>
			<p>Choose a strand</p>
				<p><input onchange="changediv();" type="radio" name="strand" id="sl" onclick="calculate2()" /checked>SL<input onchange="changediv();" style="margin-left: 30px;" type="radio" name="strand" id="hl" onclick="calculate()">HL</p>

		</div>

	<div id="calculate">




			<p><label>Paper 1 Score</label></p>
				<p><input type="range" id="P1" min="0" step="1" max="50" onmouseup="slidervalue(\'P1\',\'P11\'), calculate();" ontouchend="slidervalue(\'P1\',\'P11\'), calculate();"/><input type="number" min="0" max="50" step="1" id="P11" value="25" style="width: 40px;" onchange="slidervalue(\'P11\',\'P1\'), calculate();"/>/50</p>
			<p><label>Paper 2 Score</label></p>
				<p><input type="range" id="P2" min="0" step="1" max="80" onmouseup="slidervalue(\'P2\',\'P22\'), calculate();" ontouchend="slidervalue(\'P2\',\'P22\'), calculate();"/><input type="number" min="0" max="80" step="1" id="P22" value="40" style="width: 40px;" onchange="slidervalue(\'P22\',\'P2\'), calculate();"/>/80</p>
			<p><label>Internal Score</label></p>
コード例 #2
0
ファイル: BAPWD-oop.php プロジェクト: ImtiH/BAPWD
<?php 
require_once 'product-oop.php';
$name = new product3();
echo $name->type;
?>


<br>


<?php 
require_once 'product-oop.php';
$name = new product4();
//echo $name -> type;  // kaj korbena.
echo $name->getProductType();
// kaj korbe.
?>

<br>
<?php 
require_once 'calculator-oop.php';
$calc = new calculator();
$calc->add(5 + 10);
$calc->add(20);
$calc->subtract(5);
// output will be : 35-5 = 30
echo $calc->getTotal();
?>

コード例 #3
0
ファイル: calculator.php プロジェクト: iwillnever/wind
    var $dec;
    var $multi;
    var $chu;
    function __construct($a, $b)
    {
        $this->num1 = $a;
        $this->num2 = $b;
        $this->add = $a + $b;
        $this->dec = $a - $b;
        $this->multi = $a * $b;
        $this->chu = $a / $b;
    }
    function calculate()
    {
        $num1 = $this->num1;
        $num2 = $this->num2;
        $add = $this->add;
        $multi = $this->multi;
        $dec = $this->dec;
        $chu = $this->chu;
        echo "{$num1} + {$num2} = {$add}" . "<br>";
        echo "{$num1} - {$num2} = {$dec}" . "<br>";
        echo "{$num1} * {$num2} = {$multi}" . "<br>";
        echo "{$num1} / {$num2} = {$chu}" . "<br>";
    }
}
$gr = new calculator(333, 777);
$gr->calculate();
?>

コード例 #4
0
ファイル: calculator.php プロジェクト: Readmea/homework
        $array_num = $this->array_num;
        switch ($op) {
            case '+':
                $this->result = $array_num[0] + $array_num[1];
                echo "result = " . $this->result . "</br>";
                break;
            case '/':
                if ($array_num[1] == 0) {
                    die("除数不能为0!") . "</br>";
                } else {
                    $this->result = (double) $array_num[0] / $array_num[1];
                    echo "result = " . $this->result . "</br>";
                }
                break;
            case '*':
                $this->result = $array_num[0] * $array_num[1];
                echo "result = " . $this->result . "</br>";
                break;
            case '-':
                $this->result = $array_num[0] - $array_num[1];
                echo "result = " . $this->result . "</br>";
                break;
            default:
                die("未知错误");
                break;
        }
    }
}
$str_get = $_POST['num'];
$calculator1 = new calculator("{$str_get}");
$calculator1->option($calculator1->op);
コード例 #5
0
ファイル: GPA.php プロジェクト: kevinqi34/AP-Calculator
<?php

include '../Template/Swiki.php';
$calculator = new calculator();
$title = "GPA Calculator";
$keywords = "GPA, grade point average, grade point, grade pt avg, gpa calculator, GPA calculation, weighted gpa calculator, weighted GPA, GPA calc";
$js = "../js/GPAcalculator.js";
$css = "../css/style.css";
$content = '

<h2>GPA Calculator<img src="../images/GPA.png" alt="GPA"></h2>

<div id="calculator">



		<h2>Scale:
			<select id="selection" onchange="switchdivs();">
			<option value="4pt">4 Point</option>
			<option value="5pt">5 Point</option>
			<option value="plusminus">4 Point with Plus/Minus</option>
			</select>
		</h2>







		<div id="4pt" style="display: block;" class="calculate">
コード例 #6
0
ファイル: data.php プロジェクト: panelo/PHP-CSV-Calculator
<?php

function __autoload($class)
{
    include_once $class . ".php";
}
try {
    $calc = new calculator();
    echo "Mean:" . $calc->getMean() . "\n";
    echo "Median:" . $calc->getMedian() . "\n";
    echo "Mode:" . $calc->getMode() . "\n";
    echo "Standard Deviation:" . $calc->getSD() . "\n";
} catch (Exception $e) {
    echo $e->getMessage() . "\n";
}
コード例 #7
0
ファイル: class.php プロジェクト: rafajc/vagrant-silex
<?php

class calculator
{
    public function sum($x, $y)
    {
        return $x + $y;
    }
    public function mul($x, $y)
    {
        return $x * $y;
    }
    public function fak($n)
    {
        if ($n == 0) {
            return 1;
        }
        return $this->fak($n - 1) * $n;
    }
}
//--------------------------------------------
//--------------------------------------------
//--------------------------------------------
$calc = new calculator();
for ($i = 0; $i < 10; $i++) {
    echo "{$i} + {$i} = " . $calc->sum($i, $i) . "<br>";
    echo "{$i} * {$i} = " . $calc->mul($i, $i) . "<br>";
    echo "{$i}! = " . $calc->fak($i) . "<br>";
    echo "<hr>";
}
コード例 #8
0
ファイル: calu.php プロジェクト: swtsurrender213/assignments
    public function __construct($num1, $num2)
    {
        $this->num1 = $num1;
        $this->num2 = $num2;
    }
    public function add()
    {
        return $this->num1 + $this->num2;
    }
    public function subtract()
    {
        return $this->num1 - $this->num2;
    }
    public function multiply()
    {
        return $this->num1 * $this->num2;
    }
    public function divide()
    {
        return $this->num1 / $this->num2;
    }
}
// end of class
$calc = new calculator(3, 4);
echo "<p>3 + 4 = " . $calc->add() . "</p>";
$calc = new calculator(15, 12);
echo "<p>15 - 12 = " . $calc->subtract() . "</p>";
$calc = new calculator(20, 2);
echo "<p> 20 * 2 = " . $calc->multiply() . "</p>";
$calc = new calculator(20, 8);
echo "<p> 20 / 2 = " . $calc->divide() . "</p>";
コード例 #9
0
ファイル: main.php プロジェクト: K018359/gittot1
<?php

require_once "calculator.php";
$calculator = new calculator();
$calculator->add(1, 2);
$calculator->showresult();
コード例 #10
0
ファイル: main.php プロジェクト: YYangY/test1
    public $a;
    public $b;
    public $c;
    function __construct($num1, $num2)
    {
        $this->a = $num1;
        $this->b = $num2;
    }
    function add()
    {
        $this->c = $this->a + $this->b;
        echo $this->c;
    }
    function substract()
    {
        $this->c = $this->a - $this->b;
        echo $this->c;
    }
}
$num1 = $_POST["num1"];
$num2 = $_POST["num2"];
$p = new calculator($num1, $num2);
$oper = $_POST["oper"];
switch ($oper) {
    case "+":
        $p->add();
        break;
    case "-":
        $p->substract();
        break;
}
コード例 #11
0
ファイル: calculated.php プロジェクト: evltuma/moodle
 /**
  * @param $course
  * @param $cm
  * @param $quiz
  * @return array to display in table or spreadsheet.
  */
 public function get_formatted_quiz_info_data($course, $cm, $quiz)
 {
     // You can edit this array to control which statistics are displayed.
     $todisplay = array('firstattemptscount' => 'number', 'allattemptscount' => 'number', 'firstattemptsavg' => 'summarks_as_percentage', 'allattemptsavg' => 'summarks_as_percentage', 'lastattemptsavg' => 'summarks_as_percentage', 'highestattemptsavg' => 'summarks_as_percentage', 'median' => 'summarks_as_percentage', 'standarddeviation' => 'summarks_as_percentage', 'skewness' => 'number_format', 'kurtosis' => 'number_format', 'cic' => 'number_format_percent', 'errorratio' => 'number_format_percent', 'standarderror' => 'summarks_as_percentage');
     // General information about the quiz.
     $quizinfo = array();
     $quizinfo[get_string('quizname', 'quiz_statistics')] = format_string($quiz->name);
     $quizinfo[get_string('coursename', 'quiz_statistics')] = format_string($course->fullname);
     if ($cm->idnumber) {
         $quizinfo[get_string('idnumbermod')] = $cm->idnumber;
     }
     if ($quiz->timeopen) {
         $quizinfo[get_string('quizopen', 'quiz')] = userdate($quiz->timeopen);
     }
     if ($quiz->timeclose) {
         $quizinfo[get_string('quizclose', 'quiz')] = userdate($quiz->timeclose);
     }
     if ($quiz->timeopen && $quiz->timeclose) {
         $quizinfo[get_string('duration', 'quiz_statistics')] = format_time($quiz->timeclose - $quiz->timeopen);
     }
     // The statistics.
     foreach ($todisplay as $property => $format) {
         if (!isset($this->{$property}) || !$format) {
             continue;
         }
         $value = $this->{$property};
         switch ($format) {
             case 'summarks_as_percentage':
                 $formattedvalue = quiz_report_scale_summarks_as_percentage($value, $quiz);
                 break;
             case 'number_format_percent':
                 $formattedvalue = quiz_format_grade($quiz, $value) . '%';
                 break;
             case 'number_format':
                 // 2 extra decimal places, since not a percentage,
                 // and we want the same number of sig figs.
                 $formattedvalue = format_float($value, $quiz->decimalpoints + 2);
                 break;
             case 'number':
                 $formattedvalue = $value + 0;
                 break;
             default:
                 $formattedvalue = $value;
         }
         $quizinfo[get_string($property, 'quiz_statistics', calculator::using_attempts_lang_string($this->whichattempts))] = $formattedvalue;
     }
     return $quizinfo;
 }
コード例 #12
0
<?php

require 'class.calculator.php';
$calculator = new calculator();
$calculator->num1 = 10.5;
$calculator->num2 = 4.5;
echo "Welcome to our simple calculator class";
echo "<br>";
echo "The addition between " . $calculator->num1 . " and " . $calculator->num2 . " is " . $calculator->add();
echo "<br>";
echo "The subtraction  between " . $calculator->num1 . " and " . $calculator->num2 . " is " . $calculator->subtract();
echo "<br>";
echo "The multiplication  between " . $calculator->num1 . " and " . $calculator->num2 . " is " . $calculator->multiply();
echo "<br>";
echo "The division  between " . $calculator->num1 . " and " . $calculator->num2 . " is " . $calculator->divide();
コード例 #13
0
ファイル: test.class.php プロジェクト: ChuckleLiu/WEB
<?php

class calculator
{
    public $a;
    public $b;
    public $c;
    public $d;
    public $y;
    public $z;
    function plus($a, $b, $c, $d)
    {
        $y = $a + $b;
        $z = $c + $d;
        echo $z;
    }
    function minus($a, $b)
    {
        $y = $a + $b;
        $z = $c + $d;
        echo $z;
    }
}
$obj = new calculator();
$obj->plus(1, 2, 3, 4);
$obj->minus(9, 8, 7, 6);
コード例 #14
0
ファイル: view.php プロジェクト: akandshuvo/htdocs_basis_seip
<?php

require_once './calculator.php';
$obj = new calculator();
echo '<pre>';
print_r($_POST);
$first = $_POST['first-number'];
$second = $_POST['second-number'];
$button = $_POST['btn'];
if ($button == 'add') {
    $add = $obj->add($first, $second);
}
if ($button == 'sub') {
    $add = $obj->sub($first, $second);
}
if ($button == 'mul') {
    $add = $obj->mul($first, $second);
}
if ($button == 'div') {
    $add = $obj->div($first, $second);
}
if ($button == 'mod') {
    $add = $obj->mod($first, $second);
}
?>


<html>
    <head>
        <title>Calculator</title>
    </head>
コード例 #15
0
ファイル: 222.php プロジェクト: YYangY/homework11
    function multiply()
    {
        echo "计算结果是:" . $this->a * $this->b;
    }
    function divide()
    {
        if ($this->b == 0) {
            echo "计算结果是:wrong";
        } else {
            echo "计算结果是:" . $this->a / $this->b;
        }
    }
}
$num1 = $_POST["num1"];
$num2 = $_POST["num2"];
$p = new calculator($num1, $num2);
$oper = $_POST["oper"];
switch ($oper) {
    case "+":
        $p->add();
        break;
    case "-":
        $p->substract();
        break;
    case "*":
        $p->multiply();
        break;
    case "/":
        $p->divide();
        break;
}
コード例 #16
0
                break;
            case '/':
                return $this->a / $this->b;
                break;
            default:
                return "Please Select One Operation...";
        }
    }
    function getresult($a, $b, $c)
    {
        $this->a = $a;
        $this->b = $b;
        return $this->checkoperation($c);
    }
}
$calculator = new calculator();
if (isset($_POST['submit'])) {
    $answer = $calculator->getresult($_POST['number1'], $_POST['number2'], $_POST['operator']);
}
?>

<form method="post">
<table align="center">
    <tr>
        <td><strong>Result :<?php 
echo $answer;
?>
<strong></td>
    </tr>
    <tr>
        <td>Enter 1st Number</td>