subject

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: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:20
The reset circuit used on the four 3-bit counters analyzed in this activity reset the counts to zero (000). it makes sense for the up-counters to start at zero (000), but the down-counters should start at seven (111). what would you need to change so that the 3-bit binary down counter with j/k flip-flops you just created would reset to seven (111)?
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
What type of slide show is a dynamic and eye-catching way to familiarize potential customers with what your company has to offer? a. ole b. photo album c. brochure d. office clipboard
Answers: 2
question
Computers and Technology, 24.06.2019 03:30
Auniform resource locator (url) is a formatted string of text that web browsers, email applications, and other software programs use to identify a particular resource on the internet. true false
Answers: 2
question
Computers and Technology, 24.06.2019 22:00
Difference between ancient and modern mode of information transmission
Answers: 1
You know the right answer?
In this exercise, we are going to model some behaviors of a square. Since the Square object extends...
Questions
question
Biology, 11.02.2020 04:26
question
Mathematics, 11.02.2020 04:26
question
Mathematics, 11.02.2020 04:26
Questions on the website: 13722361