Friday, October 19, 2018

Automatic Teller Machine Simulation in C++

A simple Automatic Teller Machine Simulation program that I wrote in C++ thank you Sir Manny Emmanuel for giving me an idea on this program. 

I am currently accepting programming work, it projects, school 

programming projects, thesis and capstone projects, IT consulting 

work, computer tutorials, and web development work kindly contact me in 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.

My personal website is http://www.jakerpomperada.com





Sample Program

Program Listing

#include <iostream>

// Created By Mr. Jake R. Pomperada, MAED-IT
// C++   October 19, 2018
// www.jakerpomperada.com

using namespace std;


int main()

{
int bill500=0, bill200=0, bill100=0, total_balance=0;
int withdraw=0, money_left=0;
int reciv500=0, reciv200=0, reciv100=0;
char withdraw_again[2] = "N";
 
system("COLOR F0");  
     cout <<"\n\n";
         cout <<"\t Automatic Teller Machine Simulation in C++";
cout <<"\n\n";
cout <<"\tHow many P500 bills: ";
cin >>bill500;
cout <<"\tHow many PHP 200 bills: ";
cin >>bill200;
cout <<"\tHow many PHP 100 bills: ";
cin >> bill100;
total_balance = (bill500 * 500 + (bill200 * 200 +  (bill100 * 100)) );

cout <<"\tTotal Balance: PHP :" << total_balance;

do

{
cout <<"\n";
cout <<"\n";

cout <<"\tEnter amount to withdraw: PHP ";
cin >>withdraw;
money_left = withdraw ;

if  (withdraw > total_balance)
{
cout <<"\tWithdraw amount greater than total balance.  ";
cout <<"\n";
}
if (withdraw < total_balance)
{
if  (money_left >= 500) 
{
reciv500 = int(money_left / 500);
if (reciv500 > bill500)  reciv500 = bill500;

money_left = money_left - (reciv500 * 500);
bill500 = bill500 - reciv500;
}

if (money_left >= 200) 
{
reciv200 = int(money_left / 200);
if (reciv200 > bill200)  reciv200 = bill200;
money_left = money_left - (reciv200 * 200);
bill200 = bill200 - reciv200;
}

if (money_left >= 100) 
  {
reciv100 = int(money_left / 100);
if (reciv100 > bill100)  reciv100 = bill100;
money_left = money_left - (reciv100 * 100);
bill100 = bill100 - reciv100;
}

cout <<"\n";
cout <<"\n";
cout <<"\tYou will receive:";
cout <<"\n";
cout <<"\t  PHP 500 bill : " << reciv500;
cout <<"\n";
cout <<"\t  PHP 200 bill : " << reciv200;
cout <<"\n";
cout <<"\t  PHP 100 bill : " << reciv100;
cout <<"\n";


total_balance = total_balance - withdraw;

cout <<"\tYour current balance is: PHP " <<total_balance;
cout <<"\n";
cout <<"\n";
cout <<"\tYou only have balance of:";
cout <<"\n";
cout <<"\t PHP 500 bill   : "  << bill500;
cout <<"\n";
cout <<"\t  PHP 200 bill  : " << bill200;
cout <<"\n";
cout <<"\t  PHP 100 bill  : " << bill100;
cout <<"\n"; 
  cout <<"\n\n";
cout <<"\tAnother Withdraw Again ? Y/N : ";
cin >>withdraw_again;

}

}  while (withdraw_again == "Y" || withdraw_again == "y");
     cout <<"\n\n";
     cout <<"\tEnd of Program";
     cout <<"\n\n";
}


Thursday, October 18, 2018

Automatic Teller Machine Simulation in C

A simple automatic teller machine simulation in C that I wrote with the help of my friend Sir Manny Emmanuel my close friend and fellow software engineer.

I am currently accepting programming work, it projects, school 

programming projects, thesis and capstone projects, IT consulting 

work, computer tutorials, and web development work kindly contact me in 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.

My personal website is http://www.jakerpomperada.com



Sample Program Output



Program Listing

atm.c

#include <stdio.h>
#include <conio.h>

int main()

{
int bill500=0, bill200=0, bill100=0, total_balance=0;
int withdraw=0, money_left=0;
int reciv500=0, reciv200=0, reciv100=0;
char withdraw_again[2] = "N";

     printf("\n\n");
         printf("\t Automatic Teller Machine Simulation in C");
printf("\n\n");
printf("\tHow many P500 bills: ");
scanf("%d", &bill500);
printf("\tHow many PHP 200 bills: ");
scanf("%d", &bill200);
printf("\tHow many PHP 100 bills: ");
scanf("%d", &bill100);
total_balance = (bill500 * 500) + (bill200 * 200) +  (bill100 * 100) ;

printf("\tTotal Balance: PHP %d", total_balance);

do

{
printf("\n");
printf("\n");

printf("\tEnter amount to withdraw: PHP ");
scanf("%d", &withdraw);
money_left = withdraw ;

if  (withdraw > total_balance)
{
printf("\tWithdraw amount greater than total balance.  ");
printf("\n");
}
if (withdraw < total_balance)
{
if  (money_left >= 500 )
{
reciv500 = int(money_left / 500);
if (reciv500 > bill500 ) reciv500 = bill500;

money_left = money_left - (reciv500 * 500);
bill500 = bill500 - reciv500;
}

if (money_left >= 200 )
{
reciv200 = int(money_left / 200);
if (reciv200 > bill200 ) reciv200 = bill200;
money_left = money_left - (reciv200 * 200);
bill200 = bill200 - reciv200;
}

if (money_left >= 100 )
  {
reciv100 = int(money_left / 100);
if (reciv100 > bill100 ) reciv100 = bill100;
money_left = money_left - (reciv100 * 100);
bill100 = bill100 - reciv100;
}

printf("\n");
printf("\n");
printf("\tYou will receive:");
printf("\n");
printf("\t%d  PHP 500 bill", reciv500);
printf("\n");
printf("\t%d  PHP 200 bill", reciv200);
printf("\n");
printf("\t%d  PHP 100 bill", reciv100);
printf("\n");


total_balance = total_balance - withdraw;

printf("\tYour current balance is: PHP %d", total_balance);

printf("\n");
printf("\n");
printf("\tYou only have balance of:");
printf("\n");
printf("\t%d  PHP 500 bill", bill500);
printf("\n");
printf("\t%d  PHP 200 bill", bill200);
printf("\n");
printf("\t%d  PHP 100 bill", bill100);
printf("\n");
  printf("\n\n");
printf("\tAnother Withdraw Again ? Y/N : ");
scanf("%s", &withdraw_again);

}

}  while (withdraw_again == "Y" || withdraw_again == "y" );
     printf("\n\n");
     printf("\tEnd of Program");
     printf("\n\n");
}


Sunday, October 14, 2018

Addition Program Using Class and Pointers

A very simple program to add a number using classes and pointers in C++ I wrote this code during my class C++ way back in 2010.


I am currently accepting programming work, it projects, school 

programming projects, thesis and capstone projects, IT consulting 

work, computer tutorials, and web development work kindly contact me in 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.

My personal website is http://www.jakerpomperada.com


Program Listing

#include <iostream>

using namespace std;

class add {
public:
    int a,b;

 int convert(int *a, int *b )
     {
     return(*a+*b);

     }
};

 main() {
    add values;
    char reply;

  while (1) {
    system("cls");
    cout << "\n\n\t Addition Program Using Class and Pointers ";
    cout << "\n\n \t Created By: Mr. Jake R. Pomperada, MAED-IT";
    cout << "\n";
    cout << "\n\n Enter the first value  : ";
    cin >> values.a;
    cout << "\n Enter the second value : ";
    cin >> values.b;
    cout << "\n\n";
    cout << " The total sum is ";
    cout << values.convert(&values.a,&values.b);
    cout << ".";
    cout <<"\n\n";
    cout << " More Y/N :=> ";
    cin >> reply;

    if (reply == 'N' || reply == 'n') {
        cout << "\n\n";
        cout << "\t Thank You For Using This Program :-D";
        break;
    }
    }
    cout << "\n\n\n\n";
    system("pause");
}

Odd Number Using Classes in C++

Here is a simple program that I wrote a long time ago to introduce object-oriented programming in C++. The program will create a class in C++ 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 

programming projects, thesis and capstone projects, IT consulting 

work, computer tutorials, and web development work kindly contact me in 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.

My personal website is http://www.jakerpomperada.com


Program Listing


#include <iostream>

using namespace std;

class odd {
    public:
    int x;
};

main() {

    odd value;
    cout << "Enter a Number :=> ";
    cin >> value.x;
    if(value.x==0)
    {
        cout<<"ZERO";
    }
    else if(value.x%2==0)
    {
        cout<<"EVEN NUMBER";
    }
    else
    {
        cout<<"ODD NUMBER";
    }
    cout << "\n\n";
    system("pause");
}

Sunday, October 7, 2018

Login and Registration in PHP and MySQL Using Bootstrap

Here are a sample login and registration system that I wrote in PHP and MySQL using the Bootstrap CSS framework.  I hope you will find my work useful. Thank you.

 I am currently accepting programming work, it projects, school 

programming projects, thesis and capstone projects, IT consulting 

work, computer tutorials, and web development work kindly contact me in 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.

My personal website is http://www.jakerpomperada.com



Sample Program Output


Program Listing


index.php

<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>PHP Login Form</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/main.css">


</head>
<!-- NAVBAR
================================================== -->

<body>

<div class="container">
  <div class="row" style="margin-top:20px">
    <div class="col-xs-12 col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3">
      <form name="form_login" method="post" action="index.php" role="form">
        <fieldset>
          <h2>Please Sign In</h2>
          <hr class="colorgraph">
          <div class="form-group">
            <input name="username" type="text" id="username" class="form-control input-lg" placeholder="Username">
          </div>
          <div class="form-group">
            <input type="password" name="password" id="password" class="form-control input-lg" placeholder="Password">
          </div>
          <span class="button-checkbox">
             <hr class="colorgraph">
          <div class="row">
            <div class="col-xs-6 col-sm-6 col-md-6">
              <input type="submit" name="Submit" value="Login" class="btn btn-lg btn-success btn-block">
            </div>
            <div class="col-xs-6 col-sm-6 col-md-6"> <a href="register.php" target="_blank" class="btn btn-lg btn-primary btn-block">Register</a> </div>
          </div>
        </fieldset>
      </form>
    </div>
  </div>
</div>

<?php
include('connect.php');

 if (isset($_POST['Submit'])) {
{
    $username = $_POST['username'];
    $password = $_POST['password'];
    
   $sql1= "select * from emp where username= '".$_REQUEST['username']."' &&  password ='".$_REQUEST['password']."'";
  $result=mysql_query($sql1)  or exit("Sql Error".mysql_error());
    $num_rows=mysql_num_rows($result);
   if($num_rows>0)
      {

              echo "<script> alert('You have logged in successfully'); </script>";
        }
    else
{
echo "<script> alert('username or password incorrect'); </script>";
}

}

}
?>

</body>
</html>


connect.php

<?php
$hostname="localhost"; //local server name default localhost
$username="root";  //mysql username default is root.
$password="";       //blank if no password is set for mysql.
$database="employees";  //database name which you created
$con=mysql_connect($hostname,$username,$password);
if(! $con)
{
die('Connection Failed'.mysql_error());
}
mysql_select_db($database,$con);
?>

register.php


<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Registration</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/main.css">


</head>
<!-- NAVBAR
================================================== -->

<body>

<div class="container">
  <div class="row" style="margin-top:20px">
    <div class="col-xs-12 col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3">
      <form name="form_login" method="post" action="register.php" role="form">
        <fieldset>
          <h2>Please Register Here</h2>
          <hr class="colorgraph">
          <div class="form-group">
            <input name="username" type="text" id="username" class="form-control input-lg" placeholder="Username">
          </div>
          <div class="form-group">
            <input type="password" name="password" id="password" class="form-control input-lg" placeholder="Password">
          </div>
          <span class="button-checkbox">
             <hr class="colorgraph">
          <div class="row">
            <div class="col-xs-6 col-sm-6 col-md-6">
              <input type="submit" name="submit" value="Submit" class="btn btn-lg btn-success btn-block">
            
        </fieldset>
      </form>
    </div>
  </div>
</div>

</body>
</html>



<?php
include('connect.php');

  if (isset($_POST['submit'])) {
  
    $username = $_POST['username'];
    $password = $_POST['password'];
    
     $query = "INSERT INTO emp (username,password) VALUES('$username', '$password')";
      $result = mysql_query($query);
      if ($result == TRUE) {
        echo  'Successfully Registered!';
      } else {
        echo 'Registration failed. Check database settings';
      }
    }
  
?>


emp.sql

-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Oct 07, 2018 at 04:02 PM
-- Server version: 5.7.21
-- PHP Version: 5.6.24

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `employees`
--

-- --------------------------------------------------------

--
-- Table structure for table `emp`
--

CREATE TABLE `emp` (
  `id` int(11) NOT NULL,
  `username` varchar(100) NOT NULL,
  `password` varchar(100) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `emp`
--

INSERT INTO `emp` (`id`, `username`, `password`) VALUES
(1, '123', '123'),
(2, 'a', 'a'),
(3, 'jake', 'jake');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `emp`
--
ALTER TABLE `emp`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `emp`
--
ALTER TABLE `emp`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;