* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package overriding;
/**
*
* @author User
*/
public class perabot {
public String merk;
public String fungsi;
public String tempat;
/**
* @return the merk
*/
public String getMerk() {
return merk;
}
/**
* @param merk the merk to set
*/
public void setMerk(String merk) {
this.merk = merk;
}
/**
* @return the fungsi
*/
public String getFungsi() {
return fungsi;
}
/**
* @param fungsi the fungsi to set
*/
public void setFungsi(String fungsi) {
this.fungsi = fungsi;
}
/**
* @return the tempat
*/
public String getTempat() {
return tempat;
}
/**
* @param tempat the tempat to set
*/
public void setTempat(String tempat) {
this.tempat = tempat;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package overriding;
/**
*
* @author User
*/
public class perabotkompor extends perabot{
public String panas;
public perabotkompor(String panas){
this.panas = panas;
}
public perabotkompor(String merk, String fungsi, String tempat){
this.merk = merk;
this.fungsi = fungsi;
this.tempat = tempat;
}
/**
* @return the panas
*/
public String getPanas() {
return panas;
}
/**
* @param panas the panas to set
*/
public void setPanas(String panas) {
this.panas = panas;
}
@Override
public String getMerk(){
return merk;
}
@Override
public void setMerk(String merk){
this.merk = merk;
}
@Override
public String getFungsi(){
return fungsi;
}
@Override
public void setFungsi(String fungsi){
this.fungsi = fungsi;
}
@Override
public String getTempat(){
return tempat;
}
@Override
public void setTempat(String tempat){
this.tempat = tempat;
}
public static void main(String[] args) {
perabotkompor a = new perabotkompor ("Untuk Memasak");
System.out.println("Perabot Kompor" + a.getPanas());
perabotkompor b = new perabotkompor("Rinai", "Untuk memasak", "Di dapur");
System.out.println("Merk : " + b.getMerk() + "\nFungsi : " + b.getFungsi() + "\nTempat : " + b.getTempat());
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package overriding;
/**
*
* @author User
*/
public class perabotkulkas extends perabot{
public String dingin;
public perabotkulkas(String dingin){
this.dingin = dingin;
}
public perabotkulkas(String merk, String fungsi, String tempat){
this.merk = merk;
this.fungsi = fungsi;
this.tempat = tempat;
}
/**
* @return the dingin
*/
public String getDingin() {
return dingin;
}
/**
* @param dingin the dingin to set
*/
public void setDingin(String dingin) {
this.dingin = dingin;
}
@Override
public String getMerk(){
return merk;
}
@Override
public void setMerk(String merk){
this.merk = merk;
}
@Override
public String getFungsi(){
return fungsi;
}
@Override
public void setFungsi(String fungsi){
this.fungsi = fungsi;
}
@Override
public String getTempat(){
return tempat;
}
@Override
public void setTempat(String tempat){
this.tempat = tempat;
}
public static void main(String[] args) {
perabotkulkas x = new perabotkulkas("Bisa mendinginkan makanan");
System.out.println("Perabot Kulkas " + x.getDingin());
perabotkulkas y = new perabotkulkas("Panasonic", "Penyimpan makanan", "Di dapur");
System.out.println("Merk : " + y.getMerk() + "\nFungsi : " + y.getFungsi() + "\nTempat : " + y.getTempat());
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package overriding;
/**
*
* @author User
*/
public class perabottv extends perabot{
public String info;
public perabottv(String info){
this.info = info;
}
public perabottv(String merk, String fungsi, String tempat){
this.merk = merk;
this.fungsi = fungsi;
this.tempat = tempat;
}
/**
* @return the panas
*/
public String getInfo() {
return info;
}
/**
* @param info the panas to set
*/
public void setInfo(String info) {
this.info = info;
}
@Override
public String getMerk(){
return merk;
}
@Override
public void setMerk(String merk){
this.merk = merk;
}
@Override
public String getFungsi(){
return fungsi;
}
@Override
public void setFungsi(String fungsi){
this.fungsi = fungsi;
}
@Override
public String getTempat(){
return tempat;
}
@Override
public void setTempat(String tempat){
this.tempat = tempat;
}
public static void main(String[] args) {
perabottv z = new perabottv("Bisa memeberikan informasi");
System.out.println("Perabot Tv " + z.getInfo());
perabottv v = new perabottv("Samsung", "Mendapatkan Informasi dan Hiburan", "Ruang Keluarga");
System.out.println("Merk : " + v.getMerk() + "\nFungsi : " + v.getFungsi() + "\nTempat : " + v.getTempat());
}
}
Posted by 00.13 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar