Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Develop a method canGraduate that will take two integerparameters major and e

ID: 3609527 • Letter: 1

Question

1. Develop a method canGraduate that will take two integerparameters major and elective and returns a boolean value True orFalse based on the following:

The method will check if a student will be able to graduate ornot based on the number of credit hours he has taken in both majorand elective courses. The student should have at least 44 credithours in major courses and at least 16 credit hours in electivecourses in order to graduate.

2. In your main method you need to read student data from a file(you can create one) which includes the student id, major, majorcredit hours, elective hours.

The main method will call the canGraduate method by passing thevalues read from the file. Then the main method will print a listof students who can graduate this year including the student id andmajor.

Explanation / Answer

please rate - thanks import java.util.*; import java.io.*; public class Graduate {public static void main(String[] args)throwsFileNotFoundException {int count=0,mcredit,elective,id; String major; Scanner in=new Scanner(new File("graduates.txt")); System.out.println("This Years Graduates:"); System.out.println("  ID         major"); while(in.hasNextInt())     {     id=in.nextInt();    major=in.next();    mcredit=in.nextInt();    elective=in.nextInt();    if(canGraduate(mcredit,elective))          System.out.println(id+"      "+major);     }    in.close(); } public static boolean canGraduate(int m, int e)      {if(m+e>=44&&e>=16)             return true;        else              return false;        }        }