subject

Squares - Javascript In this exercise, we are going to model some behaviors of a square. Since the Square object extends the Rectangle object, we see that a lot of the information we need is stored in the superclass and we will need to access it using the super keyword. Your job is to complete the Square class, as specified within the class. Upon completion, thoroughly test out your code using the SquareTester class.
public class SquareTester
{
public static void main(String[] args)
{
Square square = new Square(5);
Rectangle rectangle = new Rectangle (5, 7);

System. out. println(square);
System. out. println(rectangle);
}
}

public class Rectangle
{

private double width;
private double height;

public Rectangle(double w, double h)
{
width = w;
height = h;
}

public double getWidth()
{
return width;
}

public void setWidth(double w)
{
width = w;
}

public double getHeight()
{
return height;
}

public void setHeight(double h)
{
height = h;
}

public double area()
{
return width * height;
}

public String toString(){
return "Rectangle with width " + width + " and height " + height;
}
}

public class Square extends Rectangle {

// Call to the Rectangle constructor
public Square(double sideLength){

}

// Return either the width or height from the superclass
public double getSideLength(){

}

//Set both the width and height in the superclass
public void setSideLength(double sideLength){

}

// Get the width and/or the height from the superclass
public double area(){

}

// Override to read: Square with side lengths
public String toString(){

}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:00
Write a method named addall that could be placed inside the hashintset class. this method accepts another hashintset as a parameter and adds all elements from that set into the current set, if they are not already present. for example, if a set s1 contains [1, 2, 3] and another set s2 contains [1, 7, 3, 9], the call of s1.addall(s2); would change s1 to store [1, 2, 3, 7, 9] in some order. you are allowed to call methods on your set and/or the other set. do not modify the set passed in. this method should run in o(n) time where n is the number of elements in the parameter set passed in.
Answers: 2
question
Computers and Technology, 23.06.2019 01:30
Negative methods of behavior correction include all but this: sarcasm verbal abuse setting an example for proper behavior humiliation
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
How to do this programming flowchart?
Answers: 3
question
Computers and Technology, 23.06.2019 21:20
In microsoft word, when you highlight existing text you want to replace, you're in              a.  advanced mode.    b.  automatic mode.    c.  basic mode.    d.  typeover mode
Answers: 1
You know the right answer?
Squares - Javascript In this exercise, we are going to model some behaviors of a square. Since the...
Questions