What's new

Java Patulong po sa java mga boss

Status
Not open for further replies.

Lucifer Mrnngstr

Established
Joined
Jul 12, 2017
Posts
137
Reaction
14
Age
27
Mga boss dko po alam pano mag store ng objects sa array bale subclasses po tos ioutput using loop.

Ganto po dapat output. Salamat in advance mga boss.
Screenshot_20220515_173144.jpg


Ask lng po. Kelangan ba dito ng if-else para no Gore-Tex at Gore-Tex ung output??

Heto po ung mga codes:

//Main.java

package SubnSupr;


public class Main {
public static void main(String args[]) {
Running r = new Running(250, "Nike", 43);
Walking w1 = new Walking(true, "Hanwag", 43.5);
Walking w2 = new Walking(false, "Merrell", 42);


Shoe[] arr = {r, w1, w2};

}
}

// Superclass: Shoe.java

package SubnSupr;


public class Shoe {


public final String brand;
public final double size;


Shoe(String brand, double size) {
this.brand = brand;
this.size = size;
}
}

//Subclass: Walking.java

package SubnSupr;


public class Walking extends Shoe {


public final boolean goreTex;


Walking(boolean goreTex, String brand, double size) {
super(brand, size);
this.goreTex = goreTex;
}
}

//Sublcass Running.java

package SubnSupr;

public class Running extends Shoe{

public final double weight;

Running(double weight, String brand, double size) {
super(brand, size);
this.weight = weight;
}
}
 

Attachments

X

Xin Taru Jiang

sa fb ka humingi nang tulong sa mga groups malabo kasing may maka notice minsan nang thread na ganto tas kung meron man matatagalan.
 
Status
Not open for further replies.
Top