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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:08:24+00:00 2026-06-13T22:08:24+00:00

I was wondering how I could call getJD() within getToD and keep the parameters

  • 0

I was wondering how I could call getJD() within getToD and keep the parameters intact,(or temporarily set the parameters as variables in main and call the variables to the method).
The parameters are going to be input using the scanner class later in the main method.
import static java.lang.Math.*;

public class jdMethods
{
    public static double getJD(double y, double m, double d){
        if (m<=2.0){
            y--;
            m += 12.0;
        }
        double a=floor(y/100.0);
        return (365.25*(y+4716.0))+(30.6001*(m+1))+d+(2.0-a+floor(a/4.0))-1524.5;
    }

    public static double getToD(int h, int m, int s)
    {
        double a = getJD(a, a, a) + ((h-12)/24) + (m/1440) + (s/86400);
        return a;
    }
}

Edited for clarity.

  • 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-13T22:08:25+00:00Added an answer on June 13, 2026 at 10:08 pm

    It’s not perfectly clear on what you are trying to do, but I assumed that you just want to save the result of your first getJD() and to use the result within your getToD(), so I made a private _jd and created a setter and getter for it.

    import static java.lang.Math.*;
    
    public class jdMethods
    {
    
        private double _jd;
        public double getJD(){
            return _jd;
        }
    
        public void setJD(double y, double m, double d){
            if (m<=2.0){
                y--;
                m += 12.0;
            }
            double a=floor(y/100.0);
            _jd = (365.25*(y+4716.0))+(30.6001*(m+1))+d+(2.0-a+floor(a/4.0))-1524.5;
        }
    
        public double getToD(int h, int m, int s)
        {
            double a = getJD() + ((h-12)/24) + (m/1440) + (s/86400);
            return a;
        }
    }
    

    So here is how you call it:

    jdMethods testRun = new jdMethods();
    testRun.setJD(1,2,3);
    System.out.println(testRun.getToD(3, 2, 1));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering if someone could tell me the best way to call a
I was wondering if I could do pre/post function call in C++ somehow. I
I was wondering how could I reload any website using javascript and set it
I'm wondering if i could intercept the notification ID for the incoming call through
I am wondering if there is any language feature/library/tools/techniques I could use to call
I was wondering how I could access the jQuery custom function within a sub
I was wondering if you could call javascript inside of an ajax statment specificlly
i am wondering could i access my app internal storage using emulator. I mean
Hi sorry still learning here and slow to learning code arguments. Just wondering could
i was wondering how could i emulate a mouse click with c# with kinect.

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.