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

  • SEARCH
  • Home
  • 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 7657595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:04:19+00:00 2026-05-31T13:04:19+00:00

I have a method which calculates loan payments based on car price, interest rate

  • 0

I have a method which calculates loan payments based on car price, interest rate and number of years, this method is in my model and is accessed through my main view controller.

I created a singleton in the model but since I created it the method that calculates the payments stopped working for some reason. I have made sure that I have created the shared instance, It was working before I implemented the singleton.

Any help would be appreciated. I have not received any errors.

Here is the singleton I created.

+(id) sharedCalculatorBrain
{
    static id sharedCalculatorBrain = nil;
    if (sharedCalculatorBrain == nil)
    {
        sharedCalculatorBrain = [[sharedCalculatorBrain alloc]init];
    }

    return sharedCalculatorBrain;
}

Here is how I have created the object.

CalculatorBrain * brain = [CalculatorBrain sharedCalculatorBrain];  

and I call the method by using:

[brain calculatePaymentPlan:[self.txtLoanAmount.text doubleValue] :[self.txtInterestRate.text doubleValue] :[self.txtNumberOfYears.text doubleValue]];
  • 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-31T13:04:20+00:00Added an answer on May 31, 2026 at 1:04 pm

    Not sure if it is a typo, but check your code if you allocate the singleton instance using:

    sharedCalculatorBrain = [[sharedCalculatorBrain alloc] init];
    

    Because if this is the case, you need to do:

    sharedCalculatorBrain = [[CalculatorBrain alloc]init];
    

    Hope this helps, good luck with your project!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ticket model which has a method inside called closes_in that calculates
I have a bool method which calculates the sum (quantity*price) it works fine. When
I have this method which lets me translate the position of an object, animating
I have this method which leaks ~ 6KB : + (EInspectorFacilityInfo*) newWithNode: (CXMLNode*) node
I have defined the following method which calculates the average of an array: public
I want to have a method which calculates the mean of a LinkedList of
I currently have a method which is quite simple and calculates a list of
I have a method which returns single word as a String. I need to
I have a method which takes a list and do some processing on it
I have a method which I am trying to call dynamically. That method has

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.