Extend class Vect (definition shown above) by defining accessor functions getR and getTheta, which return the values of the private components of a Vect object.

What will be an ideal response?


```
class Vect {
public:
Vect() {}
Vect( double, double );
double getR() const;
double getTheta() const;
private:
double r; // magnitude
double theta; // direction (radians)
};
//
// Constructor 2: Initializes all components
//
Vect :: Vect( double vectMag, double vectDir )
{
r = vectMag;
theta = vectDir;
}
//
// Accessor for private component r
//
double Vect::getR() const
{
return r;
}
//
// Accessor for private component theta
//
double Vect::getTheta() const
{
return theta;
}
```

Computer Science & Information Technology

You might also like to view...

Use your output data and ping results to explain what happened in each of the ping commands. Which ping operations were successful and which were unsuccessful? Why?

What will be an ideal response?

Computer Science & Information Technology

Name server

What will be an ideal response?

Computer Science & Information Technology

What does the following statement do?

Scanner scanner = new Scanner(Paths.get("test.txt")); a. Opens a binary file for input. b. Opens a binary file for output. c. Opens a text file for input. d. Opens a text file for output.

Computer Science & Information Technology

When viewing a form in Design view, the Page Header section is displayed above the ________ section

Fill in the blank(s) with correct word

Computer Science & Information Technology