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

Programming Problem 1 John wants to know the values of the area and perimeter of

ID: 2357284 • Letter: P

Question

Programming Problem 1 John wants to know the values of the area and perimeter of a rectangle. John can take measurements of the length and width of the rectangle in inches. John's measurements are expected to be accurate to within 0.1 inch. 1. Identify the inputs and outputs of the problem. 2. Identify the processing needed to convert the inputs to the outputs. 3. Design an algorithm in pseudocode to solve the problem. Make sure to include steps to get each input and to report each output. 4. Identify two test cases, one using whole number values, and one using decimal number values. For each of the two test cases show what inputs you will use and what your expected outputs should be. 5. Write the program to implement your algorithm. Test your program using your test cases. Did your program produce the values predicted in your test cases? Explain.

Explanation / Answer

#include using namespace std; class rectangle { private: double length; double width; public: void theLen(double length); void theWid(double width); double calculateArea (); double calculatePerimeter(); }; void rectangle::theLen(double L) { length=L; } void rectangle::theWid(double W) { width=W; } double rectangle::calculateArea() { double A; A=length*width; return A; } double rectangle::calculatePerimeter() { double P; P=(length+width)*2; return P; } int main() { double length, Width; rectangle objectX; cout > length; objectX.theLen(length); cout > Width; objectX.theWid(Width); cout