{"id":911,"date":"2013-10-31T15:01:51","date_gmt":"2013-10-31T08:01:51","guid":{"rendered":"http:\/\/kusumotolab.com\/?p=911"},"modified":"2013-10-31T15:01:51","modified_gmt":"2013-10-31T08:01:51","slug":"aoop-lab-day-1","status":"publish","type":"post","link":"https:\/\/oldblog.kusumotolab.com\/?p=911","title":{"rendered":"AOOP Lab day 1"},"content":{"rendered":"<p>Flower.java<\/p>\n<pre lang=\"java\">\r\npackage folwer;\r\npublic class Flower {\r\n\t\r\n\tpublic Flower() {}\r\n\t\r\n\tpublic Flower(String fname,int price) {\r\n\t\t this.fname = fname;\r\n\t\t this.price = price;\r\n\t}\r\n\t\r\n\tpublic String getFname() {\r\n\t\treturn fname;\r\n\t}\r\n\tpublic void setFname(String fname) {\r\n\t\tthis.fname = fname;\r\n\t}\r\n\tpublic int getPrice() {\r\n\t\treturn price;\r\n\t}\r\n\tpublic void setPrice(int price) {\r\n\t\tthis.price = price;\r\n\t}\r\n\t\r\n\tpublic String getDetail() {\r\n\t\treturn \"Flower\";\r\n\t}\r\n\t\r\n\tprivate String fname;\r\n\tprivate int price;\r\n\t\r\n}\r\n<\/pre>\n<p>FlowerMain.java<\/p>\n<pre lang=\"java\">\r\npackage folwer;\r\npublic class FlowerMain {\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\tSunFlower sun1 = new SunFlower(\"SunFlower\",1);\r\n\t\t\r\n\t\tTulip tul1 = new Tulip();\r\n\t\ttul1.setFname(\"myTulip\");\r\n\t\ttul1.setPrice(5);\r\n\t\t\r\n\t\tFlower orc1 = new Orchid();\r\n\t\torc1.setFname(\"myOrchid\");\r\n\t\torc1.setPrice(6);\r\n\t\t\r\n\t\tFlower fArray[] = new Flower[5];\r\n\t\tfArray[0] = sun1;\r\n\t\tfArray[1] = tul1;\r\n\t\tfArray[2] = orc1;\r\n\t\t\r\n\t\tfor(int i=0;i<=2;i++) {\r\n\t\t\tSystem.out.println(fArray[i].getFname()+\" : \"+fArray[i].getPrice());\t\r\n\t\t}\r\n\t\t\r\n\t\t\/*\r\n\t\tSystem.out.println(sun1.getFname());\r\n\t\tSystem.out.println(sun1.getPrice());\r\n\t\tSystem.out.println(tul1.getFname());\r\n\t\tSystem.out.println(tul1.getPrice());\r\n\t\tSystem.out.println(orc1.getFname());\r\n\t\tSystem.out.println(orc1.getPrice());\r\n\t\t*\/\r\n\t}\r\n\r\n}\r\n<\/pre>\n<p>Orchid.java<\/p>\n<pre lang=\"java\">\r\npackage folwer;\r\n\r\npublic class Orchid extends Flower{\r\n\t\r\n\tpublic Orchid() {}\r\n\t\r\n\t\tpublic Orchid(String fname, int price) {\r\n\t\tsuper(fname, price);\r\n\t}\r\n\t\tpublic String getDetail() {\r\n\t\t\treturn \"Orchid\";\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\tprivate String fname = \"Orchid\";\r\n\t\tprivate int price =6;\r\n}\r\n<\/pre>\n<p>SunFlower.java<\/p>\n<pre lang=\"java\">\r\npackage folwer;\r\n\r\npublic class SunFlower extends Flower{\r\n\t \r\n\r\n\tpublic SunFlower(String fname, int price) {\r\n\t\tsuper(fname, price);\r\n\t}\r\n\t\r\n\tpublic String getDetail() {\r\n\t\treturn \"SunFlower\";\r\n\t\t\r\n\t}\r\n\t\r\n\tprivate String fname = \"SunFlower\";\r\n\tprivate int price =1;\r\n\t\r\n}\r\n<\/pre>\n<p>Tulip.java<\/p>\n<pre lang=\"java\">\r\npackage folwer;\r\n\r\npublic class Tulip extends Flower{\r\n\t\r\n\tpublic Tulip() {}\r\n\tpublic Tulip(String fname, int price) {\r\n\t\tsuper(fname, price);\r\n\t}\r\n\tpublic String getDetail() {\r\n\t\treturn \"Tulip\";\r\n\t\t\r\n\t}\r\n\t\r\n\tprivate String fname = \"Tulip\";\r\n\tprivate int price =5;\r\n\t\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Flower.java package folwer; public class Flower { public Flower() {} public Flower(String fname,int price) { this.fname = fname; this.price = price; } public String getFname() { return fname; } public void setFname(String fname) { this.fname = fname; } public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } public [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":[]},"categories":[59],"tags":[],"class_list":["post-911","post","type-post","status-publish","format-standard","hentry","category-java"],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3OMEb-eH","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/oldblog.kusumotolab.com\/index.php?rest_route=\/wp\/v2\/posts\/911","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oldblog.kusumotolab.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oldblog.kusumotolab.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oldblog.kusumotolab.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oldblog.kusumotolab.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=911"}],"version-history":[{"count":1,"href":"https:\/\/oldblog.kusumotolab.com\/index.php?rest_route=\/wp\/v2\/posts\/911\/revisions"}],"predecessor-version":[{"id":912,"href":"https:\/\/oldblog.kusumotolab.com\/index.php?rest_route=\/wp\/v2\/posts\/911\/revisions\/912"}],"wp:attachment":[{"href":"https:\/\/oldblog.kusumotolab.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=911"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oldblog.kusumotolab.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=911"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oldblog.kusumotolab.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}