Hey guys I'm new to java and was wondering if I could have a little assistance. I need to have a user input their number of classes, hours for each class and the grade they received after the information is given i need to calculate their GPA. I have gotten everything done and i have my algorithm for the GPA configuration but I hit a snag. After the user inputs their info I have no idea how to combine all the information to calculate the GPA. Could someone please assist me with this. Thank you. (also I can't use arrays of any kind)
import java.util.Scanner;
public class StudentGPA {
public static void main (String args[]){
Scanner input = new Scanner (System.in);
System.out.println("Please enter your number of classes");
int classes;
classes = input.nextInt();
for(int count = 0; count < classes; count++)
{
int hours;
double grade;
Scanner input2 = new Scanner (System.in);
System.out.println("Please enter the number of hours this course was");
hours = input2.nextInt();
Scanner input3 = new Scanner (System.in);
System.out.println("Please enter your grade for this class");
grade = input3.nextInt();
double gpa = (hours * grade)/ classes;
System.out.println(gpa);
}
}
}