Computers and Technology
Computers and Technology, 13.05.2021 19:30, tay8963

Public class Square extends Shape{ /**Like with Shape, we will be making a static instance variable
* to keep track of how many squares we have made. It is very
* similar to the one in shape, and it's uses are similar as well.
* It too is initialized to zero.
*
* We may also need additional instance variables, which you should
* declare as needed. They will not need to be static nor initialized
* here though.
**/
/**You may need additional instance variables. Declare them here.
**/
/**The constructor for Square is a little more involved than the
* Shape constructor, as it takes a single double parameter representing
* the side length. It should also call the super constructor, as
* calling it increments the number of shapes made, which we should
* do (as a Square extends Shape). We also need to increment the
* instance variable representing the number of squares made, and handle
* our parameter appropriately.
**/
public Square(double sideLength){
}
/**Like with our other shapes, this is a simple getter method for our
* static instance variable.
**/ public static int getNumSquaresMade(){
return -1;
}
/**As always, we must override getSize() for our Square. A Square's size
* is simply it's side length squared.
**/
}
public class Shape{
private static int numShapesMade = 0;
public Shape(){
numShapesMade++;
}
public static int getNumShapesMade(){
return numShapesMade;
}
public double getSize(){
return 0;
}
}

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 19:30, bstine6678
When creating a presentation in libre office impress, where does the editing of slides take place? a. the slides panel b. the center panel c. the tasks panel, under the masters pages tab d. the tasks panel, under the layouts tab
Answers: 1
image
Computers and Technology, 23.06.2019 09:30, jason9394
Facial expressions and gestures are examples of messages.
Answers: 3
image
Computers and Technology, 24.06.2019 04:10, kris1920
Write a program that reads a set of floating-point values. ask the user to enter the values, then print • the average of the values. • the smallest of the values. • the largest of the values. • the range, that is the difference between the smallest and largest. of course, you may only prompt for the values once.
Answers: 3
image
Computers and Technology, 24.06.2019 09:30, kyreesegordon
Retype the statements, correcting the syntax errors. system. out. println("num: " + songnum); system. out. println(int songnum); system. out. println(songnum " songs"); note: these activities may test code with different test values. this activity will perform two tests: the first with songnum = 5, the second with songnum = 9. see how to use zybooks.
Answers: 1
Do you know the correct answer?
Public class Square extends Shape{ /**Like with Shape, we will be making a static instance variable...

Questions in other subjects:

Konu
Mathematics, 04.07.2019 11:50
Konu
Mathematics, 04.07.2019 11:50
Konu
Chemistry, 04.07.2019 11:50