There is a copy of the following code block in an interactive mode that you can modify and compile. Your task is to improve the codeβs style as an expert would view it, while ensuring its behavior remains unchanged. You may run your refactored code to verify that it still passes all test cases.
public class Scholarship {
public static String getScholarshipEligibility(int schoolYear, double GPA, boolean hasResearchExperience) {
if (schoolYear >= 4 && GPA >= 3.5 && hasResearchExperience == true) {
return "Eligible";
}
return "Not eligible";
}
}
This code can improve further!
public class Scholarship {
public static String getScholarshipEligibility(int schoolYear, double GPA, boolean hasResearchExperience) {
if (schoolYear >= 4 || GPA >= 3.5 || hasResearchExperience == true) {
return "Eligible";
}
return "Not eligible";
}
}
The code doesnβt have the same functionality with the original one. Copy the original code into the interactive section and try refactoring it again.
public class Scholarship {
public static String getScholarshipEligibility(int schoolYear, double GPA, boolean hasResearchExperience) {
if (schoolYear >= 4 && GPA >= 3.5 && hasResearchExperience) {
return "Eligible";
}
return "Not eligible";
}
}