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 03:30
Identify at least three types of characteristics that you were asked about as you the computer identify a fruit.
Answers: 3
question
Computers and Technology, 23.06.2019 02:00
Arecipients list has been loaded into a document. which commands should be clicked in order to filter the list so that letters will not be printed for recipients who live in a certain state? mailings tab, start mail merge, select recipients, type new list, then insert only contacts from the desired states mailings tab, rules, select recipients, use existing list, then choose a recipients list that includes only contacts in certain states mailings tab, select recipients, use existing list, rules, fill in, then type in certain states mailings tab, rules, skip record select “state” under field name, then type in the state name under “equal to”
Answers: 2
question
Computers and Technology, 23.06.2019 03:30
In vista and windows 7, the appearance and personalization option allows you to change the
Answers: 1
question
Computers and Technology, 23.06.2019 10:00
What is estimated time of arrival (eta)? a device that measures the acceleration (the rate of change of velocity) of an item and is used to track truck speeds or taxi cab speeds a gps technology adventure game that posts the longitude and latitude location for an item on the internet for users to find a north/south measurement of position the time of day of an expected arrival at a certain destination and is typically used for navigation applications
Answers: 3
You know the right answer?
In this exercise, we are going to model some behaviors of a square. Since the Square object extends...
Questions