# COMP 11 - Introduction to Computer Science - Fall 2002

## Correction and Explanations for pp7

• There was a mistake on the original handout for pp7. The correct output for pp7main.cpp is given below. The third line contained 7.5 instead of 5.0 for the radius but this is illegal since it crosses the 0 boundary on both x and y. The correct output is:
```Circle is at: # 5.0 # 5.0 Radius is # 1.0
Circle is at: # 5.0 # 5.0 Radius is # 5.0
Circle is at: # 5.0 # 5.0 Radius is # 5.0
Circle is at: # 7.0 # 8.0 Radius is # 1.0
Move failed!
Circle is at: # 7.0 # 8.0 Radius is # 1.0
Circle is at: # 9.3 # 8.1 Radius is # 0.7
Circle is at: # 6.3 # 5.1 Radius is # 1.0
```
• We also had questions on the functionality of getRadius(). To clarify this we provide a new main function pp7mainB.cpp given here and in /comp/11/lab/ The program is:
```// File: pp7mainB.cpp

#include
#include
#include "boundedCircle.h"
using namespace std;

int main()
{
float r;
boundedCircle dog;
boundedCircle cat(7,8);

cout << setiosflags(ios::fixed);
cout << setiosflags(ios::showpoint);
cout << setprecision(1);
dog.display();
dog.display();
dog.doubleBoundary();
dog.display();
dog.move(3,3);
dog.display();
cout << "Dog's radius is: " << r << endl;

cat.display();
if (cat.move(-8,0))
cout << "This shouldn't happen!\n";
else
cout << "Move failed!\n";
cat.display();
cat.move(2.3,0.1);
cat.display();
cat.move(-3,-3);
cat.display();

return 0;
}
```
The correct output is:
```Circle is at: # 5.0 # 5.0 Radius is # 1.0
Circle is at: # 5.0 # 5.0 Radius is # 5.0
Circle is at: # 5.0 # 5.0 Radius is # 5.0
Circle is at: # 8.0 # 8.0 Radius is # 7.5