subject

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";
}
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:00
When designing content as part of your content marketing strategy, what does the "think" stage represent in the "see, think, do, care" framework?
Answers: 3
question
Computers and Technology, 22.06.2019 23:30
Jaina and tomas are being considered as new tenants in an apartment. the landlord looks at their creditworthiness because he wants to be sure his new tenant pays the rent on time and in full. the table below summarizes the information that was on their applications. application information questions jaina tomas how many years have you had your job? 5 2 what is your monthly salary? $1,850 $2,500 how many credit cards do you have? 4 1 how much debt do you have? $13,000 $7,000 how many times were you late with payments on credit cards in the past year? 5 1 who will the landlord decide to be more creditworthy and why? tomas because the ratio of his debt to income is less. jaina because she has had her job longer, which makes her look more stable. jaina because she has more credit cards available to her. tomas because he makes more money per month.
Answers: 2
question
Computers and Technology, 23.06.2019 07:30
To check spelling errors in a document, the word application uses the to determine appropriate spelling. internet built-in dictionary user-defined words other text in the document
Answers: 2
question
Computers and Technology, 23.06.2019 13:30
Drag the tiles to the correct boxes to complete the pairs. match the errors with their definitions. #name #value #ref when a formula produces output that is too lengthy to fit in the spreadsheet cell arrowright when you enter an invalid cell reference in a formula arrowright when you type text in cells that accept numeric data arrowright when you type in a cell reference that doesn’t exist arrowright reset next
Answers: 1
You know the right answer?
PLZ HELP ASAP
package lesson8;

public abstract class Shape {
protected int h...
Questions
question
English, 26.01.2021 20:30
question
Mathematics, 26.01.2021 20:30
question
Mathematics, 26.01.2021 20:30
Questions on the website: 13722360