Question

# write a method named area with one double parameter named radius. The method needs to return...

write a method named area with one double parameter named radius. The method needs to return a double value that represents the area of a circle. If the parameter radius is negative, Then return -1.0 to represent an invalid value

write another overloaded method with 2 parameters side1 and side2 (both doubles) where side1 and side2 represent the sides of a rectangle. The method needs to return an area of a rectangle. If either or both parameters is /are a negative return -1.0 to indicate an invalid value

``````#include<iostream>
using namespace std;
double area(double);
double area(double,double);

int main()
{
double circle = area(10.0);
cout<<"Area of circle is " << circle<<endl;
double rectangle = area(5.0,7.0);
cout<<"Area of rectangle is "<<rectangle<<endl;
return 0;
}

{
return -1.0;
else
}

double area(double side1,double side2)
{
if (side1<0 || side2<0)
return -1;
else
return side1*side2;
}
``````

#### Earn Coins

Coins can be redeemed for fabulous gifts.

##### Need Online Homework Help?

Most questions answered within 1 hours.

##### Active Questions
• A mineral exploration firm is formed with enough capital to finance 9 ventures. The probability of...
• Do you consider yourself an internal or an external? Why is knowing what modality you typically...
• describe the basic functions of each component (block) of the ext4 filesystem.
• Which of the following collections of vectors are linearly independent {[1,2],[2,3]} {[1,2,3],[2,4,6]} {[1,2],[2,3],[3,4]} {[1,0,1],[1,0,0],[2,01]} {[1,0,1],[1,0,0],[3,0,1]} {[1,0,1],[1,0,0],[3,0,1],[4,0,1]}...
• What does a flexible budget performance report do that a simple comparison of budgeted to actual...
• Define a function named sumsin that accepts double precision variable theta, double precision variable alpha, and...