View the step-by-step solution to:


This question was created from


i cannot remember what my tutor wanted me to use to finish this program and it is due tomorrow i know i need some for loopS and if statements but idk which ones i am trying to


if (line . length( ) > 9) {
String prereqs = line. substring(9) . split(", ");
for (String p : prereqs) {
for (int i = 0; i < courses . size( ); it+) {
Course curr = courses . get (i) ;
if (curr . name . equals (p) ) {
//System . out . printIn("added an edge") ;
theCourse . addNeighbor (new Edge (curr ) ) ;
if ( (line . length( ) > 9) ); line. substring(9) . split(", ") );
ArrayList<Course> courses = getGenericParameterTypes(theCourse)
if ( theCourse = ArrayList<course> add . c. ArrayList<course>) ;
//if (there is anything after the colon) {
// split it by commas, get each course in the list of courses, add e
G course to new courses
System . out . print ("Enter a line: ") ;
line = sc. nextLine( );
// when we're here, we have our graph. courses -> prereqs
// look thru the courses, find the ones with the longest chains
// look for two things: either no prereqs at all, or all prereqs are
mark == true)
// outer loop: loop thru courses, look to see if they're not marked
// if they're not marked: trace thru the chain of prereqs to see if n
11 done
// if this is true: add it to the current semester and mark it off

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Let our 24/7 Computer Science tutors help you get unstuck! Ask your first question.
A+ icon
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors