5 Replies - 459 Views - Last Post: 27 February 2017 - 11:16 AM Rate Topic: -----

#1 Sage710  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 29-September 16

Trouble with loan program

Posted 22 February 2017 - 01:01 PM

I seem to be experiencing trouble with my loan program. My program doesn't seem to be using the interface. I can't seem to figure out the the problem for the interface. At the end after all the calculations it is supposed to call "Be Ready!".Any help would be appreciated, thank-you.
        static void Main(string[] args)
        {
            double interests = 0.0;
            double years = 0.0;
            double loan_amount = 0.0;
            double interest_rate = 0.0;


            Console.Write("Enter Loan Amount:$ ");
            loan_amount = Convert.ToDouble(Console.ReadLine());
            Console.Write("Enter Number of Years: ");
            years = Convert.ToDouble(Console.ReadLine());
            Console.Write("Enter Interest Rate: ");
            interest_rate = Convert.ToDouble(Console.ReadLine());
            interests = loan_amount * interest_rate * years;
            Console.WriteLine("\nThe total interests is {0}", interests);
            Console.ReadLine();




        }

        public string iMessage()
        {
            return Console.WriteLine("Be Ready!"); ; // calculate payment; no implementation
        }
    }

    }

This is what the interface looks like.
interface IMyInterface
    {
        string iMessage();
    }


Is This A Good Question/Topic? 0
  • +

Replies To: Trouble with loan program

#2 tlhIn`toq  Icon User is online

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6507
  • View blog
  • Posts: 14,373
  • Joined: 02-June 10

Re: Trouble with loan program

Posted 22 February 2017 - 01:05 PM

You don't seem to be using the interface at all.
Do you have a class that it is inheriting from it someplace other than in the code posted?
You have a method called iMessage in your main code. ANd you have an iMessage in the interface. Do you think they are somehow related/connected?

What is it you think an interface is for, or does, or its purpose?
Was This Post Helpful? 0
  • +
  • -

#3 Sage710  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 29-September 16

Re: Trouble with loan program

Posted 22 February 2017 - 01:09 PM

View PosttlhIn`toq, on 22 February 2017 - 01:05 PM, said:

You don't seem to be using the interface at all.
Do you have a class that it is inheriting from it someplace other than in the code posted?
You have a method called iMessage in your main code. ANd you have an iMessage in the interface. Do you think they are somehow related/connected?

What is it you think an interface is for, or does, or its purpose?

Yes I thought that they were related. I'm still new to interfaces, but don't understand all that them. Isn't it a function that a class can use?
Was This Post Helpful? 0
  • +
  • -

#4 Sage710  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 29-September 16

Re: Trouble with loan program

Posted 22 February 2017 - 01:15 PM

Is there a way that I could implement it or could you show me what I'm doing wrong?
Was This Post Helpful? 0
  • +
  • -

#5 tlhIn`toq  Icon User is online

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6507
  • View blog
  • Posts: 14,373
  • Joined: 02-June 10

Re: Trouble with loan program

Posted 22 February 2017 - 01:17 PM

Honestly you are so far off base with that code that you need to go back and re-read your textbook on them. Or find a tutorial on them. Its more than a simple thread is going to explain.


and no, an interface is not a method a class can use.
Was This Post Helpful? 0
  • +
  • -

#6 Sage710  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 29-September 16

Re: Trouble with loan program

Posted 27 February 2017 - 11:16 AM

Thank-you I'll go back and look into it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1