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 8856061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:16:30+00:00 2026-06-14T14:16:30+00:00

I am trying to get the output from a method i wrote in a

  • 0

I am trying to get the output from a method i wrote in a different class to return a value into the middle of a writeline statement. The error “Operator ‘+’ cannot be applied to operands of type ‘string’ and ‘method group” is stopping anything from running, but I cant seem to find away to get the error resolved. This may be a real simple thing I am missing, but im still really new to programming so Im probably missing something obvious.

    public void EatFruits()
    {
        double dblpercent;
        this.MakeFruits();
        Console.WriteLine("You have an Apple and a Banana in your fruit garden.");
        Console.WriteLine("What Percent of the Apple would you like to eat?");
        dblpercent = Convert.ToDouble(Console.ReadLine());
        Console.WriteLine("What Percent of the Banana would you like to eat?");
        dblpercent = Convert.ToDouble(Console.ReadLine());
        Console.WriteLine("You have " + (apple.Eat) + "% of your apple and " + (banana.Eat) + "% of your banana left.");
    }

And the code for the Eat method in the other class is:

    public double Eat(double dblpercent)
    {
        return (PercentFruitLeft-dblpercent);
    }

PercentFruitLeft was set up early with a value of 100, and then decreased by whatever the user types in for how much they want to eat.

  • 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-06-14T14:16:32+00:00Added an answer on June 14, 2026 at 2:16 pm

    Method group is an expression used in the C# standard to describe a group of one or more overloaded methods identified by their common name. In this case, the compiler is referring to apple.Eat and banana.Eat method groups.

    You need to call your method with a parameter in parentheses following the name of the method. In addition, you need separate dblpercent variables for the apples and for the bananas:

    Console.WriteLine("What Percent of the Apple would you like to eat?");
    double dblpercentApple = Convert.ToDouble(Console.ReadLine());
    Console.WriteLine("What Percent of the Banana would you like to eat?");
    double dblpercentBanana = Convert.ToDouble(Console.ReadLine());
    Console.WriteLine("You have " + (apple.Eat(dblpercentApple)) + "% of your apple and " + (banana.Eat(dblpercentBanana)) + "% of your banana left.");
    

    Rather than composing your strings manually with concatenations, you could use formatting, like this:

    Console.WriteLine("You have {0}"% of your apple and {1}% of your banana left.", apple.Eat(dblpercentApple), banana.Eat(dblpercentBanana));
    

    This gives your code additional clarity by keeping the template of the string that you write together in a single string.

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

Sidebar

Related Questions

I'm trying to get the output of the query 'SHOW TABLES FROM database_name' into
I'm trying to get a GDB backtrace output from GDB through PHP. I'd like
I am trying to get SED to transform the output from a TMS320C55x compiler
I am currently trying to get a script to write output from other started
Trying to convert output from a rest_client GET to the characters that are represented
I'm currently trying to get the output of an executable console-app into an other
I'm trying to get console output from a program using this library uZpRunConsoleApp .
I'm trying to get the output from a servlet on an Android phone. This
I have a test class that I'm trying to run from a main method
I am really new to C++ and I am trying to get the output

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.