Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function, calCircle2, to perform the following task: Calculate the area of a circle, the circumference of a circle, the volume of a sphere,

Write a function, calCircle2, to perform the following task:

Calculate the area of a circle, the circumference of a circle, the volume of a sphere, and/or the area

of a sphere.

The first argument is a character vecotr that contains values of "AC", "CC", "VS", and/or "AS".

The value can contain either lower, upper, or mixed cases of letters. The calculations need to be

performed based on the first argument.

The second argument is numeric vector of length great or equal to 1.

The function returns a list that contains the calculated results. The length of the list is the same as

the length of the first argument.

Here're the expected results by calling this function:

> calCircle2(c(cc), 1:4)

$CC

[1] 6.283 12.566 18.850 25.133

> calCircle2(c(AC,VS), seq(5,25,5))

$AC

[1] 78.540 314.159 706.858 1256.637 1963.495

$VS

[1] 523.599 4188.790 14137.167 33510.322 65449.847

> calCircle2(c(AC, VS, "cc", "aS"), 3:10)

$AC

[1] 28.274 50.265 78.540 113.097 153.938 201.062 254.469 314.159

$VS

[1] 113.097 268.083 523.599 904.779 1436.755 2144.661 3053.628 4188.790

$CC

[1] 18.850 25.133 31.416 37.699 43.982 50.265 56.549 62.832

$AS

[1] 113.097 201.062 314.159 452.389 615.752 804.248 1017.876 1256.637

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Calculus An Applied Approach

Authors: Ron Larson, Dennis J McKenzie, Larson/Edwards, Bruce H Edwards

7th Edition

1111809720, 9781111809720

More Books

Students also viewed these Mathematics questions

Question

What is database?

Answered: 1 week ago

Question

What are Mergers ?

Answered: 1 week ago