int equals(ComplexByte cparm) { if (real != cparm.getrealpart()) { return(0); } if (imag != cparm.getimagpart( )) { return(0); } return(1); }
void add( ComplexByte cparm ) { int rtemp, itemp; rtemp = real + cparm.getrealpart(); if ( ( rtemp > 127 ) || ( rtemp < -128 ) ) throw new ArithmeticException(); itemp = imag + cparm.getimagpart(); if ( ( itemp > 127 ) || ( itemp < -128 ) ) throw new ArithmeticException(); real = (byte)( rtemp); imag = (byte)( itemp ); }
int equals( ComplexByte cparm ) { if (real != cparm.getrealpart()) { return 0; } if(imag != cparm.getimagpart( )) { return 0; } return 1; }
public static int Main(String [] args) { String s = "Done"; int retVal = 100; int tryflag = 1; try { throw new UserException(); } catch (ArithmeticException) { Console.WriteLine("AE was caught"); } try { ComplexByte c4 = new ComplexByte(200, -200); } catch (ArgumentException) { tryflag = 0; // we caught it Console.WriteLine("Caught Argument Exception in Test Case 8"); } finally { if (tryflag != 0) { retVal = 8; } } tryflag = 1; try { ComplexByte c4 = new ComplexByte(100, -100); c4.add(200, -200); } catch (ArithmeticException) { tryflag = 0; // we caught it Console.WriteLine("Caught Arithmetic Exception in Test Case 9"); } finally { if (tryflag != 0) { retVal = 9; } } Console.WriteLine(s); return(retVal); }
void add(ComplexByte cparm) { int rtemp, itemp; rtemp = real + cparm.getrealpart(); if ((rtemp > 127) || (rtemp < -128)) { throw new ArithmeticException(); } itemp = imag + cparm.getimagpart(); if ((itemp > 127) || (itemp < -128)) { throw new ArithmeticException(); } real = (byte)(rtemp); imag = (byte)(itemp); }
void multiply(ComplexByte cparm) { int rtemp, itemp; rtemp = (real * cparm.getrealpart( ) - imag * cparm.getimagpart( )); itemp = (real * cparm.getimagpart( ) + cparm.getrealpart( ) * imag); if ((rtemp > 127) || (rtemp < -128)) { throw new ArithmeticException(); } if ((itemp > 127) || (itemp < -128)) { throw new ArithmeticException(); } real = (byte)rtemp; imag = (byte)itemp; }
void assign(ComplexByte cparm) { real = cparm.getrealpart( ); imag = cparm.getimagpart( ); }
public ComplexByte(ComplexByte cparm) { this.real = cparm.getrealpart( ); this.imag = cparm.getimagpart( ); }
void assign( ComplexByte cparm ) { real = cparm.getrealpart( ); imag = cparm.getimagpart( ); }
public static int Main( String [] args ) { String s = "Done"; int retVal = 100; int tryflag = 1; try { throw new UserException(); } catch (ArithmeticException ){ Console.WriteLine("AE was caught"); } try { ComplexByte c4 = new ComplexByte( 200, -200 ); } catch ( ArgumentException ) { tryflag = 0; // we caught it Console.WriteLine( "Caught Argument Exception in Test Case 8" ); } finally { if ( tryflag != 0 ) { retVal = 8; } } tryflag = 1; try { ComplexByte c4 = new ComplexByte( 100, -100 ); c4.add( 200, -200 ); } catch ( ArithmeticException ) { tryflag = 0; // we caught it Console.WriteLine( "Caught Arithmetic Exception in Test Case 9" ); } finally { if ( tryflag != 0 ) { retVal = 9; } } Console.WriteLine(s); return retVal; }
public ComplexByte( ComplexByte cparm ) { this.real = cparm.getrealpart( ); this.imag = cparm.getimagpart( ); }
void multiply( ComplexByte cparm ) { int rtemp, itemp; rtemp = (real * cparm.getrealpart( ) - imag * cparm.getimagpart( )); itemp = (real * cparm.getimagpart( ) + cparm.getrealpart( ) * imag); if ( ( rtemp > 127 ) || ( rtemp < -128 ) ) throw new ArithmeticException(); if ( ( itemp > 127 ) || ( itemp < -128 ) ) throw new ArithmeticException(); real = (byte) rtemp; imag = (byte) itemp; }