Suppose you are working on creating an automatic course planner for WWU students. A student can get a total ofn courses, labeled from 0 ton - 1. Some courses may have prerequisites, for example, to...


Please answer the question in the screenshot.
The language used is Java. Please provide the code to the question with an explanation.


Suppose you are working on creating an automatic course planner for WWU students.<br>A student can get a total ofn courses, labeled from 0 ton - 1.<br>Some courses may have prerequisites, for example, to take course 241 you have to first<br>--.<br>take course 145, which is expressed as a pair: [241, 145] (the current course, the<br>prerequisite of the current course).<br>Given the total number of courses and a list of prerequisite pairs, you need to:<br>Determine if it is possible to finish taking the n courses. If not, print “It is<br>impossible to take all the given courses.

Extracted text: Suppose you are working on creating an automatic course planner for WWU students. A student can get a total ofn courses, labeled from 0 ton - 1. Some courses may have prerequisites, for example, to take course 241 you have to first --. take course 145, which is expressed as a pair: [241, 145] (the current course, the prerequisite of the current course). Given the total number of courses and a list of prerequisite pairs, you need to: Determine if it is possible to finish taking the n courses. If not, print “It is impossible to take all the given courses." If yes, print "It is possible to take all the given courses.", and move to the next step. Generate one schedule of the given courses (prerequisites have to be scheduled first for any courses). Print the courses out with white spaces as separators. There might be multiple valid schedules, but you only need to generate one of them. Еxample 1: 4, [[1,0], [2,0], [3,1]] Output: It is possible to take all the given courses. A possible schedule is 0, 1, 2, 3. Explanation: There are a total of 4 courses to take. To take courses 1 or 2 you should take course 0 first. To take course 3, you should take 1 first.
Ехample 2:<br>2, [[1,01,[0,1]]<br>Output:<br>It is impossible to take all the given courses.<br>Explanation:<br>There are a total of 2 courses to take. To take course 1 you should have finished course<br>0, and to take course 0 you should also have finished course 1.<br>This class needs to be named “CoursePlanner

Extracted text: Ехample 2: 2, [[1,01,[0,1]] Output: It is impossible to take all the given courses. Explanation: There are a total of 2 courses to take. To take course 1 you should have finished course 0, and to take course 0 you should also have finished course 1. This class needs to be named “CoursePlanner". The methods that solve the problem w are arranged as plan: this method returns no value and prints out (b) whether it is possible to take all the given courses and (b) what a possible schedule looks like. check: this method returns a boolean value to indicate whether it is possible to take all the given courses. This method can be seen as a helper for plan
Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here