```
i am doing this gpa java program where I have to implement two method, one called calgpa and the next calqualitypoints, and i have also have to put in two java arrays one for the numbers of courses and the other for whats graded
the problem my program is giving me a runtime error and ah cyah seem to figure out how, why and where
here is the program
public static int calGpa(int totalcredit, int totalqpt)
{
int totalnumqpts = 0, totalnumcredits = 0, gpa;
gpa = (totalnumqpts / totalnumcredits);
return gpa;
}
public static double calQualityPoints (double qpt)
{
double usercode = 0, qpts = 0;
if(usercode == 1)
{
qpts = 4 * 3;
}
else if(usercode == 2)
{
qpts = 3.5 * 3;
}
else if(usercode == 3)
{
qpts = 3.0 * 3;
}
else if(usercode == 4)
{
qpts = 2.5 * 3;
}
else if(usercode == 5)
{
qpts = 2 * 3;
}
else if(usercode == 6)
{
qpts = 1.5 * 3;
}
else if(usercode == 7)
{
qpts = 1* 3;
}
else if(usercode == 8)
{
qpts = 0 * 3;
}
return qpts;
}
//implementing methods
public static void main(String[] args) {
Scanner kbd = new Scanner (System.in);
String studfirstname, studlastname;
int studidnum;
int acyear, grde =0;
int semesterno = 2;
int numcourses, counter;
String coursecode;
int coursecred, gpa = 0;
int grdesrec =0;
double totalcred = 0 ;
int grdecode, qpts =0, grdepts, totalcredits = 0, totalqpt =0;
double gpacal, cqpts;
System.out.println("please enter the student first name and last name ");// prompt for student first name
studfirstname = kbd.next();
System.out.println("please enter student id number"); //prompt for student id number
studidnum = kbd.nextInt();
System.out.println("please enter academic year");// generate the academic year
acyear = kbd.nextInt();
System.out.println("please enter semester number");//prompt for the number of semester
semesterno = kbd.nextInt();
System.out.println("please enter the number of courses taken");// asking for the number of course will be taken
numcourses = kbd.nextInt(); this is where the program would stop and ah wud get the runtime error
//prompting for student information-.
//calculation
gpacal=calGpa(totalcredits,totalqpt); did I called the method correctly is the calculation wrong or something
cqpts = calQualityPoints (qpts); this is where I would get a runtime error
// prompting for the course informtion below
System.out.println("please enter your course code");// need course code
coursecode = kbd.next();
```

much thank for the help

so I am wondering if i did the method calculation wrong

did i called the method correctly

what is the correct way to implement array into this program. this is what i have to do