Question write a Calculator class that matches this specification

Thehonest
 (Not rated)
 (Not rated)
Chat

Q write a Calculator class that matches this specification
describe( "Calculator", function(){
var calculator;
beforeEach( function(){
calculator = new Calculator();
} );
it( "adds 1 and 2", function(){
expect( calculator.add( 1, 2 ) ).to.equal( 3 );
} );
it( "subtracts 2 from 9", function(){
expect( calculator.subtract( 9, 2 ) ).to.equal( 7 );
} );
it( "multiplies 4 and 3", function(){
expect( calculator.multiply( 4, 3 ) ).to.equal( 12 );
} );
it( "divides 10 by 2", function(){
expect( calculator.divide( 10, 2 ) ).to.equal( 5 );
} );
it( "does not divide by 0", function(){
expect( calculator.divide( 5, 0 ) ).to.equal( NaN );
} ); } );

 

 

    • 10 years ago
    A+ Work
    NOT RATED

    Purchase the answer to view it

    • gq_4.docx