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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:59:31+00:00 2026-05-30T21:59:31+00:00

What im trying to do is have the program to run the first set

  • 0

What im trying to do is have the program to run the first set of numbers. Then Use output as ‘X’. So it looks like this
Tnew = Told – m(Told – Tair)
Told is the last equations Tnew.

ex. new = old +6
old = 7
new = 13
new = 13 +6
repeat 

Heres the code ;
package heatloss;

/**
 *
 * @author Eric Franzen
 */
public class HeatLoss {

    public static void heatloss(double x, double m, double a) {
        double heatloss = x - m * (x - a);

        if (x < 55) {
            System.out.println("potatoe too cold");
        }
        else {

            System.out.println(heatloss);
            heatloss(x,m,a);
            x = heatloss;
        }
    }


    public static void main(String[] args) {

        heatloss(80, .01515 ,25); 

    }  

}

Okay so I changed the code to look like this:

public static double heatloss(double x, double m, double a) {
    double heatloss = x - m * (x - a);

    if (x < 55) {
        System.out.println("potatoe too cold");
        return heatloss;
    }
    else {
        System.out.println(heatloss);
        x = heatloss(x,m,a);
        return heatloss;
    }
}

But I get an error at line

x = heatloss(x,m,a);

That “the Assigned value is never used.”
Im not really sure what that means? X is clearly used in the program.

  • 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-30T21:59:33+00:00Added an answer on May 30, 2026 at 9:59 pm

    In order for one invocation of a recursive method to access data inside of another (for example, data stored in local variables), you need to somehow communicate that data out of the second recursive call into the first. In this case, you might want to consider having the heatloss method return the value of the heatloss local variable. For example:

    public static double heatloss(double x, double m, double a) {
        double heatloss = x - m * (x - a);
    
        if (x < 55) {
            System.out.println("potatoe too cold");
            return /* put something here */
        }
        else {
            System.out.println(heatloss);
            x = heatloss(x,m,a);
            return /* put something here */
        }
    }
    

    By filling in the appropriate blanks (I’m not sure how you’d do that here, since I’m not familiar with the particular problem you’re solving), you should be able to communicate information out of the deeper calls into the higher-up calls.

    Hope this helps!

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

Sidebar

Related Questions

I have this output when trying to debug Program received signal SIGSEGV, Segmentation fault
Trying to run my program in FreeBSD OS, I have the following results: $
I've been trying to optimize a numeric program of mine, and have run into
I'm trying to multithread something and i have my program set up such that
I have been trying to set up a program that sends a push notification
I have a python program that does something like this: Read a row from
I have taken the task of trying to get an older program to run
I'm trying to output a set of points that my program creates, and I
I am trying to run an executable from a c++ program. I have looked
I have a program I'm trying to compile, lets call it P. P needs

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.