title: Constant expression required? (Java switch statement)
body: <p>I have no idea what is causing this error. My teacher and I went over it and couldn't find what was wrong.</p>
  
  <pre><code>import java.util.Scanner;
  public class MailAssignment
  {
  public static void main(String [] args){
  
      Scanner userinput = new Scanner(System.in);
      char p;
      char f;
      double price = 0;
      System.out.println("First class or priority?");
      char type = userinput.next().charAt(0);
      System.out.println("How much does the package weigh? (in ounces)");
      double weight = userinput.nextDouble();
  
      switch (type){
       case p:
       if (weight &gt; 16)
          price = weight * 3.95;
  
          else if (weight &gt; 32) 
              price = (1.20 * (weight / 16));
         else
              price = 3.50 * weight;
  
  
          break;
  
  
       case f: 
       if (weight &lt; 1 )
       price = 0.34;
  
       else if ( weight &gt; 1)
       price = 0.34 + (weight * 21);
  
       else if (weight &gt; 13)
       price = weight * 3.95;
  
          else if (weight &gt; 32) 
              price = 1.20 * (weight / 16);
          else
              price = 3.50 * weight;
  
              break;
  
          }     
  
      System.out.println("Your price is: " +price);
      }
  }
  </code></pre>
  
  <p>It throws a "Constant expression required" error when it's compiled and it points to the case p: line, however, it also throws it for f: if I switch them so I must be doing something completely off.</p>