Write a method that takes two circles, and returns the sum of the areas of the circles.

This method must be named areaSum() and it must have two Circle parameters. This method must return a double.

For example suppose two Circle objects were initialized as shown:

Circle circ1 = new Circle(6.0);
Circle circ2 = new Circle(8.0);
The method call areaSum(circ1, circ2) should then return the value 314.1592653589793.

You can call your method in the program's main method so you can test whether it works, but you must remove or comment out the main method before checking your code for a score.

Respuesta :

Answer:

public static double areaSum(Circle c1, Circle c2){

 double c1Radius = c1.getRadius();

 double c2Radius = c2.getRadius();

 return Math.PI * (Math.pow(c1Radius, 2) + Math.pow(c2Radius, 2));

public static void main(String[] args){

 Circle c1 = new Circle(6.0);

 Circle c2 = new Circle(8.0);

  areaSum(c1,c2);

 }

Explanation:

fichoh

The function calculates the sum of the area of two circles with their radius given. The program written in python 3 goes thus :

import math

#import the math module

def areaSum(c1, c2):

#initialize the areaSum function which takes in two parameters

c1 = math.pi * (c1**2)

# calculate the area of the first circle

c2 = math.pi * (c2**2)

#Calculate the area of the second circle

return c1+c2

#return the sum of the areas

print(areaSum(6.0, 8.0))

A sample run of the program is attached

Learn more : https://brainly.com/question/19973164

Ver imagen fichoh