Complete set: Intro to C - Bill Buchanan
Complete set: Intro to C - Bill Buchanan
Complete set: Intro to C - Bill Buchanan
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
}<br />
}<br />
The complete code is given in Program 8.2<br />
Program 8.2:<br />
using System;<br />
using System.Collections;<br />
interface NewCircuit<br />
{<br />
double r1 { <strong>set</strong>; get;}<br />
double r2 { <strong>set</strong>; get;}<br />
double calcParallel();<br />
double calcSeries();<br />
}<br />
interface NewCircuit2<br />
{<br />
double calcDifference();<br />
}<br />
interface NewCircuitTotal : NewCircuit, NewCircuit2<br />
{}<br />
public class Circuit: NewCircuitTotal<br />
{<br />
private double res1, res2;<br />
public double r1<br />
{<br />
<strong>set</strong> { res1=value;}<br />
get { return res1; }<br />
}<br />
public double r2<br />
{<br />
<strong>set</strong> { res2=value;}<br />
get { return res2; }<br />
}<br />
duction <strong>to</strong> .NET<br />
<strong>Intro</strong><br />
public void Setr2(double r)<br />
{<br />
r2=r;<br />
}<br />
public double calcParallel()<br />
{<br />
return((r1*r2)/(r1+r2));<br />
}<br />
public double calcSeries()<br />
{<br />
return(r1+r2);<br />
}<br />
public double calcDifference()<br />
{<br />
return(r1-r2);<br />
}<br />
}<br />
public class Class1<br />
Agilent .NET Course: More Objects 7