Wednesday, July 28, 2021

Odd and Even Numbers in AngularJS

 In this article I would like to discuss how to write a program that AngularJS to check if the given number is odd or even numbers.

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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.





Program Listing

<!-- index.htm

  Author   : Prof. Jake Rodriguez Pomperada, MAED-IT, MIT

  Date     : July 21, 2021  Wednesday  1:33 PM

  Place    : Bacolod City, Negros Occidental

  Websites : www.jakerpomperada.com and www.jakerpomperada.blogspot.com

  Email    : jakerpomperada@gmail.com

 -->

<html ng-app="mainApp">

<head>

<title>Odd and Even Numbers in AngularJS</title>

</head>

<style>

body {

font-family: arial;

font-size: 25px;

font-weight: bold;

}

</style>

<script type="text/javascript" src="angular.min.js">

</script>


<script type="text/javascript">


// AngularJS Controller Declaration

angular.module('mainApp', []).service('myService', function() {

  this.myFunc = function(x) {


    if (Number(x) % 2 === 0)

      return 'EVEN';

    else

      return 'ODD';

  };

}).controller('Odd_Even_Controller', function($scope, myService) {

  $scope.check = function(num) {

    $scope.myUserService = myService.myFunc(num);

  }


});

</script>


<div ng-app="mainApp" ng-controller="Odd_Even_Controller">

<form>

<table border="0" cellspacing=10>

<tr>Odd and Even Numbers in AngularJS</tr>

<tr>

  <td>Enter a Number </td>

<td><input type="number" ng-model="val_1" ng-init="val_1=0" ng-keyup="check(val_1)"/></td>

</tr>

<table>

</form>

<b>The number entered is {{val_1}} which is {{myUserService}} number(s). </b>

</div>

</body>

</html>




Classes, Objects, and Properties in Python

 A simple program that I wrote using Python programming language to show how to declare and use classes, objects, and propertines.

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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.





Program Listing

# mod6_act1.py
# Author : Jake R. Pomperada

class Car:
color = "Red"
model = "Everest"
manufacturer = "Ford"

def __init__(self, kulay, modelo, tagagawa):
self.col = kulay
self.mod = modelo
self.man = tagagawa


car1 = Car("Blue", "Fortuner", "Ford")
car2 = Car("White", "mu-X", "Isuzu")
car3 = Car("Brown", "Terra", "Nissan")

print(f"Car color is {car1.color}, Model is {car1.model}, Manufacturer is {car1.manufacturer}")
print("=========After modifying the properties===========")
print(f"Car color is {car1.col}, Model is {car1.mod}, Manufacturer is {car1.man}")
print(f"Car color is {car2.col}, Model is {car2.mod}, Manufacturer is {car2.man}")
print(f"Car color is {car3.col}, Model is {car3.mod}, Manufacturer is {car3.man}")


Monday, July 26, 2021

Simple Interest in AngularJS

Simple Interest in AngularJS

 Machine Problem


Write a program  to ask the user to give principal amount, time, and rate to calculate the simple interest.   Use the following formula below.

Formula:

SI = (P * T * R) / 100

Where:

P = principal amount

T = time

R = rate

SI = simple interest

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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.






Program Listing

<!-- index.htm
  Author   : Prof. Jake Rodriguez Pomperada, MAED-IT, MIT
  Date     : July 20, 2021  Tuesday   10:12 PM
  Place    : Bacolod City, Negros Occidental
  Websites : www.jakerpomperada.com and www.jakerpomperada.blogspot.com
  Email    : jakerpomperada@gmail.com
 -->
<html>
<head>
<title>Simple Interest in AngularJS</title>
</head>
<style>
body {
font-family: arial;
font-size: 25px;
font-weight: bold;
}
</style>
<script type="text/javascript" src="angular.min.js">
</script>


<div ng-app ng-init="principal_amt=0;time=0;interest_rate=0">
<form>
<table border="0" cellspacing=10>
<tr>Simple Interest in AngularJS</tr>
<tr>
<td>Enter Principal Amount </td>
<td><input type="number"  ng-model="principal_amt" ></td>
</tr>
<tr>
<td>Enter Time (ex. 1 for 1 year) </td>
<td><input type="number" ng-model="time" ></td>
</tr>
<tr>
<td>Enter Interest Rate </td>
<td><input type="number"  ng-model="interest_rate" ></td>
</tr>
<table>
</form>
<p>Simple Interest is PHP  {{ (principal_amt * time * interest_rate) / 100 | number : 2}}. </p> 
</div>
</body>
</html>

Sunday, July 25, 2021

Celsius To Fahrenheit in Visual Basic 6

Celsius To Fahrenheit in Visual Basic 6

 Machine Problem

Write a program that will ask the user to give temperature in Celsius and the program will convert it into Fahrenheit equivalent using Microsoft Visual Basic 6.

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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.




Program Listing


Private Sub cmdQuit_Click()

End

End Sub


Private Sub cmdRefresh_Click()

txtcelsius.Text = 0

txtfahrenheit.Text = 32

End Sub


Private Sub txtcelsius_Change()

If txtcelsius.Text = "" Or IsNumeric(txtcelsius.Text) = False Then

MsgBox "Please enter a numeric value", vbInformation, "Reminder"

txtcelsius.SetFocus

Else

txtfahrenheit.Text = Format(Val(txtcelsius.Text) * (9 / 5) + 32, "##,##0.00")

End If

End Sub



Friday, July 23, 2021

Temperature Converter in AngularJS

Temperature Converter in AngularJS

 

Machine Problem in AngulaJS

Write a temperature converter program that will accept temperature in Fahrenheit or Celsius  from the user and then the program will allow the user to convert temperature in Fahrenheit or Celsius, vice versa.

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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.




Program Listing

index.htm

<!-- index.htm

  Author   : Prof. Jake Rodriguez Pomperada, MAED-IT, MIT

  Date     : July 21, 2021  Wednesday   8:55 AM

  Place    : Bacolod City, Negros Occidental

  Websites : www.jakerpomperada.com and www.jakerpomperada.blogspot.com

  Email    : jakerpomperada@gmail.com

 -->

<html>

<head>

  <title>Temperature Converter in AngularJS</title>

</head>

<style>

body {

  font-family: arial;

  font-size: 25px;

  font-weight: bold;

}

</style>

<script type="text/javascript" src="angular.min.js">

</script>

<body >

    <div ng-app ng-init="f=32;c=0">

    <b>Temperature Converter in AngularJS</b><br>

    <div><br>

      Fahrenheit to Celsius: <input type="number" ng-model="f"> {{((f-32) * 5 / 9) | number : 2}} &deg;c

    </div>

<br>

    <div>

      Celsius to Fahrenheit: <input type="number" ng-model="c"> {{c * 9 / 5 + 32 | number : 2}} &deg;f

    </div>

</div>

  </body>

</html>



Factorial a Number in AngularJS

Factorial a Number in AngularJS

 Machine Problem in AngularJS

Write a program that will ask the user to give a number, and then the program will compute the factorial value of the given number by the user.

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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.




Program Listing

index.htm

<!-- index.htm

  Author   : Prof. Jake Rodriguez Pomperada, MAED-IT, MIT

  Date     : July 20, 2021  Tuesday   10:12 PM

  Place    : Bacolod City, Negros Occidental

  Websites : www.jakerpomperada.com and www.jakerpomperada.blogspot.com

  Email    : jakerpomperada@gmail.com

 -->

<html ng-app="mainApp">

<head>

<title>Factorial a Number in AngularJS</title>

</head>

<style>

body {

font-family: arial;

font-size: 25px;

font-weight: bold;

}

</style>

<script type="text/javascript" src="angular.min.js">

</script>


<script type="text/javascript">


// AngularJS Controller Declaration


var app = angular.module('mainApp', [])

  .controller('Factorial_Controller', function($scope) {

  })

  

  .filter('factorial', function() {

    return    function factorial(n) {

      return n === 0 ? 1 : n * factorial(n - 1);

    }


  });


</script>


<div ng-app="app" ng-controller="Factorial_Controller">

<form>

<table border="0" cellspacing=10>

<tr>Factorial a Number in AngularJS</tr>

<tr>

<td>Enter a Number </td>

<td><input type="number" ng-model="val_1" ng-init="val_1=0"/></td>

</tr>

<table>

</form>

<p>The factorial value of {{val_1}} is {{val_1 | factorial}}. </p>

</div>

</body>

</html>



Tuesday, July 20, 2021

Addition of Two Numbers in AngularJS

Addition of Two Numbers in AngularJS

Write a program that will ask the user to give two numbers, and then the program will compute the sum of the two given numbers given by the user using AngularJS.

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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.






Program Listing

<html>

<head>

<title>Addition of Two Numbers in AngularJS</title>

</head>

<style>

body {

font-family: arial;

font-size: 25px;

font-weight: bold;

}

</style>

<script type="text/javascript" src="angular.min.js"></script>

<body>

<div ng-app="">

<form>

<table border="0" cellspacing=10>

<tr>Addition of Two Numbers in AngularJS</tr>

<tr>

<td>Enter First Value  </td>

<td><input type="number" ng-model="val_1"/></td>

</tr>

<tr>

<td>Enter Second Value </td>

<td><input type="number" ng-model="val_2"></td>

</tr>

<table>

</form>

<p>The sum of {{val_1}} and {{val_2}} is {{val_1 + val_2}}. </p>

</div>

</body>

</html>


Addition of Two Numbers in Pascal

Add Two Numbers in Pascal

 In this article I will show you a simple program to ask the user to give two numbers  and the program will compute the sum of two numbers using Pascal 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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.









Program Listing

Program Add_Two_Numbers;


Uses Crt;


Var x,y,sum : integer;



Begin

   Clrscr;

   Writeln;

   Write('Add Two Numbers in Pascal');

   Writeln;

   Writeln;

   Write('Enter First Number : ');

   Readln(x);

   Write('Enter First Second : ');

   Readln(y);


   sum := (x+y);


   Writeln;

   Write('The sum of ',x, ' and ' ,y, ' is ', sum , '.');

   Writeln;

   Writeln;

   Write('End of Program');

   Writeln;

   Readln;

End.




Sunday, July 18, 2021

Calculator in Python

Calculator in Python

 

Machine Problem in Python

1. Create a calculator app
2. The user will choose between the 4 math operations (Add, Subtract, Multiply and Divide)
3. The application will ask for 2 numbers
4. Display the result
5. The application will ask again if the user wants to try again
6. Use the appropriate Exception (ex: Invalid input such as text and zero division)






Program Listing

# mod5_act2.py
# Author : Jake R. Pomperada

def calculator():
validMenuOptions = ["+", "-", "*", "/", "e"]
while True:
displayMenu()

menuSelection = input("Enter your Option: ")

# Handling user's menu input
if menuSelection not in validMenuOptions:
print("[-] Error: Invalid Input!")
elif menuSelection == "e":
print("[+] Program Terminated!")
break
else:
# Asking user to enter numbers
try:
firstNumber = float(input("Enter 1st Number: "))
secondNumber = float(input("Enter 2nd Number: "))

result = 0

# Checking each possibility and storing the output in 'result' variable
if menuSelection == "+":
result = firstNumber + secondNumber
print("[+] Answer: ", result)
elif menuSelection == "-":
result = firstNumber - secondNumber
print("[+] Answer: ", result)
elif menuSelection == "*":
result = firstNumber * secondNumber
print("[+] Answer: ", result)
elif menuSelection == "/":
if secondNumber == 0:
print("[-] Error: Cannot divide by zero")
else:
result = firstNumber / secondNumber
print("[+] Answer: ", result)
except:
print("[-] Error: Invalid Input! Only numerical input is allowed.")



def displayMenu():
print("----------------------------")
print(" Menu ")
print("Enter (+) for Addition")
print("Enter (-) for Subtraction")
print("Enter (*) for Multiplication")
print("Enter (/) for Division")
print("Enter (e) to Exit")
print("----------------------------")


if __name__ == "__main__":
calculator()

Instantiation in Python

Instantiation in Python

 
Instantiation

Instantiating a class is creating a copy of the class which  inherits all class variables and methods. Instantiating a  class in Python is simple. To instantiate a class, we simply call the class as if it were a function,  passing the arguments that the __init__ method defines.  The return value will be the newly created object.

Machine Problem in Python

1. Create a Class called Employee
2. Use the init function to collect the employee information
a. Name, email and mobile number
3. Instantiate the Employee class two times with different information
4. Display all the properties of the object.



Program Listing

# mod6_act2.py
# Author : Jake R. Pomperada

class Employee:
def __init__(self, name, email, mobile):
self.pangalan = name
self.email = email
self.contact = mobile


jp = Employee("Jake Pomperada", "jakerpomperada@gmail.com", "09123612561")
mj = Employee("Michael Jordan", "mj23@gmail.com", "09671722123")

print(f"Name: {jp.pangalan} | Email: {jp.email} | Mobile Number: {jp.contact}")
print(f"Name: {mj.pangalan} | Email: {mj.email} | M




Friday, July 16, 2021

Record Keeping App in Python

Record Keeping App in Python

 


Machine Problem in Python


1. Create a Record Keeping App

2. This will display the following options

     a. Add Record

     b. View Records

     c. Clear All Records

     d. Exit

3. If A: The user will input the following information (name,email,address)

4. The app will save the information in a text file.

     If B, display the saved records

     If C, clear the text file and display “No records found.”

     If D, display “Thank you”

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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.





Program Listing

# mod7_act1.py
# Author : Jake R. Pomperada

print("==========================================")
print(" ~ Record Keeping App ~")
print("==========================================")
print("Available Operators:")
print("A) Add Record\t\tB) View Record")
print("C) Clear Records\tD) Exit App\n")
print()
selection = str(input("Select an option [A,B,C,D]: "))

try:
file = open("record.txt", "r")
except FileNotFoundError:
file = open("record.txt", "x")

if selection.upper() == "A":
var1 = str(input("Enter Name: "))
var2 = str(input("Enter Email: "))
var3 = str(input("Enter Address: "))
file = open("record.txt", "a")
file.write(f"\n{var1}, {var2}, {var3}")
file.close()
elif selection.upper() == "B":
file = open("record.txt", "r")
print(file.read())
file.close()
elif selection.upper() == "C":
print("No records found.")
file = open("record.txt", "r+")
file.truncate(0)
file.close()
elif selection.upper() == "D":
print("Thank you")
else:
print("Invalid input.")

Inheritance in Python

Inheritance in Python

 Machine Problem Using Inheritance in Python

1. Create House Class with the following properties and methods

floorSize

noOfFloors

noOfDoors

switchOn()

lightOpen()

ovenOpen()

2. Create TownHouse Class inherit the House class

3. Modify the value of the following(noOfFloors and noOfDoors)

4. Instantiate the TownHouse Class once

5. Display all the properties

Calling the switchOn() will automatically execute lightOpen() and ovenOpen()

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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.






Program Listing

# mod6_act3.py
# Author : Jake R. Pomperada

class House:
def __init__(self, floorSize, noOfFloors, noOfDoors):
self.floorSize = floorSize
self.noOfFloors = noOfFloors
self.noOfDoors = noOfDoors

def switchOn(self):
print()
print("\tSwitch ON")
self.lightOpen()
self.ovenOpen()
print()
print("\tEnd of Program")

def lightOpen(self):
print("\tLight Open")

def ovenOpen(self):
print("\tOven Open")


class TownHouse(House):
def __init__(self, floorSize, noOfFloors, noOfDoors):
super().__init__(floorSize, noOfFloors, noOfDoors)

def displayTownHouseProperties(self):
print()
print("\tHouse Floor Size : ",self.floorSize)
print("\tHouse No. of Floors : ",self.noOfFloors)
print("\tHouse No. of Doors : ",self.noOfDoors)

TownHouse_One = TownHouse(320,3,5)
TownHouse_One.displayTownHouseProperties()
TownHouse_One.switchOn()