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

Write a function called getCylinderVolume to return the volume of one cylinder.

ID: 3817757 • Letter: W

Question

Write a function called getCylinderVolume to return the volume of one cylinder. This function has two parameters to specify the cylinder's radius and height. Requirement: The value of pi shall be defined as one constant variable inside this function. Write a function called getGradeLetter to return the letter grade from an integer score. The grade scale to be used is defined as follows: Write a function called getAvgValidScore to return the average value of valid scores from an input array of scores for whole class. Requirement: This function shall be able to handle flexible array size; do NOT change the score array.

Explanation / Answer

Question 1:

#include <bits/stdc++.h>

using namespace std;


float get_cylinder_volume (int a, int b) {
  
float valume;
valume= (22.0/7)*a*b;
return valume;

}
int main() {
int r,h;
float valume;
cin>>r>>h;   
valume=get_cylinder_volume(r,h);
cout<<"cylinder volume is : "<<valume;

  
}

2nd question

#include <iostream>

using namespace std;

int main()
{
int score;

cout<<"Enter the score";


cin>>score;
if(score>=90)
cout<<"Grade A";
else if(score>=80 && score<=89)
cout<<"Grade B";
else if (score>=70 && score<=79)
cout<<"Grade C";
else
cout<<"Grade C";
}

Question 3;

#include <bits/stdc++.h>

using namespace std;
float getValidScore(int arr[],int n)
{   
int avg=0,count=0;
float avgValue;
for (int i=0;i<n;i++)
{
if(arr[i]<=0 && arr[i]>=100)
{
avg+=arr[i];

count++;
}
}
avgValue=avg/count;
return avgValue;
}

int main()
{
int size;
float avgscore;
cout<<"Enter the size of class";
cin>>size;
int arr[size];
cout<<"enter the individual score of class";
for(int i=0;i<size;i++)
{
cin>>arr[i];
}
  
avgscore=getValidScore(arr,size);
if(avgscore!=-1)
cout<<"Avg Valid score is : "<<avgscore;
else cout<<"Not found any valid score";
  
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote