You are required to implement a preprocessor in Java.
Your preprocessor should be able to perform the following tasks on
an input file, which will be a Java source file:
question needed to be capture the reserved words (for loop, if,
while, class, nested for loop) like the output
((I don't need an explanation for the question, I want an answer
with writing codes))
the input files will be executed are not limited to the examples
given
3. Identifying loops and methods 30 points
Example:
Input:
import java.util.Scanner;
public class Student {
String studentName, studentLastName;
int numberofCourses;
Course[] myCourses = new Course[10];
public Student(String studentName, String studentLastName, int numberofCourses) {
this.studentName = studentName;
this.studentLastName = studentLastName;
this.numberofCourses = numberofCourses;
this.myCourses = new Course[numberofCourses];
}
public void createCourses() {
for(int i = 0; i < numberofCourses; i++) {
myCourses[i] = new Course();
}
}
public void printCourses() {
System.out.println("Student name: " + studentName);
System.out.println("Student last name: " + studentLastName);
for(int i = 0; i < numberOfCourses; i++) {
myCourses[i].printCourse();
}
}
}
Output:
Methods:
public void createCourses() between lines 17-23
public void printCourses() between lines 24-32
Loops:
for loop between lines 19-22
for loop between lines 28-31
Reminders:
1. Your project should work with all inputs conforming to the rules described above. (The input files with which your project will be executed are not limited to the examples given in this file.)