Having trouble finding whats wrong with my code. This is the only section that returns the error "error: variable assignmentTotal might not have been initialized". and "error: variable assignmentMaxTotal might not have been initialized" Any insight would be great!
import java.util.*;
public class Grade
{
public static void main(String[] args)
{
homework();
}
public static void homework()
{
int assScore;
int assMax;
int assignmentMaxTotal;
int assignmentTotal;
Scanner console = new Scanner(System.in);
System.out.println("Homework and Exam 1 weights?");
System.out.print("Using weights of 50 20 30 ");
int weights = console.nextInt();
System.out.println("Homework:");
System.out.print("Number of assignments? ");
int n = console.nextInt();
for (int x = 0; x < n; x++)
{
System.out.print("Assignment " + (x + 1) + " score and max? ");
assScore = console.nextInt();
assMax = console.nextInt();
assignmentMaxTotal =+ assMax;
assignmentTotal =+ assScore;
}
System.out.print("Sections attended? ");
int sections = console.nextInt();
int sectionMax = 20;
int sectionPoints = (sections * 4);
int maxPoints = (assignmentMaxTotal + sectionMax);
int totalPoints = (sectionPoints + assignmentTotal);
System.out.println("Total Points = " + totalPoints + "/" + maxPoints);
}
}