From 437c39b27f061d0d348cafc9e29bbff3b50fd149 Mon Sep 17 00:00:00 2001 From: ajhalili2006 Date: Mon, 16 Feb 2026 02:36:29 +0000 Subject: [PATCH] chore: get cooking finally at 02 Laboratory Exercise Signed-off-by: ajhalili2006 --- .../studentops/projects/ComProg2_Lab2_v1.java | 75 ++++++------ .../studentops/projects/ComProg2_Lab2_v2.java | 107 ++++++++++------ .../studentops/projects/ComProg2_Lab2_v3.java | 115 ++++++++++++------ 3 files changed, 191 insertions(+), 106 deletions(-) diff --git a/java/src/dev/andreijiroh/studentops/projects/ComProg2_Lab2_v1.java b/java/src/dev/andreijiroh/studentops/projects/ComProg2_Lab2_v1.java index 19d4c72..f12b8a5 100644 --- a/java/src/dev/andreijiroh/studentops/projects/ComProg2_Lab2_v1.java +++ b/java/src/dev/andreijiroh/studentops/projects/ComProg2_Lab2_v1.java @@ -2,52 +2,59 @@ package dev.andreijiroh.studentops.projects; /** * Computer Programming 2 - 02 Laboratory Exercise + * v1 - Initial version * @author Andrei Jiroh Halili (STI College Meycauayan) */ -interface Self { - void introduce(); -}; +class ComProg2_Lab2_v1 { + /** + * Our basic interface for introducing ourselves + */ + interface Self { + void introduce(); + }; -class Halili implements Self { - int age; - String[] interests; - String[] skills; + /** + * The extender part of the initial interface + */ + interface Self_addon extends Self { + void webAndSocials(); + } - public void introduce() { - this.age = age; - this.interests = interests; - this.skills = skills; + static class Halili implements Self { + int age; + String[] interests; + String[] skills; - System.out.println("Age: "+age); - System.out.println("Interests"); - for (int i = 0; i < interests.length; i++) { - System.out.println("- "+interests[i]); - } - System.out.println("Skills"); - for (int i = 0; i < skills.length; i++) { - System.out.println("- "+skills[i]); - } - }; -} + public void introduce() { + System.out.println("Age: "+age); + System.out.println("Interests"); + for (int i = 0; i < interests.length; i++) { + System.out.println("- "+interests[i]); + } + System.out.println("Skills"); + for (int i = 0; i < skills.length; i++) { + System.out.println("- "+skills[i]); + } + }; + } -class AndreiJiroh extends Halili { - String website; - String[] socials; + static class AndreiJiroh extends Halili implements Self_addon { + String website; + String[] socials; - public void webAndSocials() { - System.out.println("Website: "+website); - System.out.println("Socials:"); - for (int i = 0; i < socials.length; i++) { - System.out.println("- "+socials[i]); + public void webAndSocials() { + System.out.println("Website: "+website); + System.out.println("Socials:"); + for (int i = 0; i < socials.length; i++) { + System.out.println("- "+socials[i]); + } } - } -}; + }; -class ComProg2_Lab2_v1 { public static void main(String[] args) { int age = 20; String[] interests = {"Nixpkgs/Nix/NixOS","electronic music","Minecraft"}; - String[] skills = {"Backend development in TypeScript", "Linux shell scripting"}; + String[] skills = {"Backend development in TypeScript", "Linux shell scripting", "Technical documentation writing", "DevOps with Docker and GitHub Actions + GitLab Ci"}; String website = "https://andreijiroh.dev"; String[] socials = {"https://tilde.zone/@ajhalili2006", "https://bsky.app/profile/andreijiroh.dev", "https://instagram.com/ajhalili2006", "https://youtube.com/@ajhalili2006", "https://x.com/ajhalili2006"}; diff --git a/java/src/dev/andreijiroh/studentops/projects/ComProg2_Lab2_v2.java b/java/src/dev/andreijiroh/studentops/projects/ComProg2_Lab2_v2.java index 97df210..d559386 100644 --- a/java/src/dev/andreijiroh/studentops/projects/ComProg2_Lab2_v2.java +++ b/java/src/dev/andreijiroh/studentops/projects/ComProg2_Lab2_v2.java @@ -2,54 +2,85 @@ package dev.andreijiroh.studentops.projects; /** * Computer Programming 2 - 02 Laboratory Exercise + * v2 - method overriding * @author Andrei Jiroh Halili (STI College Meycauayan) */ -interface Self { - void introduce(); -}; - -class Halili implements Self { - int age; - String[] interests; - String[] skills; - - public void introduce() { - this.age = age; - this.interests = interests; - this.skills = skills; - - System.out.println("Age: "+age); - System.out.println("Interests"); - for (int i = 0; i < interests.length; i++) { - System.out.println("- "+interests[i]); - } - System.out.println("Skills"); - for (int i = 0; i < skills.length; i++) { - System.out.println("- "+skills[i]); - } +class ComProg2_Lab2_v2 { + + /** + * Our basic interface for introducing ourselves + */ + interface Self { + void introduce(); }; -} -class AndreiJiroh extends Halili { - String website; - String[] socials; + /** + * The extender part of the initial interface + */ + interface Self_addon extends Self { + void webAndSocials(); + } - public void webAndSocials() { - System.out.println("Website: "+website); - System.out.println("Socials:"); - for (int i = 0; i < socials.length; i++) { - System.out.println("- "+socials[i]); - } + static class Halili implements Self { + int age; + String[] interests; + String[] skills; + + public void introduce() { + System.out.println("Age: "+age); + System.out.println("Interests"); + for (int i = 0; i < interests.length; i++) { + System.out.println("- "+interests[i]); + } + System.out.println("Skills"); + for (int i = 0; i < skills.length; i++) { + System.out.println("- "+skills[i]); + } + }; } -}; -class ComProg2_Lab2_v2 { + static class AndreiJiroh extends Halili implements Self_addon { + String website; + String[] socials; + /** + * If pronouns are unknown, use they/them in the meanwhile. + */ + String pronouns = "they/them"; + String hometown; + + @Override + public void introduce() { + System.out.println("Age: "+age); + System.out.println("Pronouns: "+pronouns); + System.out.println("Hometown: "+hometown); + + System.out.println("Interests"); + for (int i = 0; i < interests.length; i++) { + System.out.println("- "+interests[i]); + } + System.out.println("Skills"); + for (int i = 0; i < skills.length; i++) { + System.out.println("- "+skills[i]); + } + } + + public void webAndSocials() { + System.out.println("Website: "+website); + System.out.println("Socials:"); + for (int i = 0; i < socials.length; i++) { + System.out.println("- "+socials[i]); + } + } + }; + public static void main(String[] args) { int age = 20; + String pronouns = "he/they"; String[] interests = {"Nixpkgs/Nix/NixOS","electronic music","Minecraft"}; - String[] skills = {"Backend development in TypeScript", "Linux shell scripting"}; + String[] skills = {"Backend development in TypeScript", "Linux shell scripting", "Technical documentation writing", "DevOps with Docker and GitHub Actions + GitLab Ci"}; String website = "https://andreijiroh.dev"; String[] socials = {"https://tilde.zone/@ajhalili2006", "https://bsky.app/profile/andreijiroh.dev", "https://instagram.com/ajhalili2006", "https://youtube.com/@ajhalili2006", "https://x.com/ajhalili2006"}; + String hometown = "Marilao, Bulacan, Philippines"; AndreiJiroh self = new AndreiJiroh(); self.age = age; @@ -57,7 +88,9 @@ class ComProg2_Lab2_v2 { self.skills = skills; self.website = website; self.socials = socials; + self.pronouns = pronouns; + self.hometown = hometown; self.introduce(); self.webAndSocials(); } -} \ No newline at end of file +} diff --git a/java/src/dev/andreijiroh/studentops/projects/ComProg2_Lab2_v3.java b/java/src/dev/andreijiroh/studentops/projects/ComProg2_Lab2_v3.java index cb5b04b..61d8e13 100644 --- a/java/src/dev/andreijiroh/studentops/projects/ComProg2_Lab2_v3.java +++ b/java/src/dev/andreijiroh/studentops/projects/ComProg2_Lab2_v3.java @@ -2,62 +2,107 @@ package dev.andreijiroh.studentops.projects; /** * Computer Programming 2 - 02 Laboratory Exercise + * v3 - method overriding + super calls * @author Andrei Jiroh Halili (STI College Meycauayan) */ -interface Self { - void introduce(); -}; - -class Halili implements Self { - int age; - String[] interests; - String[] skills; - - public void introduce() { - this.age = age; - this.interests = interests; - this.skills = skills; - - System.out.println("Age: "+age); - System.out.println("Interests"); - for (int i = 0; i < interests.length; i++) { - System.out.println("- "+interests[i]); +class ComProg2_Lab2_v3 { + + /** + * Our basic interface for introducing ourselves + */ + interface Self { + void introduce(); + }; + + /** + * The extender part of the initial interface + */ + interface Self_addon extends Self { + void webAndSocials(); + } + + static class Halili implements Self { + int age; + String[] interests; + String[] skills; + + public void introduce() { + System.out.println("Age: "+age); + System.out.println("Interests"); + for (int i = 0; i < interests.length; i++) { + System.out.println("- "+interests[i]); + } + System.out.println("Skills"); + for (int i = 0; i < skills.length; i++) { + System.out.println("- "+skills[i]); + } + }; + } + + static class AndreiJiroh extends Halili implements Self_addon { + String website; + String[] socials; + /** + * If pronouns are unknown, use they/them in the meanwhile. + */ + String pronouns = "they/them"; + String hometown; + + @Override + public void introduce() { + System.out.println("Age: "+age); + System.out.println("Pronouns: "+pronouns); + System.out.println("Hometown: "+hometown); + + System.out.println("Interests"); + for (int i = 0; i < interests.length; i++) { + System.out.println("- "+interests[i]); + } + System.out.println("Skills"); + for (int i = 0; i < skills.length; i++) { + System.out.println("- "+skills[i]); + } } - System.out.println("Skills"); - for (int i = 0; i < skills.length; i++) { - System.out.println("- "+skills[i]); + + public void webAndSocials() { + System.out.println("Website: "+website); + System.out.println("Socials:"); + for (int i = 0; i < socials.length; i++) { + System.out.println("- "+socials[i]); + } } }; -} -class AndreiJiroh extends Halili { - String website; - String[] socials; + static class Eugenio extends AndreiJiroh implements Self_addon { + String email; - public void webAndSocials() { - System.out.println("Website: "+website); - System.out.println("Socials:"); - for (int i = 0; i < socials.length; i++) { - System.out.println("- "+socials[i]); + @Override + public void webAndSocials() { + super.webAndSocials(); + System.out.println("Email: "+email); } } -}; -class ComProg2_Lab2_v3 { public static void main(String[] args) { int age = 20; + String pronouns = "he/they"; String[] interests = {"Nixpkgs/Nix/NixOS","electronic music","Minecraft"}; - String[] skills = {"Backend development in TypeScript", "Linux shell scripting"}; + String[] skills = {"Backend development in TypeScript", "Linux shell scripting", "Technical documentation writing", "DevOps with Docker and GitHub Actions + GitLab Ci"}; String website = "https://andreijiroh.dev"; String[] socials = {"https://tilde.zone/@ajhalili2006", "https://bsky.app/profile/andreijiroh.dev", "https://instagram.com/ajhalili2006", "https://youtube.com/@ajhalili2006", "https://x.com/ajhalili2006"}; + String hometown = "Marilao, Bulacan, Philippines"; + String email = "ajhalili2006@andreijiroh.dev"; - AndreiJiroh self = new AndreiJiroh(); + Eugenio self = new Eugenio(); self.age = age; self.interests = interests; self.skills = skills; self.website = website; self.socials = socials; + self.pronouns = pronouns; + self.hometown = hometown; + self.email = email; self.introduce(); self.webAndSocials(); } -} \ No newline at end of file +} -- 2.51.2