Thursday, June 23, 2022

Sum of All Odd Numbers in Java

Sum of All Odd Numbers in Java

 Machine Problem

Write a program that uses a loop to compute the sum of all odd digits of an input.  (For example, if the given number is  6741, the sum would be 7 + 1 = 8.)

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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.





Program Listing


test.java

package demo;


//Write a program that uses a loop to compute the sum of all odd digits of an input. 

//(For example, if the given number is  6741, the sum would be 7 + 1 = 8.)


import java.util.Scanner;

 

public class Test

{

public static void main(String[] args) {

    

    Scanner input = new Scanner(System.in);

    

    int display_result = 0;

    

    System.out.print("\n\n");

    System.out.print("\tSum of All Odd Numbers in Java");

    System.out.println("\n");

    System.out.print("\tGive a Number : ");

    int num = input.nextInt();

    int y = num;

    

    while (num > 0) {

        int digit = num % 10;

        if (digit % 2 != 0) {

     display_result += digit;

   }

        num /= 10;

}

    System.out.println();

    System.out.printf("\tThe Sum of %d odd digits is %d", y, display_result);

    System.out.println("\n");

    System.out.print("\tEnd of Program");

    System.out.println("\n");

    input.close();

}

}


Addition of Three Numbers in TypeScript

Addition of Three Numbers Using TypeScript

 A simple program to add the sum of three numbers using TypeScript programming language.

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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.





Program Listing

addition.ts

/* addition.ts
   Jake Rodriguez Pomperada, MAED-IT, MIT
   www.jakerpomperada.com and www.jakerpomperada.blogspot.com
   jakerpomperada@gmail.com
   June 23, 2022  12:06 PM  Thursday
   Bacolod City, Negros Occidental
*/

var a=10; var b=20; var c=30;

var addition = (a+b+c);

console.log();
console.log("Addition of Three Numbers in TypeScript.\n");
console.log("The sum of " + a + ", " + b + ", and " + c + " is " + addition + ".\n");
console.log("\tEnd of Program\n");

Sum and Difference of Two Numbers in TypeScript

Sum and Difference of Two Numbers in TypeScript

 A program that I wrote that will compute the sum and product of two numbers using TypeScript programming language.

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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.





Program Listing

sum_product.ts

var a=5; var b= 3;

var sum = (a+b);
var subtract = (a-b);


console.log("\n\n");
console.log("The sum of " + a + " and " + b + " is " + sum + ".\n");
console.log("The difference between " + a + " and " + b + " is " + subtract + ".\n");

Wednesday, June 22, 2022

Automatic Teller Machine Simulation in Scala

Automatic Teller Machine Simulation in Scala

 Machine Problem

Create and design a program that simulates an Automatic Teller Machine. The money  bill to be used in the program will be 1000,500,200 and 100 money bill denomination.

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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.





Program Listing


/* atm.scala

   Prof. Jake Rodriguez Pomperada, MAED-IT, MIT

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

   jakerpomperada@gmail.com

   January 8, 2022  7:58 PM Saturday

   Bacolod City, Negros Occidental

 */


import java.util.Scanner;


object  atm {

def main(args: Array[String]) : Unit = {

    var scanner = new Scanner(System.in);


       var bill1000=0; var bill500=0; var bill200=0; var bill100=0; 

       var total_balance=0; var withdraw=0; var money_left=0;

       var receive1000=0; var receive500=0; var receive200=0; var receive100=0;

       var withdraw_again='n';


 do


{


    print("\n");

    print("\tAutomatic Teller Machine Simulation in Scala");

        print("\n\n");  

    print("\tHow many P1000 bills: ");

        bill1000 = scanner.nextInt();

print("\tHow many P500 bills: ");

bill500 = scanner.nextInt();

        print("\tHow many PHP 200 bills: ");

bill200 = scanner.nextInt();

        print("\tHow many PHP 100 bills: ");

bill100 = scanner.nextInt();


        total_balance = (bill1000 * 1000)+(bill500 * 500) + (bill200 * 200) +  (bill100 * 100) ;

    print("\n\n");

        print("\tTotal Balance: PHP " + total_balance);


         print("\n\n");

print("\tEnter amount to withdraw: PHP ");

withdraw = scanner.nextInt();

 

         money_left = withdraw ;


if  (withdraw > total_balance)

{

print("\tWithdraw amount greater than total balance.  ");

print("\n");

}

if (withdraw < total_balance)

{

if  (money_left >= 1000 )

{

receive1000 = (money_left / 1000);

if (receive1000 > bill1000 ) receive1000 = bill1000;


money_left = money_left - (receive1000 * 1000);

bill1000 = bill1000 - receive1000;

}


if  (money_left >= 500 )

{

receive500 = (money_left / 500);

if (receive500 > bill500 ) receive500 = bill500;


money_left = money_left - (receive500 * 500);

bill500 = bill500 - receive500;

}


if (money_left >= 200 )

{

receive200 = (money_left / 200);

if (receive200 > bill200 ) receive200 = bill200;

money_left = money_left - (receive200 * 200);

bill200 = bill200 - receive200;

}


if (money_left >= 100 )

  {

receive100 =(money_left / 100);

if (receive100 > bill100 ) receive100 = bill100;

money_left = money_left - (receive100 * 100);

bill100 = bill100 - receive100;

}


print("\n\n");

print("\tYou will receive:");

print("\n\n");

print("\tPHP 1000 bill :=>  " + receive1000);

print("\n");

print("\tPHP 500 bill :=>   " + receive500);

print("\n");

print("\tPHP 200 bill :=>   " + receive200);

print("\n");

print("\tPHP 100 bill :=>   " + receive100);

print("\n\n");


total_balance = total_balance - withdraw;


print("\tYour current balance is: PHP "  + total_balance);


print("\n\n");

print("\tYou only have balance of:");

print("\n\n");

print("\tPHP 1000 bill :=>  " +  bill1000);

print("\n");

print("\tPHP 500 bill  :=>  "  + bill500);

print("\n");

print("\tPHP 200 bill  :=>  "  + bill200);

print("\n");   

print("\tPHP 100 bill  :=>  "  + bill100)

                print("\n\n");

printf("\tAnother Withdraw Again ? Y/N : ");

        withdraw_again  = scala.io.StdIn.readChar()

}  

}  while (withdraw_again.toUpper == 'Y'); 

    print("\n");

                print("\tEnd of Program");

                print("\n\n");

 

       }

}



Tuesday, June 21, 2022

Simple Login Using JavaScript

Simple Login Using JavaScript

 A simple login that I wrote using JavaScript programming language.

 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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.




Program Listing

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Simple Login Using JavaScript</title>

    <style>
        *,html {
            box-sizing: border-box;
            padding: 0;
            margin: 0;
        }
        main {
            display: flex;
            height: 100vh;
            width: 100vw;
            font-family: sans-serif;
        }
        .col {
            display: block;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            text-align: center;
        }
        .col-1 {
            width: 65%;
            background: url("https://images.pexels.com/photos/807598/pexels-photo-807598.jpeg?cs=srgb&dl=pexels-sohail-nachiti-807598.jpg&fm=jpg&w=1920&h=1440");
            color: #fff;
            position: relative;
        }
        .col-1::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            height: 100%;
            width: 100%;
            background: rgba(10, 44, 46, 0.8);
        }
        .col-2 {
            width: 35%;
            background-color: #fff;
        }
        .author {
            z-index: 1;
        }
        .author hr {
            width: 40px;
            margin: 30px auto;
        }
        .wrapper {
            width: 320px;
        }
        .logo {
            background-color: #154345;
            height: 60px;
            width: 60px;
            border-radius: 50%;
            margin: 0 auto 30px;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 26px;
        }
        h3 {
            font-size: 25px;
            margin-bottom: 10px;
            text-transform: uppercase;
        }
        p {
            margin-bottom: 30px;
            font-size: 14px;
        }
        .block {
            margin-bottom: 15px;
        }
        label {
            display: block;
            margin-bottom: 6px;
            text-align: left;
        }
        input{
            width: 100%;
            padding: 10px;
            border: 1px solid #4AA68C;
            outline: none;
            border-radius: 3px;
        }
        button {
            background: #4AA68C;
            color: #fff;
            padding: 10px 20px;
            width: 100%;
            font-size: 15px;
            text-transform: uppercase;
            border-radius: 3px;
            border: 0;
        }
    </style>
</head>
<body>
    <main>
        <div class="col col-1">
            <div class="author">
                <h1>Simple Login Using JavaScript</h1>
                <hr>
                <h2>Jake R. Pomperada, MAED-IT, MIT</h2>
            </div>
        </div>
        <div class="col col-2">
            <div class="wrapper">
                <div class="logo">
                    <span>&#128274;</span>
                </div>

                <h3>~ Login ~</h3>
                <p>Please enter your username and password below to access your account.</p>

                <form action="" method="post">
                    <div class="block">
                        <label for="">Username</label>
                        <input type="text" id="txtUsername">
                    </div>
                    <div class="block">
                        <label for="">Password</label>
                        <input type="password" id="txtPassword">
                    </div>
                    <button type="submit">Submit</button>
                </form>
            </div>
        </div>
    </main>

    <script>
        document.querySelector('form').onsubmit  = (e) => {
            e.preventDefault()

            let username  = "123", password  = "123",
                inputUser = document.querySelector('#txtUsername'),
                inputPass = document.querySelector('#txtPassword'),
                form      = document.querySelector("form")

            if (inputUser.value != username || inputPass.value != password) {
                alert("Username and Password do not match. Please try again.")
            }
            if (inputUser.value == username && inputPass.value == password) {
                alert("Success! You're currently logged in now.")
            }

            form.reset();
            inputUser.focus();
        }
    </script>
</body>
</html>

Monday, June 20, 2022

How To Write and Run a TypeScript Progam

Sum of Digits in C

Sum of Digits in C

 A simple program to ask the user to give a number and then the program will compute the sum of digits using C programming language.

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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.




Program Listing

/* Write a C program to Find Sum of Digits 

of a given number */



#include <stdio.h>


int main()

{

    int num=0, sum = 0;

 

    printf("\n\n");

    printf("\tSum of Digits in C\n");

    printf("\n\n");

    printf("\tGive a Number : ");

    scanf("%d",&num);

printf("\n\n");

    printf("\tThe given number %d.\n\n",num);


    //loop to find sum of digits

    while(num!=0){

        sum += num % 10;

        num = num / 10;

    }

 

    printf("\tThe sum of digits %d.\n",sum);

    printf("\n");

    printf("\tEnd of Program");

    printf("\n");

    return 0;


}