Learn Computer Programming Free from our source codes in my website.
Sponsored Link Please Support
https://www.techseries.dev/a/27966/qWm8FwLb
https://www.techseries.dev/a/19181/qWm8FwLb
My Personal Website is http://www.jakerpomperada.com
Email me at jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Thursday, May 9, 2024
Wednesday, May 8, 2024
Tuesday, May 7, 2024
Monday, May 6, 2024
Saturday, May 4, 2024
Thursday, May 2, 2024
Wednesday, May 1, 2024
What is a Bit in Computing?
What is a Bit in Computing?
A bit (binary digit) is the smallest unit of data that a computer can process and store.
A bit is always in one of two physical states, similar to an on/off light switch.
The state is represented by a single binary value, usually a 0 or 1.
However, the state might also be represented by yes/no, on/off or true/false.
Sunday, April 28, 2024
Multiply Two Numbers Using a Class in PHP
<?php
// Multiplier.php
// Author : Dr. Jake Rodriguez Pomperada, MAED-IT, MIT, PHD-TM
// Date : April 26, 2024 1:54 PM Friday
// Tools : Microsoft Visual Studio
// PHP 8.1.3
// Website : http://www.jakerpomperada.com
// YouTube Channel : https://www.youtube.com/jakepomperada
// Email : jakerpomperada@gmail.com
class Multiplier {
// Declare instance variables with default values
private float $num1 = 0.0;
private float $num2 = 0.0;
private float $result = 0.0;
// Method to set the two numbers
public function setNumbers(float $number1, float $number2): void {
$this->num1 = $number1;
$this->num2 = $number2;
}
// Method to get the first number
public function getNum1(): float {
return $this->num1;
}
// Method to get the second number
public function getNum2(): float {
return $this->num2;
}
// Method to perform multiplication
public function multiply(): void {
$this->result = $this->num1 * $this->num2;
}
// Method to get the result
public function getResult(): float {
return $this->result;
}
}
// Create an instance of the Multiplier class
$multiplier = new Multiplier();
// Set the numbers
$multiplier->setNumbers(12.40, 4.21);
// Perform the multiplication
$multiplier->multiply();
// Get the result and instance variables using public methods
$product = $multiplier->getResult();
$valOne = $multiplier->getNum1();
$valTwo = $multiplier->getNum2();
// Print the result
echo "\n\tMultiply Two Numbers Using a Class in PHP\n";
echo "\n\tFirst Value : $valOne\n"; // Print the value of num1
echo "\tSecond Value : $valTwo\n"; // Print the value of num2
echo "\tThe Result : $product\n"; // Print the multiplication result
echo "\n\tEnd of Program\n\n";
?>
Friday, April 26, 2024
Thursday, April 25, 2024
Wednesday, April 24, 2024
Subscribe to:
Posts (Atom)