title: Credit card type and validation
body: <p>I would like to run a program that can determine the validation and type of credit card number based of number entered. Compiler shows notification that there is an error in my coding but I cannot detect where is it. The program is also cannot be run. Below is the coding,</p>
  
  <pre><code>    import java.util.*;
  
      public class CreditCard {
  
          public static void main(String args[]) {
                  String CType;(String number) {
                      if (number.startsWith("4"))
                          return "Visa";
                      else if (number.startsWith("5"))
                          return "MasterCard";
                      else if (number.startsWith("6"))
                          return "Discover";
                      else if (number.startsWith("37"))
                          return "American Express";
                      else
                          return "Unknown type";
                  };
              Scanner input = new Scanner(System.in);
  
              System.out.println("Enter a credit card number: ");
              long number = input.nextLong();
  
              long total = sumOfEvenPlaces(number) + (sumOfOddPlaces(number)*2);
  
              if (isValid(total)) {
                  System.out.println("The "+CType+" card number is valid");
              } else {
                  System.out.println("The "+CType+" card number is invalid.");
              }
          }
  
  
  
          public static boolean isValid(long total) {
              if (total % 10 != 0) {
              } else {
                          return true;
                  }
              return false;
          }
  
          public static int sumOfEvenPlaces(long number) {
              int sum = 0;
              int remainder;
              while (number % 10 != 0 || number / 10 != 0) {
                  remainder = (int) (number % 10);
  
                  sum = sum + getDigit(remainder * 2);
                  number /= 100;
              }
              return sum;
          }
  
          public static int getDigit(int number) {
              if (number &gt; 9) {
                  return (number % 10 + number / 10);
              } 
              return number;
          }
  
          public static int sumOfOddPlaces(long number) {
              int sum = 0;
              int remainder;
              number /= 10;
              while (number % 10 != 0 || number / 10 != 0) {
                  remainder = (int) (number % 10);
                  sum = sum + getDigit(remainder * 2);
                  number /= 100;
              }
              return sum;
          }
      }
  </code></pre>