Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6858121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:07:04+00:00 2026-05-27T02:07:04+00:00

Am getting two errors in my model implementation file, which I have commented out.

  • 0

Am getting two errors in my model implementation file, which I have commented out. Can you explain what’s wrong and how to fix it?

Thank you.


CalculatorBrain.m

#import "CalculatorBrain.h"

@interface CalculatorBrain()
@property (nonatomic, strong)NSMutableArray *operandStack; 

@end

@implementation CalculatorBrain

@synthesize operandStack = _operandStack;

- (NSMutableArray *)operandStack
{
     if (!_operandStack) {
    _operandStack = [[NSMutableArray alloc]init];
    }
    return _operandStack;
}

 - (void)setOperandStack:(NSMutableArray *)anArray
{
    _operandStack = anArray;
}

- (void)pushOperand:(double)operand
{
    [NSNumber *operandObject = [NSNumber numberWithDouble:operand]; // Expected     identifier
     [self.operandStack addObject:operandObject]; /* Use of undeclared identifier     'operandObject' */
}

- (double)popOperand
      {
         NSNumber *operandObject = [self.operandStack lastObject];
         return [operandObject doubleValue];
      }

 - (double)performOperation:(NSString *)operation
{
    double result = 0;

    if ([operation isEqualToString:@"+"]) {
        result = [self popOperand] + [self popOperand];
    } else if ([@"*" isEqualToString:operation]) {
        result = [self popOperand] * [self popOperand];
    } else if ([operation isEqualToString:"-"]) {
        double subtrahend = [self popOperand];
        result = [self popOperand] - subtrahend;
    } else if ([operation isEqualToString:@"/"]) {
        double divisor = [self popOperand];
        if (divisor) result = [self popOperand] / divisor;
    }

     [self pushOperand:result];

     return result;
}


@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:07:05+00:00Added an answer on May 27, 2026 at 2:07 am

    You have a stray [:

    [NSNumber *operandObject = [NSNumber numberWithDouble:operand]; 
    ^
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting 'rake aborted! ... posts_count is marked readonly' errors. I have two models:
MessageBox.Show((some_string.Length).ToString); I am getting two errors for this: The best overloaded method match for
I've run into a problem where I'm getting two printouts of my /etc/motd file
Simple question - In c++, what's the neatest way of getting which of two
I have a Rails 3 model D that belongs to another model, which belongs
I have two tables which are related as HABTM: Groups(id, name) Streams(id, Stream) Connecting
I'm trying to figure out why I'm getting so many errors on the page
I have a layout which it has two partial views, one for LogIn and
I have two tables User and UserRole which are they connected using a link
I have two models Profile and Avatar. models.py class Profile(models.Model): user = models.ForeignKey(User) profile_name

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.