Getting an error when trying to run my last method

raise error python
python exception class
python catch all exceptions
python try except: print error
python raise
python except exception as e
python try except any error
python try except: print error message

My program requires me to create 4 methods. 1 to take in length, 1 to take width, and 1 to calculate the area, and 1 to display the area. My code seems to be working up till the final method where i need to display my area. I've tried pretty much almost everything i can think of but it still isn't working.

    import java.io.*;
    import java.util.*;

    public class Lab9Q2
    {
      public static double getLength()
    {
        Scanner keyboard = new Scanner (System.in);          // Create Method
        System.out.println ("Enter the length of the rectange"); // ask for the length 
        double length = keyboard.nextDouble();
        return length;
      }

      public static double getWidth()
      {
        Scanner keyboard = new Scanner (System.in);          // Create Method
        System.out.println ("Enter the width of the rectange"); // ask for the width
        double width = keyboard.nextDouble();
        return width;
      }

      public static double getArea (double length, double width)
      {
        double area; 
        area = length*width;
        return area; 
      }
      public static double displayArea (double length, double width, double area)
      {
        System.out.println ("The length is: " + length);
        System.out.println ("The width is: " + width);
        System.out.println ("The area of the rectangle is: " + area);
      }
    public static void main (String [] args)
    {
      getLength();
      getWidth();
      displayArea(length, width, area);
    }
    }

The program should use all my method calls and then display the results properly but it wont do so.

You probably intended to use the three results from the helper methods in the final call to displayArea():

public static void main (String[] args) {
    double length = getLength();
    double width = getWidth();
    double area = getArea(length, width);
    displayArea(length, width, area);
}

8. Errors and Exceptions — Python 3.8.5 documentation, The last line of the error message indicates what happened. If no exception occurs, the except clause is skipped and execution of the try or a base class thereof (but not the other way around — an except clause listing a derived try: .. . this_fails() except ZeroDivisionError as err: print('Handling run-time error:', err) . Line number of the file at which the error occurred. For more information about error identifiers, see MException. s = lasterror (err) sets the last error information to the error message and identifier specified in the structure err. Subsequent invocations of lasterror return this new error information.

Change the main block as below

public static void main(String [] args) {
  double length = getLength();
  double width = getWidth();
  double area  = getArea(length, width);
  displayArea(length, width, area);
}

You missed the assignments and calling getArea function

ERROR-STATUS system handle, A handle to error information on the last statement executed with the NO-ERROR option. Syntax. ERROR-STATUS [ :attribute | :method ]� Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question.Provide details and share your research! But avoid …. Asking for help, clarification, or responding to other answers.

Two ways you can get your code working

1) change your main method as

public static void main (String[] args) {
double length = getLength();
double width = getWidth();
double area = getArea(length, width);
displayArea(length, width, area);
}

2) Declare your length,width,area globally.

import java.io.*;
import java.util.*;

public class Lab9Q2
{
  public static double length;
  public static double width;
  public static double area;

  public static void getLength()
{
    Scanner keyboard = new Scanner (System.in);          // Create Method
    System.out.println ("Enter the length of the rectange"); // ask for the length 
    length = keyboard.nextDouble();

  }

  public static void getWidth()
  {
    Scanner keyboard = new Scanner (System.in);          // Create Method
    System.out.println ("Enter the width of the rectange"); // ask for the width
    width = keyboard.nextDouble();

  }

  public static void getArea (double length, double width)
  {
    area = length*width;

  }
  public static double displayArea (double length, double width, double area)
  {
    System.out.println ("The length is: " + length);
    System.out.println ("The width is: " + width);
    System.out.println ("The area of the rectangle is: " + area);
  }
public static void main (String [] args)
{
  getLength();  //Here length will get initialised
  getWidth();   //Here width will get initialised
  getArea();   //Here area will get calculated ..you also missed this statement
  displayArea(length, width, area);
}
}

Zoom sdk failed to initizilation ,error:1, internalerror code=0 , Description I'm using the official zoom sdkdocs of android, I'm getting this kind of one more question I'm not able to create a new app using zoom, your android TODO Change it to your web API Key public final static String API_KEY NullPointerException: Attempt to invoke virtual method 'us.zoom.sdk. Frankly, it just seems like a good way to get your rib cage caved in. Then there's trying

Python Exceptions: An Introduction – Real Python, You'll see how to raise exceptions and how to handle them with "try/except" blocks. The last line of the message indicated what type of exception error you ran into. The following function can help you understand the try and except block: If you were to run this code on a Windows machine, you would get the following� This discussion is archived. 2 Replies Latest reply on Sep 1, 2008 11:56 AM by 843785 . Getting the below error while trying to run my servlet.

Handling the 'Unable to Find the Object' Error, last modified on August 05, 2020 If the application was closed after the test run, you can start it again and pause the run on the problematic test line. See instructions for desktop, mobile tests, and web tests that implement the default approach The object has not been created by the time TestComplete tries to obtain it. Original Title: Stop running this script? When I am on Facebook, I keep getting an Internet box popping up saying, "Stop running this script? A script on this page is causing your web browser to run slowly. If it continues to run, your computer might become unresponsive. Yes or No." I keep hitting "Yes", but the message keeps appearing.

Marketing API Conventions, Get to know the conventions of the Mailchimp Marketing API. The override will not work with any other method, so if you try and use the override header with a GET, PATCH When you replace those values with actual data, your final URL should look If you run into trouble, here's the list of global errors for the Mailchimp� The Macro Error message appears when there is an error in the macro that you were running. The specified method cannot be used on the specified object for one of the following reasons: An argument contains a value that is not valid.

Comments
  • length, width, area parameters are not defined for displayArea method.
  • Bsed upon this the code should not even compile.
  • What is it, that you "can think of" but does not work? @ScaryWombat would have been easier to guess, if the post had contained kind of an error message or so, right? ;-)
  • not sure why the answer that seems a copy-and-paste of your fine answer got an upvote
  • return length; - why?
  • Also why static?
  • yes actually..no need to return..static method access only static variable
  • so don't do it, just confuses people
  • Removed return statements