subject

Given three numbers, create a class Area with following characteristics. Must extend Rectangle and Square class.
Public function named getSumOfAreas that accept two parameter of double type and return addition of those number.
Note: Rectangle and Square class already created.
Input
5.5
5.5
6.5
Where,
The first line is length of Rectangle.
The second line is width of Rectangle.
The third line is side of Square.
Output
30.25
42.25
72.50
Where,
The first line of output contains area of Rectangle.
The second line of output contains area of Square.
The third line of output contains sum of above area.
Assume that,
Inputs are in double within the range [ 1 to 10^20].
Not sure where to begin, please use code template below:
#include
#include
using namespace std;
//rectangle class
class Rectangle {
public:
double areaOfRectangle(double l, double w) {
if (l > 0 && w > 0)
return l * w;
else
return 0;
}
};
// Square class
class Square {
public:
double areaOfSquare(double s) {
if (s > 0)
return s * s;
else
return 0;
}
};
like cin/cout.
//write your code here
int main() {
double l, w,s;
Area area;
cin >> l;
cin >> w;
cin >> s;
cout << fixed << setprecision(2) << area. areaOfRectangle(l, w) << endl;
cout << fixed << setprecision(2) << area. areaOfSquare(s) << endl;
cout << fixed << setprecision(2) << area. getSumOfAreas(area. areaOfRectangle(l, w),area. areaOfSquare(s));
return 0;
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:30
Requirement types discussed during software development include functional and color scheme nonfunctional and code style constraint and nonfunctional fashionable and functional.
Answers: 2
question
Computers and Technology, 22.06.2019 19:00
How is the number 110 written when expanded out to place values in the base 2 (binary) number system? options: 2 x 4 + 3 x 2 + 4 x 1 1 x 2 + 1 x 2 + 0 x 2 1 x 100 + 1 x 10 + 0 x 1 1 x 4 + 1 x 2 + 0 x 1
Answers: 1
question
Computers and Technology, 22.06.2019 21:30
Elements such as fonts colors visual structure graphics and the interface of a web page should complement each other to ensure blank
Answers: 3
question
Computers and Technology, 23.06.2019 21:40
Simon says is a memory game where "simon" outputs a sequence of 10 characters (r, g, b, y) and the user must repeat the sequence. create a for loop that compares the two strings. for each match, add one point to user_score. upon a mismatch, end the game. sample output with inputs: 'rrgbryybgy' 'rrgbbrybgy'
Answers: 3
You know the right answer?
Given three numbers, create a class Area with following characteristics. Must extend Rectangle and...
Questions
question
Mathematics, 29.05.2021 02:40
question
Computers and Technology, 29.05.2021 02:40
question
Mathematics, 29.05.2021 02:40
question
World Languages, 29.05.2021 02:40
Questions on the website: 13722359