From baaba4a281b7d54e6b5d7767989c303b854b6932 Mon Sep 17 00:00:00 2001 From: Kamal Wickramanayake Date: Sun, 22 Feb 2026 19:43:58 +0530 Subject: Directory rename --- oop/09-polymorphism/.gitignore | 1 - oop/09-polymorphism/Customer.java | 60 ----------------------- oop/09-polymorphism/CustomerApp.java | 46 ----------------- oop/09-polymorphism/CustomerDetailsFormatter.java | 17 ------- oop/09-polymorphism/PremiumCustomer.java | 43 ---------------- 5 files changed, 167 deletions(-) delete mode 100644 oop/09-polymorphism/.gitignore delete mode 100644 oop/09-polymorphism/Customer.java delete mode 100644 oop/09-polymorphism/CustomerApp.java delete mode 100644 oop/09-polymorphism/CustomerDetailsFormatter.java delete mode 100644 oop/09-polymorphism/PremiumCustomer.java (limited to 'oop/09-polymorphism') diff --git a/oop/09-polymorphism/.gitignore b/oop/09-polymorphism/.gitignore deleted file mode 100644 index 6b468b6..0000000 --- a/oop/09-polymorphism/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.class diff --git a/oop/09-polymorphism/Customer.java b/oop/09-polymorphism/Customer.java deleted file mode 100644 index 56b0f7b..0000000 --- a/oop/09-polymorphism/Customer.java +++ /dev/null @@ -1,60 +0,0 @@ -public class Customer { - private int customerNumber; - private String name; - private String address; - private String phone; - private String mobile; - - public Customer() { - } - - public Customer(int customerNumber, String name, String address, - String phone, String mobile) { - this.customerNumber = customerNumber; - this.name = name; - this.address = address; - this.phone = phone; - this.mobile = mobile; - } - - public int getCustomerNumber() { - return customerNumber; - } - - public void setCustomerNumber(int customerNumber) { - this.customerNumber = customerNumber; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getPhone() { - return phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } - - public String getMobile() { - return mobile; - } - - public void setMobile(String mobile) { - this.mobile = mobile; - } - -} diff --git a/oop/09-polymorphism/CustomerApp.java b/oop/09-polymorphism/CustomerApp.java deleted file mode 100644 index 79e1c31..0000000 --- a/oop/09-polymorphism/CustomerApp.java +++ /dev/null @@ -1,46 +0,0 @@ -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -public class CustomerApp { - - /** - * @param args - */ - public static void main(String[] args) { - List list = new LinkedList(); - - Customer c = new Customer(1, "Kamal", "Nugegoda", "123456", "654321"); - list.add(c); - - c = new Customer(2, "Nimal", "Colombo", "2234343", "2343433"); - list.add(c); - - c = new PremiumCustomer(1, "Sunil", "Kohuwala", "23443434", "9888234", - "a", "Give him whatever he ask"); - list.add(c); - - list.add(new Date()); - - Iterator itr = list.iterator(); - - CustomerDetailsFormatter formatter = new CustomerDetailsFormatter(); - - while (itr.hasNext()) { - Customer customer = (Customer) itr.next(); // Convert "java.lang.Object" to "Customer" - String formattedString = formatter.getFormattedDescription(customer); - System.out.println(formattedString); - } - - /* - Account a1 = new SavingsAccount(); // Coercion (implicit conversion) - a1.accountClassMethod(); - - Account a1 = someMethod(); - SavingsAccount sa = (SavingsAccount) a1; // Down casting - sa.savingsAccountClassMethod(); - */ - } -} diff --git a/oop/09-polymorphism/CustomerDetailsFormatter.java b/oop/09-polymorphism/CustomerDetailsFormatter.java deleted file mode 100644 index d2640e0..0000000 --- a/oop/09-polymorphism/CustomerDetailsFormatter.java +++ /dev/null @@ -1,17 +0,0 @@ -public class CustomerDetailsFormatter { - - /** - * Format the customer object according to some needs - * @param c - * @return - */ - public String getFormattedDescription(Customer c) { - String buffer = "Customer description: \n"; - buffer += " Number: " + c.getCustomerNumber(); - buffer += " Name: " + c.getName(); - buffer += " Address: " + c.getAddress(); - buffer += "\n"; - - return buffer; - } -} diff --git a/oop/09-polymorphism/PremiumCustomer.java b/oop/09-polymorphism/PremiumCustomer.java deleted file mode 100644 index a098af5..0000000 --- a/oop/09-polymorphism/PremiumCustomer.java +++ /dev/null @@ -1,43 +0,0 @@ -public class PremiumCustomer extends Customer { - - private String category; - private String desction; - - - public PremiumCustomer() { - } - - public PremiumCustomer(int customerNumber, String name, String address, - String phone, String mobile) { - super(customerNumber, name, address, phone, mobile); - } - - - public PremiumCustomer(int customerNumber, String name, String address, - String phone, String mobile, String category, String desction) { - super(customerNumber, name, address, phone, mobile); - this.category = category; - this.desction = desction; - } - - public PremiumCustomer(String category, String desction) { - super(); - this.category = category; - this.desction = desction; - } - - public String getCategory() { - return category; - } - public void setCategory(String category) { - this.category = category; - } - public String getDesction() { - return desction; - } - public void setDesction(String desction) { - this.desction = desction; - } - - -} -- cgit v1.2.3