<body>
<h1>Простой калькулятор</h1>
<input type="text" id="num1" placeholder="Введите первое число">
<input type="text" id="num2" placeholder="Введите второе число">
<button onclick="addNumbers()">Сложить</button>
<button onclick="subtractNumbers()">Вычесть</button>
<button onclick="multiplyNumbers()">Умножить</button>
<button onclick="divideNumbers()">Разделить</button>
<p id="result"></p>
<script src="calculator.js"></script>
</body>
</html>
Тест
<?php
$num1 = 10;
$num2 = 5;
$sum = $num1 + $num2;
$diff = $num1 — $num2;
$prod = $num1 * $num2;
$quot = $num1 / $num2;
echo «Сумма: » . $sum . «\n»;
echo «Разница: » . $diff . «\n»;
echo «Произведение: » . $prod . «\n»;
echo «Частное: » . $quot . «\n»;
?>
currentLocation = $location;
echo «Current location set to: $location\n»;
}
public function requestRide($destination) {
echo «Requesting a ride to: $destination from location: $this->currentLocation\n»;
}
}
$taxiApp = new TaxiApplication();
$taxiApp->setLocation(‘Your current location’);
$taxiApp->requestRide(‘Your destination’);
?>