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

Execute a C++ program to calculate the perimeter and area of a rectangle. a. pro

ID: 3782158 • Letter: E

Question

Execute a C++ program to calculate the perimeter and area of a rectangle. a. program is attached. b. Add a comment line for your name, jag#, program purpose, and date. This is the only change to be made to the source code. c. upload the cpp program file and a results file. Chapter 2, Exercise #9, page 119 - average test scores a. write a program that prompts the user to enter five test scores and then print the average test score to the screen. (Assume that the test scores are decimal) b. Add a comment line for your name, jag#, program purpose, and date. This is the only change to be made to the source code. c. Sample run #1: Use the following 5 numbers: 10.5 5.5 20.0 10.0 5.5 d. Sample run #2: Use the following 5 numbers: 13.3 0.2 13.5 26.03.5 e. upload the cpp program Me and a results file Grading Criteria CakPerimeter..cpp file CalcPerimeter.results file with correct results CalcPerimeter.comment included with name, jag#, program purpose, date CalcPerimeter program executes without errors AvgTestScores: .cpp file AvgTestScores: results file with correct resorts AvgTestScores: comment included-with name, jag#, program purpose, date AvgTestScores: program executes without errors

Explanation / Answer

1)

function to calculate area:

int area(int a, int b)

{

return a*b;

}

2)

function to calculate perimeter:

int perimeter(int a ,int b)

{

return 2*(a+b);

}

3) average:

#include<iostream>

using namespace std;

int main()

{

int n=5;

int arr[5];

for(int i=0;i<n;i++)

{

cin>>arr[i];

}

float avg=0;

for(int i=0;i<n;i++)

{

avg=avg+arr[i];

}

avg=avg/5;

cout<<avg;

return 0;

}