nurulErina / assignment-2-new

0 stars 0 forks source link

ASSIGNMENT 2 #1

Open nurulErina opened 3 years ago

nurulErina commented 3 years ago

public class skincare {

public static void main(String[] args) {
// TODO Auto-generated method stub
BrandsSkincareN b = new BrandsSkincareN();
HowToUse h = new HowToUse();
WhereToBuy w = new WhereToBuy();
b.setSkincare("cleansing ", "moisturing ", "toner ", "serum ");

//CLEANSING System.out.println("Type of Skincare: " + b.getCleansing()); System.out.println("Brand that this type have: "); System.out.println(b.getBrand1()); System.out.println(b.getBrand2()); System.out.println(b.getBrand3()); System.out.println(b.getBrand4()); System.out.println(""); h.UseCleansing(); //POLYMORPHISM System.out.println(""); w.WhereToBuy(); //ABSTRACTION w.location(); System.out.println("---------------------------------");

//MOISTURING System.out.println("Type of Makeup: " + b.getMoisturing()); System.out.println("Brand that this type have: "); System.out.println(b.getBrand1()); System.out.println(b.getBrand2()); System.out.println(b.getBrand3()); System.out.println(b.getBrand4()); System.out.println(""); h.UseMoisturing(); //POLYMORPHISM System.out.println(""); w.WhereToBuy(); //ABSTRACTION w.location(); System.out.println("---------------------------------");

//TONER System.out.println("Type of Skincare: " + b.getToner()); System.out.println("Brand that this type have: "); System.out.println(b.getBrand1()); System.out.println(b.getBrand2()); System.out.println(b.getBrand3()); System.out.println(b.getBrand4()); System.out.println(""); h.UseToner(); //POLYMORPHISM System.out.println(""); w.WhereToBuy(); //ABSTRACTION w.location(); System.out.println("---------------------------------");

//SERUM System.out.println("Type of Skincare: " + b.getSerum()); System.out.println("Brand that this type have: "); System.out.println(b.getBrand1()); System.out.println(b.getBrand2()); System.out.println(b.getBrand3()); System.out.println(b.getBrand4()); System.out.println(""); h.UseSerum(); //POLYMORPHISM System.out.println(""); w.WhereToBuy(); //ABSTRACTION w.location();

} }

nurulErina commented 3 years ago

public class BrandsSkincareN extends TypeOfSkincare{

    String Brand1, Brand2, Brand3, Brand4;

     public void Branding(String Safi, String Simple, String Biore, String Himalaya){
     this.Brand1 = Safi;
     this.Brand2 = Simple;
     this.Brand3 = Biore;
     this.Brand4 = Himalaya;
     }

     public void setBrand1(String Safi){
     this.Brand1 = Safi;
     }

     public void setBrand2(String Simple){
     this.Brand2 = Simple;
     }

     public void setBrand3(String Biore){
     this.Brand3 = Biore;
     }

     public void setBrand4(String Himalaya){
     this.Brand4 = Himalaya;
     }

     public String getBrand1(){
     return Brand1;
     }

     public String getBrand2(){
     return Brand2;
     }

     public String getBrand3(){
     return Brand3;
     }

     public String getBrand4(){
     return Brand4;
     }

    }
nurulErina commented 3 years ago

public class HowToUse extends TypeOfSkincare { //Cleansing void UseCleansing(){ super.HowToUse(); System.out.println("Apply on your face."); }

     //Moisturing
     void UseMoisturing(){
     super.HowToUse();
     System.out.println("Apply it on your face after cleansing your face.");
     }

     //Toner
     void UseToner(){
     super.HowToUse();
     System.out.println("Apply it on your face after the moisturing.");
     }

     //Serum
     void UseSerum(){
     super.HowToUse();
     System.out.println("Apply it on your last step in your face.");
     }
    }
nurulErina commented 3 years ago

public abstract class TypeOfSkincare { String cleansing, moisturing, toner, serum;

public void setSkincare(String newcleansing, String newmoisturing, String newtoner, String newserum){ cleansing = newcleansing; moisturing = newmoisturing; toner = newtoner; serum = newserum; }

public String getCleansing(){ return cleansing; }

public String getMoisturing(){ return moisturing; }

public String getSerum(){ return toner; }

public String getToner(){ return serum; }

void HowToUse(){ System.out.println("How to use this item: "); }

void WhereToBuy(){ System.out.println("You can find this item at: "); } }

nurulErina commented 3 years ago

public class WhereToBuy extends TypeOfSkincare {

public void location(){

    System.out.println("1. Watson \n2.Guardian \n3.Pharmacy");
     }
    }
nurulErina commented 3 years ago

output:

Type of Skincare: cleansing Brand that this type have: Safi Simple Biore Himalaya

How to use this item: Apply on your face.

You can find this item at:

  1. Watson 2.Guardian 3.Pharmacy

    Type of Makeup: moisturing Brand that this type have: Safi Simple Biore Himalaya

How to use this item: Apply it on your face after cleansing your face.

You can find this item at:

  1. Watson 2.Guardian 3.Pharmacy

    Type of Skincare: serum Brand that this type have: Safi Simple Biore Himalaya

How to use this item: Apply it on your face after the moisturing.

You can find this item at:

  1. Watson 2.Guardian 3.Pharmacy

    Type of Skincare: toner Brand that this type have: Safi Simple Biore Himalaya

How to use this item: Apply it on your last step in your face.

You can find this item at:

  1. Watson 2.Guardian 3.Pharmacy