courtrigrad
- 1,236
- 2
Hello all
I need help in writing a subclass (ManMade) that has 2 constructors and 3 isntance variables. Here is my code so far:
I am not sure whether i am doing this right.
any help is appreciated
I need help in writing a subclass (ManMade) that has 2 constructors and 3 isntance variables. Here is my code so far:
Code:
public class Thing
{
private double length; // instance variables (fields)
private double height;
private double width;
private boolean isPurpleFox;
private double age;
private static boolean exists;
//*******************************//
public Thing()
{
length = 7;
height = 8;
isPurpleFox = false;
age = 0;
exists = true;
width = 10;
}
//======================================
public double getlength()
{
return length;
}
public void setAge(double a)
{
age = a;
}
public double getage()
{
return age;
}
public boolean getexists()
{
return exists;
}
public void setexists(boolean b)
{
exists = b;
}
public void Triple(int a)
{
a = a*3;
System.out.println(a);
}
public Thing (double l, double w, double h )
{
length = l;
width = w;
height = h;
}
}
// Subclass of Superclass
// Thing
public class ManMade extends Thing { // inherits from Thing
private string name;
private double volume;
private double surfarea;
// no argument constructor
public ManMade()
{
super(0, 0); // call the superclass contructor
name = ;
}
// Constructor
public ManMade( double l, double, w, double h, char s )
{
super( l, w, h); // call the superclass constructor
setName( "Bob" )
setVolume( v );
setSurarea( S );
I am not sure whether i am doing this right.
any help is appreciated