title: Java: Incompatible Types
body: <pre><code>import java.text.*;
  import java.util.*;
  public class Proj3 {
      public static void main(String[]args){
       // DecimalFormat df = new DecimalFormat("#0.00”);
       Scanner s = new Scanner(System.in);
       int TotalHours = 0;
       int TotalGrade = 0;
  
       System.out.print("How many courses did you take? ");
       int Courses = Integer.parseInt(s.nextLine());
       System.out.println("");
  
       int CourseNumber = Courses - (Courses - 1);
       while (Courses &gt; 0){
           System.out.print("Course (" + CourseNumber +"): How many hours? ");
           int Hours = Integer.parseInt(s.nextLine());
           TotalHours = TotalHours + Hours;
  
           System.out.print("Course (" + CourseNumber +"): Letter grade? ");
           char Grade = s.nextLine().charAt(0);
  
           if (Grade == 'A'){
               TotalGrade = TotalGrade + (4 * Hours);
              }
           if (Grade == 'B'){
               TotalGrade = TotalGrade + (3 * Hours);
              }
           if (Grade == 'C'){
               TotalGrade = TotalGrade + (2 * Hours);
              }
           if (Grade == 'D'){
               TotalGrade = TotalGrade + (1 * Hours);
              }
  
           Courses = Courses - 1;
           CourseNumber = CourseNumber + 1;
          }
       Double GPA = TotalGrade / TotalHours;
       System.out.println(df.format(GPA));
  
      }
  }
  </code></pre>
  
  <p>This is for an assignment and I don't know how to fix my problem.
  The <code>Double GPA = TotalGrade / ToutalHours;</code> line is coming up with the <code>Incompatible Types</code> error.</p>
  
  <p>Also I'm supposed to include the <code>DecimalFormat df = new DecimalFormat("#0.00”);</code>line at the beginning of the main but its not working.</p>
  
  <p>Anything is very helpful. Thanks</p>