016-002-004

Abstract and Concrete Methods: Shape Area Calculation

Easy

Problem Description

Abstract and Concrete Methods: Shape Area Calculation

In this problem, you will create a program that implements a Rectangle class extending the abstract class Shape, calculates the area from width and height, and displays the result to standard output.

Learning Objective: Understand the difference between abstract and concrete methods in abstract classes

Overview

Create a Rectangle class that extends the abstract class Shape and calculate the area.

Specifications

  • abstract class Shape: abstract method getArea() and concrete method getDescription()
  • class Rectangle extends Shape: implement getArea()

Input

Width and height are provided

Output Format

This is a shape.
Area: 50

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up