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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:40:38+00:00 2026-05-25T14:40:38+00:00

I need to create an application to act as a BMI calculator, that collects

  • 0

I need to create an application to act as a BMI calculator, that collects a number of attributes, has matching properties to get and set these attribute values and requests a number of methods to calculate specific data such as patient age, max heart rate, target rates and more.

My question is essentially regarding the usage of methods and to see if this usage is correct or improper.

My method to calculate age looks like the following:

public int Age()
{
   DateTime Now = DateTime.Today;
   return (Now.Year - DateOfBirth);
}

What I am not 100% sure of is if I can now use that method in another method’s calculation, such as the following:

public int MaxHeartRate()
{
   return (220 - Age());
}

I could have used a property to do this as well however, the assignment called for the use of methods to perform the calculation.

Any assistance would be greatly appreciated. I understand the usage between both methods and properties, however I am just unclear on the usage of calling another method inside a method for calculation purposes.

  • 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-25T14:40:39+00:00Added an answer on May 25, 2026 at 2:40 pm

    Yes, this is perfectly fine.

    However, you might have a bug here:

    public int Age() {
        DateTime Now = DateTime.Today;
        return (Now.Year - DateOfBirth);
    }
    

    It’s not clear what DateOfBirth is, but if it represents the year of birth as it appears to, what happens if I’m born December 31, 2011, and DateTime.Now is January 1, 2012 12:00:00.000 AM?

    Also, one point of comment, you’ll often see people write your method as

    public int MaxHeartRate() {
        return (220 - this.Age());
    }
    

    making it crystal clear that we are invoking the instance method Age. Readability is one of the single most important features of writing good code.

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

Sidebar

Related Questions

I need to create a application which is similar to those we will get
So, just like the title says, I need to create an application that gets
I need to create a desktop application that will run third party code, and
i need to create a function in my application to set its available memory
I need to create an application for the iPhone that will connect to a
I need to create an application in PHP that can handle all Unicode characters
i need to create an application in java that would convert text strings into
I need to create an application that should have several themes. It means that
I need to create an application that can be activated with a batch file.
I need to create an application that will block applications to connect to internet

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.