title: Java Box program with multiple methods and constructors
body: <p>I am a beginner in programming and am having trouble with using constructors, specifically. I have to write a program for one of my labs that must consist only of:</p>
  
  <blockquote>
    <ol>
    <li>Three instance variables – length, width and height (each of type double)
    
    <ol start="2">
    <li>One instance variables – input (type Scanner) initialized to System.in</li>
    <li>Default constructor (no-arg) – initialize all three instance variables to 1</li>
    <li>Initial constructor – initialize all three instance variables</li>
    <li>Copy constructor – copy Box</li>
    <li>inputWidth, inputLength, and inputHeight methods that set the instance variables based on user input have not parameters and do not
    return a value.</li>
    <li>a displayDimensions method that displays the length X Width X height (separated by “X”) and does not return a value.</li>
    <li>a calcVolume method that has no parameters and calculates the volume of the box</li>
    </ol></li>
    </ol>
    
    <p>We also were given application BoxTest in which the output must
    exactly match the following:</p>
    
    <ul>
    <li>Default dimensions are 1.0 X 1.0 X 1.0 with volume of 1.0 </li>
    <li>Initial dimensions are 8.5 X 11.0 X 1.0 with volume of 93.5</li>
    <li>Copied dimensions are 8.5 X 11.0 X 1.0 with volume of 93.5</li>
    <li>Update dimensions</li>
    <li>Enter length: 1</li>
    <li>Enter width: 2</li>
    <li>Enter height: 3 </li>
    <li>Updated dimensions are 1.0 X 2.0 X 3.0 with volume of 6.0</li>
    </ul>
  </blockquote>
  
  <p>Here's my code:</p>
  
  <pre><code>import java.util.Scanner;
  
  public class Box {
  public static void main(String args[]) {
      double length, width, height;
  
      Scanner input=new Scanner(System.in);
  
  new Box() {     //  
  
  Box defaultBox=new Box();
      double length = 1.0;
      double width = 1.0;
      double height = 1.0;
      System.out.print("Default dimensions are " + length + " X " + width + " X " + height);
      defaultBox.displayDimensions();
      System.out.println(" with volume of "+defaultBox.calcVolume());
  
  Box initialBox=new Box(length, width, height);
      length = 8.5;
      width = 11.0;
      height = 1.0;
      System.out.print("Initial dimensions are " + length + " X " + width + " X " + height);
      initialBox.displayDimensions();
      System.out.println(" with volume of "+initialBox.calcVolume());
  
  Box copyBox=new Box(initialBox);
      System.out.print("Copied dimensions are " + length + " X " + width + " X " + height);
      copyBox.displayDimensions();
      System.out.println(" with volume of "+copyBox.calcVolume());
  
      System.out.println("\nUpdate dimensions");
      initialBox.inputLength();
      initialBox.inputWidth();
      initialBox.inputHeight();
      System.out.print("Updated dimensions are ");
      initialBox.displayDimensions();
      System.out.println(" with volume of "+initialBox.calcVolume());
  }
  double inputLength() {
      Scanner input;
      double length = input.nextDouble(); 
      }
  double inputWidth() {
      Scanner input;
      double width = input.nextDouble();
      }
  double inputHeight() {
      Scanner input;
      double height = input.nextDouble();
      }
  
  double displayDimensions(double length, double width, double height) {   
      Scanner input;
      }
  
  double calcVolume() {
  }
  
  }
  </code></pre>
  
  <p>What am I missing? My program will not compile and gives the error message</p>
  
  <pre><code>Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
      Syntax error, insert "Identifier (" to complete MethodHeaderName
      Syntax error, insert ")" to complete MethodDeclaration
      Syntax error, insert ";" to complete MethodDeclaration
      Syntax error, insert "}" to complete ClassBody
  at Box.main(Box.java:18)
  </code></pre>