For the given sequence diagram, Which of the following correctly implements the design?  a)public class Student {      private Course c1 = new Course();      public void enroll()      {           c1.register();           c1.accessCourse();      } } b) public class Course {      private Course c1 = new Student();      public void enroll()      {           c1.register();           c1.accessCourse();      } } c) public class Student {      private Student s1 = new Course();      public void enroll()      {           s1.register();           s1.accessCourse();      } } d)public class Course {      private Course s1 = new Student();      public void enroll()      {           s1.register();           s1.accessCourse();      } } e) public class Course {      private Course c1 = new Course();      public void enroll()      {           s1.register();           s1.accessCourse();      } }

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 14RQ
icon
Related questions
Question

For the given sequence diagram,

Which of the following correctly implements the design? 

a)public class Student

{

     private Course c1 = new Course();

     public void enroll()

     {

          c1.register();

          c1.accessCourse();

     }

}

b) public class Course

{

     private Course c1 = new Student();

     public void enroll()

     {

          c1.register();

          c1.accessCourse();

     }

}

c) public class Student

{

     private Student s1 = new Course();

     public void enroll()

     {

          s1.register();

          s1.accessCourse();

     }

}

d)public class Course

{

     private Course s1 = new Student();

     public void enroll()

     {

          s1.register();

          s1.accessCourse();

     }

}

e) public class Course

{

     private Course c1 = new Course();

     public void enroll()

     {

          s1.register();

          s1.accessCourse();

     }

}

s1:Student
enroll()
<<create>>
c1:Course
register()
accessCourse()
Transcribed Image Text:s1:Student enroll() <<create>> c1:Course register() accessCourse()
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Distributed Database Concepts
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,