STIA1123-A202-GROUP-I / EXERCISES

0 stars 0 forks source link

class2 #7

Closed AsmaNasir47 closed 3 years ago

AsmaNasir47 commented 3 years ago

package Exercise;

public class Class2 {

String phone = "iPhone"; String makecall = "make a call"; String playgame = "play games";

void printPhone() {
    System.out.println(phone);
}
void printMakeCall() {
    System.out.println(makecall);
}
void printPlayGame() {
    System.out.println(playgame);
}

}

AsmaNasir47 commented 3 years ago

package Exercise;

public class Class3 {

String kettle = "kettle"; 
String heat = "heat water";
String warm = "keep water warm";

    void printKettle() {
        System.out.println(kettle);
    }
    void prinHeat() {
        System.out.println(heat);
    }
    void printWarm() {
        System.out.println(warm);
    }

}

AsmaNasir47 commented 3 years ago

package Exercise;

public class Main {

public static void main(String[] args) {

    Class2 b = new Class2();
    b.printPhone();
    b.printMakeCall();
    b.printPlayGame();  

    Class3 c = new Class3();
    c.printKettle();
    c.prinHeat();
    c.printWarm();
}

}