Model an ideal transformer where V1/V2 = N1/N2 and i1/i2 = N2/N1 provide functions iOut and vOut to calculate current or voltage out provide setI1forI2 (etc) to calculate internal variables for a given output

What will be an ideal response?


```
class Transformer {
public:
Transformer() {} // default constructor
Transformer(int, int, double, double); // construct with N1 N2 V1 i1
double vOut() const; // calculates voltage out
double iOut() const; // calculates current out
void setN1forV2(double); // set a variable for a given output
void setN2forV2(double);
void setV1forV2(double);
void setI1forI2(double);
void setN1forI2(double);
void setN2forI2(double);
private:
int N1, N2;
double V1, i1;
friend istream& operator>> (istream&, Transformer&);
friend ostream& operator<< (ostream&, const Transformer&);
};
```

Computer Science & Information Technology

You might also like to view...

Given the following method, which of these method calls is valid?

``` public static void showProduct (int num1, double num2) { int product; product = num1 * (int)num2; System.out.println("The product is " + product); } ``` a. showProduct(5.5, 4.0); b. showProduct(10.0, 4); c. showProduct(10, 4.5); d. showProduct(33.0, 55.0);

Computer Science & Information Technology

When you click the Form button in the Forms category on the Insert panel, a ____ outline appears on the page on a Windows system.

A. yellow dashed B. green highlighted C. red dotted D. black solid

Computer Science & Information Technology

By adding numbers to and subtracting numbers from pointers, we can obtain different addresses.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

You can automate features in most modern software programs by using custom-built miniprograms called ________.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology