I am new in recursion, can someone please enlighten me.
The Problem is:
Find the average grade of the quiz of the Students with #101."
I already solve it using iteration, but I have no idea how to convert it into recursion.
import java.io.*;
import java.util.*;
public class Test{
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Scanner sc = new Scanner(System.in);
String arr[][] = {{"101","Quiz","90"},{"101","CS","80"},{"102","Quiz","85"},{"101","Quiz","75"},{"103","CS","84"},{"101","Quiz","87"}};
int sum = 0;
int ave = 0;
System.out.println("Student #\tType\tGrade");
for(int ctr = 0; ctr<arr.length; ctr++){
System.out.println(arr[ctr][0]+"\t\t"+arr[ctr][1]+"\t"+arr[ctr][2]);
if(arr[ctr][0] == "101"){
if(arr[ctr][1] == "Quiz"){
sum += Integer.parseInt(arr[ctr][2]);
ave += 1;
}
}
}
System.out.println("The Average quiz of Student # 101 is: "+ sum/ave);
}
}