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
Sunday, September 15, 2024
Saturday, September 14, 2024
Friday, September 13, 2024
Wednesday, September 11, 2024
Tuesday, September 10, 2024
Monday, September 9, 2024
Sunday, September 8, 2024
Student Records Using Encapsulation in Python
Student Records Using Encapsulation in Python
ScreenshotProgram Listing
class Student:
self.name = student_name
self.age = student_age
self.grade = student_grade
def get_name(self):
return self.name
def get_age(self):
return self.age
def get_grade(self):
return self.grade
def set_name(self, student_name):
self.name = student_name
def set_age(self, student_age):
self.age = student_age
def set_grade(self, student_grade):
self.grade = student_grade
if __name__ == "__main__":
student = Student("Julianna Rae Pomperada", 16, 92)
print("\n\tStudent Records Using Encapsulation in Python")
print("\n\tDisplay Student Record\n")
print("\tStudent Name: " + student.get_name())
print("\tStudent Age: " + str(student.get_age()) + " years")
print("\tStudent Grade: " + str(student.get_grade()))
student.set_name("Jacob Samuel Pomperada")
student.set_age(18)
student.set_grade(88)
print("\n\tUpdated Student Record\n")
print("\tStudent Name: " + student.get_name())
print("\tStudent Age: " + str(student.get_age()) + " years old.")
print("\tStudent Grade: " + str(student.get_grade()))
print("\n\tEnd of Program. Thank you for using this program.")
Friday, September 6, 2024
Thursday, September 5, 2024
Wednesday, September 4, 2024
Tuesday, September 3, 2024
Monday, September 2, 2024
Sunday, September 1, 2024
Friday, August 30, 2024
Tuesday, August 27, 2024
Monday, August 26, 2024
Saturday, August 24, 2024
Thursday, August 22, 2024
Wednesday, August 21, 2024
Tuesday, August 20, 2024
Monday, August 19, 2024
Sunday, August 18, 2024
Saturday, August 17, 2024
Friday, August 16, 2024
Thursday, August 15, 2024
Wednesday, August 14, 2024
Addition and Subtraction of Two Numbers Using Polymorphism in JavaScript
Program Listing
Tuesday, August 13, 2024
Monday, August 12, 2024
Sunday, August 11, 2024
Thursday, August 8, 2024
Wednesday, August 7, 2024
Tuesday, August 6, 2024
Monday, August 5, 2024
Sunday, August 4, 2024
Saturday, August 3, 2024
Friday, August 2, 2024
Thursday, August 1, 2024
Tuesday, July 30, 2024
Sunday, July 28, 2024
Saturday, July 27, 2024
Friday, July 26, 2024
Thursday, July 25, 2024
Wednesday, July 24, 2024
Tuesday, July 23, 2024
Addition and Subtraction Using Polymorphism in Java
Program Listing
import java.util.Scanner;
class MathOperation {
public int performOperation(int a, int b) {
return 0; // Base class default implementation
}
}
class Addition extends MathOperation {
@Override
public int performOperation(int a, int b) {
return a + b;
}
}
class Subtraction extends MathOperation {
@Override
public int performOperation(int a, int b) {
return a - b;
}
}
public class Main {
public static void main(String[] args) {
MathOperation operation = null;
int num1, num2;
char op;
Scanner scanner = new Scanner(System.in);
System.out.println("\n\n\tAddition and Subtraction Using Polymorphism in Java\n");
System.out.print("\tEnter two numbers: ");
num1 = scanner.nextInt();
num2 = scanner.nextInt();
System.out.print("\tEnter the operation (+ for addition, - for subtraction): ");
op = scanner.next().charAt(0);
if (op == '+') {
operation = new Addition();
} else if (op == '-') {
operation = new Subtraction();
} else {
System.out.println("\tInvalid operation.");
return;
}
int result = operation.performOperation(num1, num2);
System.out.println("\n\tThe Result: " + result);
scanner.close();
System.out.println("\n\tEnd of Program. Thank you for using this program.");
}
}
Monday, July 22, 2024
Friday, July 19, 2024
Thursday, July 18, 2024
Wednesday, July 17, 2024
Tuesday, July 16, 2024
Monday, July 15, 2024
Simple Calculator Using Abstraction in C++
Program Listing
#include <iostream>
// Abstract class for calculator operations
class Operation {
public:
virtual double calculate(double a, double b) = 0;
};
// Concrete subclasses for each operation
class Addition : public Operation {
public:
double calculate(double a, double b) override {
return a + b;
}
};
class Subtraction : public Operation {
public:
double calculate(double a, double b) override {
return a - b;
}
};
class Multiplication : public Operation {
public:
double calculate(double a, double b) override {
return a * b;
}
};
class Division : public Operation {
public:
double calculate(double a, double b) override {
if (b == 0) {
std::cerr << "Error: Division by zero is not allowed." << std::endl;
return 0; // Return 0 as an error value
}
return a / b;
}
};
int main() {
double num1, num2;
char operation;
std::cout <<"\n\n\tSimple Calculator Using Abstraction in C++\n";
std::cout << "\n\tGive two numbers: ";
std::cin >> num1 >> num2;
std::cout << "\tEnter the operation (+, -, *, /): ";
std::cin >> operation;
Operation* op = nullptr;
switch (operation) {
case '+':
op = new Addition();
break;
case '-':
op = new Subtraction();
break;
case '*':
op = new Multiplication();
break;
case '/':
op = new Division();
break;
default:
std::cerr << "\tError: Invalid operation." << std::endl;
return 1;
}
double result = op->calculate(num1, num2);
std::cout << "\n\tThe Result: " << result << std::endl;
std::cout << "\n\n\tEnd of Program. Thank you for using this program." << std::endl;
delete op;
return 0;
}
Sunday, July 14, 2024
Empower Your Business with My IT Consulting Services!
Empower Your Business with My IT Consulting Services!
Are you navigating the complexities of modern technology? Gain a competitive edge with tailored IT solutions crafted to meet your unique business challenges. As a seasoned consultant specializing in Computer Organization, Operating Systems, and Database Systems, I provide strategic guidance and hands-on expertise to drive your business forward.
** My Services Offered:**
- **Strategic IT Planning:** Align technology with your business goals for sustainable growth and efficiency.
- **Infrastructure Assessment and Optimization:** Enhance performance and reliability through streamlined infrastructure solutions.
- **Security and Compliance:** Safeguard your assets with robust cybersecurity measures and regulatory compliance strategies.
- **Cloud Integration and Migration:** Harness the power of cloud technologies for scalability and cost-efficiency.
- **IT Project Management:** From inception to completion, ensure smooth project execution and delivery.
Partner with me to transform challenges into opportunities. Contact today to discuss how I can optimize your IT infrastructure and propel your business to new heights.
Feel free to personalize it further to highlight specific achievements, client successes, or industry expertise that set you apart! You may contact me here in the Philippines at
my mobile number 09173084360 and my email address at
jakerpomperada@gmail.com
Dr. Jake R. Pomperada,MAED-IT,MIT, PHD-TM
Freelance IT Consultant