Tuesday, February 2, 2021

Basic Math Operations in PHP using Drop Down Menu

 A simple php program to perform basic math operations using addition, subtraction, multiplication and division by asking the user to give two numbers and select the operations using drop-down menu in HTML.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.









Program Listing

<?php 
    $num1 = $num2 = $oper = $answer = $infotext = "";

    if(isset($_POST['btnSolve'])) 
    { 
        $num1   = $_POST['txtNum1'];
        $num2   = $_POST['txtNum2'];
        $oper   = $_POST['txtOper'];

        switch ($oper) {
            case "Addition":
                $answer = $num1 + $num2;
                $infotext = $num1." + ".$num2;
                break;
            case "Subtraction":
                $answer = $num1 - $num2;
                $infotext = $num1." - ".$num2;
                break;
            case "Multiplication":
                $answer = $num1 * $num2;
                $infotext = $num1." x ".$num2;
                break;
            case "Division":
                $answer = $num1 / $num2;
                $infotext = $num1." / ".$num2;
                break;
        }

        $answer='<div class="answer">'.$infotext.' = '.$answer.'</div>';
    }
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Basic Math Operations in PHP Using Drop Down Menu</title>
        <link rel="stylesheet" href="style.css">
    </head>
    <body>          
        <h3 align="center"> Basic Math Operations in PHP Using Drop Down Menu</h3>
        <main>
            <div class="container">
                <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
                    <label for="txtNum1"><b>First Number:</b></label>
                    <input type="number" name="txtNum1" id="txtNum1" value="<?php echo $num1; ?>" required>

                    <label for="txtNum2"><b>Second Number:</b></label>
                    <input type="number" name="txtNum2" id="txtNum2" value="<?php echo $num2; ?>" required>

                    <label for="txtOper"><b>Select Operator:</b></label>
                    <select name="txtOper" id="txtOper" value="<?php echo $oper; ?>" required>
                        <option value="Addition">Addition</option>
                        <option value="Subtraction">Subtraction</option>
                        <option value="Multiplication">Multiplication</option>
                        <option value="Division">Division</option>
                    </select>

                    <button type="submit" name="btnSolve" class="btnSolve">Solve</button>

                    <?php echo $answer;?>
                </form>
            </div>
        </main>
    </body>
</html>

style.css

* {
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #fefefe;
    color: #1a1a1a;
    font-size: 15px;
}

main {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 450px;
    box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
    border-radius: 10px;
}

.container {
    display: block;
    padding: 30px;
    background: #fff;
    text-align: left;
    border-radius: 2px;
}

input,
select {
    display: inline-block;
    background: #f5f5f5;
    width: 100%;
    margin: 5px 0 20px 0;
    padding: 15px;
    border: none;
    font-size: 15px;
}

input:focus,
select:focus {
    background: #eeeeee;
    outline: none;
}

button {
    background: #2196f3;
    color: #fff;
    padding: 10px 20px;
    margin: 10px 0 0;
    border: none;
    cursor: pointer;
    width: 100%;
    opacity: 0.9;
    text-transform: uppercase;
    font-size: 15px;
    outline: none;
}

button:hover {
    opacity: 1;
}

.answer {
    padding: 20px;
    margin-top: 20px;
    text-align: center;
    font-size: 30px;
    font-weight: bold;
    background: #dadada;
}




Area of Shapes in PHP

Area of Shapes (Rectangle, Triangle, and Circle) in PHP

Machine Problem in PHP

Create a PHP program that will help the USERS to compute the area of a rectangle, triangle, and circle. Use functions in creating the program. Apply CSS to have an appealing program. Expected outputs: *must have an input box for measurements *the program will ask the user if it's a rectangle, triangle, or circle (use a dropdown list) *displays the correct area *button/s that will compute the area.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.







Program Listing

style.css

* { box-sizing: border-box; } body { font-family: Arial, Helvetica, sans-serif; background: #fefefe; color: #1a1a1a; font-size: 15px; } main { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 500px; box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px; border-radius: 10px; } .container { display: block; padding: 30px; background: #fff; text-align: left; border-radius: 2px; } h2 { text-align: center; } label { width: 100%; font-size: 20px; } input, select { display: inline-block; background: #f5f5f5; width: 100%; margin: 5px 0 20px 0; padding: 15px; border: none; font-size: 15px; } input:focus, select:focus { background: #eeeeee; outline: none; } button { background: #2196f3; color: #fff; padding: 15px; margin: 0 0 20px; border: none; cursor: pointer; width: 100%; opacity: 0.9; font-size: 15px; outline: none; } .btnSelectShape { background: #f44336; } button:hover { opacity: 1; } .answer { width: 100%; padding: 20px; text-align: center; font-size: 30px; font-weight: bold; background: #dadada; font-family: 'Times New Roman', serif; line-height: 1.5; } .visibility_on { display: block; } .visibility_off { display: none; } .frmAreaSelect { display: flex; flex-flow: row wrap; align-items: center; } .frmAreaSelect select { vertical-align: middle; padding: 15px; margin: 5px 0 0; width: calc(100% - 100px); } .frmAreaSelect button { width: 100px; margin: 5px 0 0; } .pieText { font-family: Serif; }


index.php

<?php /* Area of Shapes (Rectangle, Triangle, and Circle) in PHP Author : Jake Rodriguez Pomperada, MAED-IT, MIT www.jakerpomperada.com and www.jakerpomperada.blogspot.com jakerpomperada@gmail.com Bacolod City, Negros Occidental Philippines */ $area = $html = $infotext = $sel1 = $sel2 = $sel3 = ""; $num1 = isset($_POST['txtNum1']) ? floatval($_POST['txtNum1']) : ""; $num2 = isset($_POST['txtNum2']) ? floatval($_POST['txtNum2']) : ""; $visibility = "visibility_off"; $frmArea = isset($_GET['selectArea']) ? $_GET['selectArea'] : ''; // Display selected shape input fields if(isset($_GET['selectArea'])) { $visibility = "visibility_on"; switch ($frmArea) { case "Rectangle": $sel1 = "selected"; $html = '<h2>Area of a Rectangle ( l x w )</h2> <label for="txtNum1"><b>Length (l):</b></label> <input type="number" step=".0001" name="txtNum1" id="txtNum1" value="'.$num1.'" required> <label for="txtNum2"><b>Width (w):</b></label> <input type="number" step=".0001" name="txtNum2" id="txtNum2" value="'.$num2.'" required>'; if(isset($_POST['btnCalculate'])) { $area = round($num1 * $num2); $infotext = '<div class="answer">'.$num1." x ".$num2." = ".$area."</div>"; } break; case "Triangle": $sel2 = "selected"; $html = '<h2>Area of a Triangle ( <sup>bh</sup>&frasl;<sub>2</sub> )</h2> <label for="txtNum1"><b>Base (b):</b></label> <input type="number" step=".0001" name="txtNum1" id="txtNum1" value="'.$num1.'" required> <label for="txtNum2"><b>Height (h):</b></label> <input type="number" step=".0001" name="txtNum2" id="txtNum2" value="'.$num2.'" required>'; if(isset($_POST['btnCalculate'])) { $area = round(($num1 * $num2)/2); $infotext = '<div class="answer"><sup>('.$num1." x ".$num2.")</sup>&frasl;<sub>2</sub> = ".$area."</div>"; } break; case "Circle": $sel3 = "selected"; $html = '<h2>Area of a Circle ( <span class="pieText">Ï€</span>r<sup>2</sup> )</h2> <label for="txtNum1"><b>Radius (r):</b></label> <input type="number" step=".0001" name="txtNum1" id="txtNum1" value="'.$num1.'" required>'; if(isset($_POST['btnCalculate'])) { $area = round((pi() * pow($num1, 2)), 4); $infotext = '<div class="answer"><span class="pieText">Ï€</span>('.$num1.')<sup>2</sup> = '.$area.'</div>'; } break; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Area of Shapes (Rectangle, Triangle, and Circle) in PHP</title> <link rel="stylesheet" href="style.css"> </head> <body> <h3 align="center"> Area of Shapes (Rectangle, Triangle, and Circle) in PHP </h3> <main> <div class="container"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get" class="frmAreaSelect"> <label for="selectArea"><b>Select Shape:</b></label> <select name="selectArea" id="selectArea" value="<?php echo $oper; ?>" required> <option value="Rectangle" <?php echo $sel1; ?>>Rectangle</option> <option value="Triangle" <?php echo $sel2; ?>>Triangle</option> <option value="Circle" <?php echo $sel3; ?>>Circle</option> </select> <button type="submit" class="btnSelectShape">Select</button> </form> </div> <div class="container <?php echo $visibility; ?>"> <form action="" method="post" class="frmAreaCalculate"> <?php echo $html; ?> <button type="submit" name="btnCalculate" class="btnCalculate">Calculate Area</button> <?php echo $infotext; ?> </form> </div> </main> </body> </html>


Monday, February 1, 2021

Odd and Even Number in Modern C++

Odd and Even Numbers in Modern C++

 Machine Problem in C++

Write a program to ask the user to give a number and then the program will check if the given number

is odd or even number.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.





Program Listing

// odd_even.cpp

// Machine Problem in C++

// Write a program to ask the user to give a number

// and then the program will check if the given number

// is odd or even number.

//

//  Mr. Jake Rodriguez Pomperada, MAED-IT, MIT

//  www.jakerpomperada.com  and www.jakerpomperada.blogspot.com

//  jakerpomperada@gmail.com

//  Bacolod City, Negros Occidental Philippines

//  February 1, 2021   Monday   2:09 PM



#include <iostream>


int main() {

   

   int num=0;

   

   std::cout <<"\n\n";

   std::cout <<"\tOdd and Even Numbers in Modern C++";

   std::cout <<"\n\n";

   std::cout <<"\tGive a Number : ";

   std::cin >> num;

   std::cout <<"\n\n";

    if(num % 2 == 0) {

  std::cout<<"\tThe given number "<< num<<" is even number.";

   }

   else {

  std::cout<<"\tThe given number "<< num<<" is odd number.";

  }

   std::cout <<"\n\n";

   std::cout <<"\tEnd of Program";

   std::cout <<"\n\n";

   

}

Sunday, January 31, 2021

Paycheck Calculator in JavaScript

Paycheck Calculator in JavaScript

 Machine Problem in JavaScript

The Paycheck assignment requires that we create an application that calculates paycheck information.

The user inputs First Name, Last Name, Regular Hours worked, Overtime Hours worked, Hourly PayRate, FICA, State, and Federal Tax Rates. The application calculates and displays the Regular Pay, Overtime Pay, Gross Pay, Total Taxes, and Net Pay. 

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.




Program Listing

paycheck.html

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="utf-8">

<title>Paycheck Calculator in JavaScript</title></title>

<link rel="stylesheet" href="css/styles.css">

</head>

<body>

<h2>Paycheck Calculator in JavaScript</h2>

<form action="javascript:void(0)" method="post" onsubmit="calculate()">

        <fieldset>

<p>Use this form to calculate the Regular Pay, Overtime Pay, Gross Pay, and Net Pay for an employee.</p>

<div><label for="firstName">First Name</label><input type="text" name="firstName" id="firstName" required></div>

<div><label for="lastName">Last Name</label><input type="text" name="lastName" id="lastName" required></div>

<div><label for="regH">Regular Hours Worked (between 0 and 40)</label><input type="number" name="regH" id="regH" value="0" min="0" max="40" required></div>

<div><label for="overH">Overtime Hours Worked (between 0 and 40)</label><input type="number" name="overH" id="overH" value="0" min="0" max="40" required></div>

<div><label for="hourR">Hourly Rate (between 0 and 99.99)</label><input type="number" name="hourR" step=".01" id="hourR" value="0.00" min="0" max="99.99" required></div>

<div><label for="regP">Regular Pay</label><input type="number" name="regP" id="regP" step=".01" value="0.00" readonly="true"></div>

<div><label for="overP">Overtime Pay</label><input type="number" name="overP" id="overP" step=".01" value="0.00" readonly="true"></div>

<div><label for="grossP">Gross Pay</label><input type="number" name="grossP" id="grossP" step=".01" value="0.00" readonly="true"></div>

<div><label for="fica">Fica Tax Rate (ex. 5.65)</label><input type="number" name="fica" id="fica" step=".01" value="0.00" required></div>

<div><label for="state">State Tax Rate (ex. 5.75)</label><input type="number" name="state" id="state" step=".01" value="0.00" required></div>

<div><label for="fed">Federal Tax Rate (ex. 28.00)</label><input type="number" name="fed" id="fed" step=".01" value="0.00" required></div>

<div><label for="totalTax">Total Taxes</label><input type="number" name="totalTax" id="totalTax" step=".01" value="0.00" readonly="true"></div>

<div><label for="empName">Employee Name</label><input type="text" name="empName" id="empName" readonly="true"></div>

<div><label for="netP">Net Pay</label><input type="number" name="netP" id="netP" value="0.00" step=".01" readonly="true"></div>

<div><input type="submit" value="Calculate" id="submit"></div>

        </fieldset>

    </form>

    <script src="js/paycheck.js"></script>

</body>

</html>


style.css


/* From: http://www.assemblesoft.com/examples/form/simpleform.html */

* {margin:0; padding:0;}


html {

font: 90%/1.3 arial,sans-serif;

padding:1em;

background:#B9C2CC;

}

form {

background:#fff;

padding:1em;

border:1px solid #eee;

}


fieldset div {

margin:0.3em 0;

clear:both;

}


form {

margin:1em;

width:15em;

}


label {

float:none;

width:12em;

display:block;

clear:both;

}


legend {

color:#0b77b7;

font-size:1.4em;

}

legend span {

width:10em;

text-align:right;

}

input {

padding:0.15em;

width:10em;

border:1px solid #ddd;

background:#fafafa;

font:bold 1em arial, sans-serif;

display:block;

float:left;

}

input:hover, input:focus {

border-color:#c5c5c5;

background:#f6f6f6;

fieldset {

border:1px solid #ddd;

padding:0 0.5em 0.5em;

}

.date input {

background-image:url(../gfx/calendar-small.gif);

background-repeat:no-repeat;

background-position:100% 50%;

}


.date fieldset label {

float:none;

display:block;

text-align:left;

width:auto;

}

.date fieldset div {

float:left;

clear:none;

margin-right:0.2em;

}

.radio, .date {

position:relative;

}

.radio fieldset, .date fieldset {

border:none;

width:auto;

padding:1px 0 0 11em;

}

.radio legend, .date legend {

font-size:1em;

color:#000;

}

.radio legend span, .date legend span {

position:absolute;

left:0;

top:0.3em;

width:10em;

display:block;

}

.radio label, .radio input {

vertical-align:middle;

display:inline;

float:none;

width:auto;

background:none;

border:none;

}

.radio div {

float:left;

white-space:nowrap;

clear:none;

}


.email {

width:14em;

}


input.default {

color:#bbb;

}


#submit {

margin:1em;

width:69px;

height:26px;

overflow:hidden;

border:0;

display:block;

cursor:pointer !important;

}

#submit:hover {

background-position:0 -26px;

}


.error {

color: #FF1400;

}

/*

:invalid {

color:red;

}

*/

/*

input[type=checkbox], input[type=radio] { visibility: hidden; width:0; height:0; padding:0; margin:0; }

input[type=checkbox] + label, input[type=radio] + label { padding-left:18px; }

input[type=checkbox] + label{ background: url(../gfx/check_radio.png) 0 0 no-repeat; }

input[type=checkbox]:focus + label{ background-position: 0 -16px; }

input[type=checkbox] + label:hover{ background-position: 0 -32px; } 

input[type=checkbox]:checked + label{ background-position: 0 -48px; }


input[type=radio] + label{ background: url(../gfx/check_radio.png) 0 -64px no-repeat; }

input[type=radio]:focus + label{ background-position: 0 -80px; }

input[type=radio] + label:hover{ background-position: 0 -96px; } 

input[type=radio]:checked + label{ background-position: 0 -112px; }

*/


paycheck.js

function calculate() {

'use strict';

//Get all inputs from controls

var firstName = document.getElementById('firstName').value;

var lastName = document.getElementById('lastName').value;

var regH = document.getElementById('regH').value;

var overH = document.getElementById('overH').value; 

var hourR = document.getElementById('hourR').value;

var regP = document.getElementById('regP').value;

var overP = document.getElementById('overP').value;

var grossP = document.getElementById('grossP').value;

var fica = document.getElementById('fica').value;

var state = document.getElementById('state').value;

var fed = document.getElementById('fed').value;

//Append Employee Name

var empName = firstName + ' ' + lastName;


//Calculations

regP = (regH * hourR);

overP = (overH * hourR * 1.5);

grossP = (regP + overP);

var totalTax = (parseFloat(fica) + parseFloat(state) + parseFloat(fed)) / 100 * grossP;

var netP = (grossP - totalTax);


totalTax = totalTax.toFixed(2);

netP = netP.toFixed(2)

regP = regP.toFixed(2);

overP = overP.toFixed(2);

grossP = grossP.toFixed(2);;


//Send Calculations to Form Controls

document.getElementById('regP').value = regP;

document.getElementById('overP').value = overP;

document.getElementById('grossP').value = grossP;

document.getElementById('totalTax').value = totalTax;

document.getElementById('empName').value = empName;

document.getElementById('netP').value = netP;

}


function init() {

'use strict';

var theForm = document.getElementById('theForm');

}

window.onload = init;



The Secret History of Windows Bluescreens by Davepl