Computers and Technology
Computers and Technology, 23.05.2020 05:04, brandy127

PLZ HELP ASAP
package lesson8;

public abstract class Shape {
protected int height;
protected int width;

public Shape(int height, int width) {
this. height = height;
this. width = width;
}

public final void printArea() {
System. out. println("This " + getName() + " has a height of " +
height + ", a width of " + width + ", and an area of " +
getArea() + ".");
}

public final void printPerimeter() {
System. out. println("This " + getName() + " has a height of " +
height + ", a width of " + width + ", and a perimeter of " +
getPerimeter() + ".");
}

protected abstract String getName();
protected abstract double getArea();
protected abstract double getPerimeter();
}
Rectangle Class
package lesson8;

public class Rectangle extends Shape {
public Rectangle(int height, int width) {
super(height, width);
}

protected String getName() {
return "rectangle";
}

protected double getArea() {
return height * width;
}

protected double getPerimeter() {
return height * 2 + width * 2;
}
}
RightTriangle Class
package lesson8;

public class RightTriangle extends Shape {
public RightTriangle(int height, int width) {
super(height, width);
}

protected String getName() {
return "right triangle";
}

protected double getArea() {
return height * width / 2;
}

protected double getPerimeter() {
return height + width + Math. sqrt(height * height + width * width);
}
}
Square Class
package lesson8;

public class Square extends Rectangle {
public Square(int height) {
super(height, height);
}

protected String getName() {
return "square";
}
}

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:30, icantspeakengles
Aconstruction company is creating a powerpoint presentation describing how they calculate costs during each construction step. they plan to email this presentation to clients. the individual clients will be watching the presentation slide show on their own personal computers. what is the most important formatting step the company should take to make the text readable and pleasing to the eye?
Answers: 2
image
Computers and Technology, 22.06.2019 21:30, mima851
Elements such as fonts colors visual structure graphics and the interface of a web page should complement each other to ensure blank
Answers: 3
image
Computers and Technology, 23.06.2019 04:31, legendman27
Jennifer has to set up a network in a factory with an environment that has a lot of electrical interference. which cable would she prefer to use? jennifer would prefer to use because its metal sheath reduces interference.
Answers: 1
image
Computers and Technology, 23.06.2019 12:00, trippie4life
3. when you right-click a linked spreadsheet object, what commands do you choose to activate the excel features? a. linked worksheet object > edit b. edit data > edit data c. linked spreadsheet > edit d. object > edit data
Answers: 2
Do you know the correct answer?
PLZ HELP ASAP
package lesson8;

public abstract class Shape {
protected int h...

Questions in other subjects:

Konu
Social Studies, 18.03.2021 03:20
Konu
Mathematics, 18.03.2021 03:20
Konu
Chemistry, 18.03.2021 03:20