Remember that the area of a rectangle is width * height:
static int getArea(Rectangle r) {
return r.width * r.height;
}
write a program in java to calculate the area of rectangle with two classes
square triangle circle oval rectangle polygon
2. Write a program using switch statement that reads a character representing a geometrical figure, then asks the user to enter the required data (ex. Radius for a circle, length and height for a rectangle, etc. ...) . The program should then print the area and circumference.Figures are: circle(c), square(s), rectangle(r), triangle (t).
By using that one thing.
#include<iostream> struct shape { virtual double area () const = 0; }; struct triangle : shape { triangle (double b, double h): base (b), height (h) {} double base, height; double area () const override { return base * height / 2; } }; struct circle : shape { circle (double r): radius (r) {} double radius; double area () const override { return 4 * atan(1) * radius * radius; } }; struct rectangle : shape { rectangle (double w, double h): width (w), height (h) {} double width, height; double area () const override { return width * height; } }; int main() { triangle t (10, 5); std::cout << "triangle with base " << t.base << " and height " << t.height << " has area " << t.area() << std::endl; circle c (5); std::cout << "circle with radius " << c.radius << " has area " << c.area() << std::endl; rectangle r (10, 5); std::cout << "rectangle with width " << r.width << " and height " << r.height << " has area " << r.area() << std::endl; }
Write a program that calculates the area of a triangle in QBASIC
Triangle, Rectangle, Circle, Pentagon
circle triangle square rectangle trapezoid
a circle. A square, circle, rectangle, or triangle.
Rectangle: LxW Triangle:? Circle:?
The rectangle.
A circle !!!!!!
a circle is symmetric so is a triangle, a rectangle.
Triangle, rectangle, square, circle, and oval
circle, triangle, square and rectangle
Seven.Seven.Seven.Seven.
circle, square, triangle, rectangle
A circle is a non-example of rectangle. -(ONE question at a time PLEASE )