title: Java Error: Should be declared in a file named
body: <p>I'm fairly new to Java and trying to figure out how to solve the following error:</p>
  <h2>Error reads</h2>
  <pre><code>CalculatorWithMemory.java:1: class Calculator is public, should be declared 
    in a file named Calculator.java
  public class Calculator
  </code></pre>
  <p>So my thought was that this means that I have to save 2 different .java files.  However, this being for a class, I only have a provided text block to type my solution into so I cannot save these as .java files.  Any thoughts on a solution would be great.</p>
  <p>Thanks in advance!</p>
  <p>To Provide all the information. I'm trying to solve for the following.</p>
  <h2>Question</h2>
  <p>The superclass Calculator contains:</p>
  <ul>
  <li>a (protected) double instance variable, accumulator, that contains the current value of the calculator.</li>
  </ul>
  <p>write a subclass, CalculatorWithMemory, that contains:</p>
  <ul>
  <li>a double instance variable, memory, initialized to 0</li>
  <li>a method, save, that assigns the value of accumulator to memory</li>
  <li>a method, recall, that assigns the value of memory to accumulator</li>
  <li>a method, clearMemory, that assigns zero to memory</li>
  <li>a method, getMemory, that returns the value stored in memory</li>
  </ul>