Main function not working due to one method having parameters ? The method Height(int, int ) is not applicable for arguments ()

// Patrik Maco
// 18/10/21
// VERSION 1 
// Write a program that allows the user to input the length, width and height of a room (cm) - volme of balloon (m^3) prints the volume of the room in m^3 and the amount of balloons needed to fill the room.

import java.util.Scanner; 

class volume 
{      
    public static void main (String [] a)
    {     
             Run();
             System.exit(0);
    }

            public static int Length()
{              Scanner scanner  = new Scanner(System.in);
               System.out.println("Enter Values as whole numbers- not as decimals. Do not include measurement. Good example : 5,7,9 Bad example: 3.2, 5cm");
               System.out.println("Length of room (in cm) ? ");
               int length = scanner.nextInt(); 
               return length;
} 

           public static int Width()
{             Scanner scanner = new Scanner(System.in);
              System.out.println("Enter Values as whole numbers- not as decimals. Do not include measurement. Good example : 5,7,9 Bad example: 3.2, 5cm");
              System.out.println("Width of room (in cm) ? ");
              int width = scanner.nextInt();
              return width;
} 

           public static int Height(length, width)
{            Scanner scanner = new Scanner(System.in);
             System.out.println("Enter Values as whole numbers- not as decimals. Do not include measurement. Good example : 5,7,9 Bad example: 3.2, 5cm");
             System.out.println("Height of room (in cm) ? ");
             int height = scanner.nextInt();
             return height;
             System.out.println("Enter the volume of the baloon in M cubed");
             float volume_b;
             volume_b = scanner.nextFloat();
             float RoomVolume;
             RoomVolume = ( height * length * width);
             System.out.println("The volume of the room is : " + RoomVolume);
             float balloon3;
             balloon3 = RoomVolume/1000000;
             float BalloonAmmount;
             BalloonAmmount = balloon3/volume_b;
             int n;
             n = (int)BalloonAmmount;
             System.out.println("The ammount of balloons needed is : " + n);
}
          public static void Run()
{            int length = Length();
             int width =  Width();
             int height = Height();
}

}

**The method Run() returns the error message The method Height(int, int ) is not applicable for arguments (). Im very new to coding and id like an explanation if possible as to how i can fix this issue.

Height includes two parameters in its own method, however if i input the same parameters into Run() my program doesnt run**

Answer

There are multiple problems with your method Height.

  1. In Java, all parameters need to specify their types, so it should be declared as
    public static int Height(int length, int width)
  1. all code after an unconditional return statement is unrechable
       return height;
       // any code after this point is unreachable
  1. if a method takes parameters, you need to provide them explicitly:
    public static void Run()
    {
        int length = Length();
        int width =  Width();
        int height = Height(length, width); // you need to pass length and width!
    }

Other observations:

  • There is no need to explicitly call System.exit(0) at the end of main, the program ends automatically at that point.
  • In Java, it is a very widespread naming convention to consider fields and classes as nouns, and methods as verbs, and name them accordingly. Also, class names typically start by an uppercase letter SomeClassName, while method names typically start with a lower case letter doSomething() by convention.