Calculator.m

Send Snippet To: Save this snippet to Code Collector Pro -- view all durul's snippets
language: Objective-C
license: Other

Code for Snippet:

                
//
//  Calculator.m
//  myCalculator
//
//  Created by Steve Kochan on 5/7/09.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//
 
#import "Calculator.h"
 
@implementation Calculator
-(void) clear
{
    accumulator = 0.0;
}
 
-(void) setAccumulator: (double) value;
{
    accumulator = value;
}
 
-(double) accumulator;
{
    return accumulator;
}
 
-(void) add: (double) value
{
    accumulator += value;
}
 
-(void) subtract: (double) value
{
    accumulator -= value;
}
 
-(void) multiply: (double) value
{
    accumulator *= value;
}
 
-(void) divide: (double) value
{
    accumulator /= value;
}
@end
 
comments powered by Disqus

Info

Link to this snippet:


Download to Code Collector

To use the direct link to your snippet on CodeCollector.net either copy the html from the above section or drag the Download to Code Collector to where you would like to use it.

More Info:

Times Viewed: 96
Date Added: 2015-12-29 18:50:49
Last Modified: 2016-07-19 12:05:44

Web Analytics