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, 21.06.2019 16:30
Margins can be modified in the page layout tab or by using
Answers: 2
question
Computers and Technology, 22.06.2019 06:30
Plz 40 points what are raster vectors? a bitmap image a vector file a type of printing press a small projector
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
Awide variety of “ apps “ are available to customize devices. which category of app does the word processing software fall into?
Answers: 2
question
Computers and Technology, 23.06.2019 19:00
Choose the correct citation for the case which established the "minimum contacts" test for a court's jurisdiction in a case. select one: a. brown v. board of education of topeka, 347 u.s. 483 (1954). b. international shoe co. v. washington, 326 u.s. 310 (1945) c. haynes v. gore, 531 u.s. 98 (2000). d. international shoe co. v. washington, 14 u.s. code 336.
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
History, 21.11.2020 21:10
question
Mathematics, 21.11.2020 21:10
question
Mathematics, 21.11.2020 21:10
Questions on the website: 13722360