Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need to write a neat and organized C++ program that meets the requirements in

ID: 673874 • Letter: I

Question

I need to write a neat and organized C++ program that meets the requirements in (a) and (b). And have it be simple not too complex. If you can help, I'd appreciate it, thank you!

5. (Statics) An annulus is a cylindrical rod with a hollow center, as shown in Figure 6.7. Its sec- ond moment of inertia is given by this formula: /- (r24-r14) /is the second moment of inertia (m4). r2 is the outer radius (m) i is the inner radius (m). Figure 6.7 Calculating an annulus's second moment of inertia a. Using this formula, write a function called annulusMoment) that accepts two double- precision numbers as parameters (one for the outer radius and one for the inner radius) calculates the corresponding second moment of inertia, and displays the result. b. Include the function written in Exercise 5a in a working program. Make sure your function is called from main). Test the function by passing various data to it.

Explanation / Answer

#include<iostream>
#include<cmath>
using namespace std;
void annulusMoment(double,double);

void annulusMoment(double r1, double r2)
{
double secmoment,temp1,temp2;
temp1=pow(r1,4);
temp2=pow(r2,4);

double pi=22/7;

secmoment=(pi/4)*(temp2-temp1);

cout<<" the calculated second moment of inertia is: "<<secmoment;  
}
int main()
{
double r1,r2;
cout<<"enter inner radius (r1): ";
cin>>r1;
cout<<" enter outer radius (r2): ";
cin>>r2;
annulusMoment(r1,r2);  
}