3 public class A extends B { C c1, c2; public A() { c1 = new C(); } public void method() { D d = new D(); d.working(); } } Public class X { public void m() { B var = new A(); double x – Math.sqrt(5); } } public class B implements E { public B() { c1 = new C(); } public void method() { B b = new B(); b.sleep(); } } public class Y { A [] a = new A[5]; } Lab
19 § A classroom has 1 professor, 1 whiteboard, 30 students, and a number of markers. § The classroom “gives” the markers to the professor, and the professor uses them. § The classroom provides students with access to the Professor and the Professor with access to the students. There is a “dependency” between professors and students and between students and professors. § Students and Professors are People. People are able to introduce themselves. § Professors sign a contract to teach. Students sign contract to study. Create a Class Diagram
Winter 2023 Copyright. These slides can only be used as study material for the class CSC308 at Cal Poly. They cannot be distributed or used for another purpose.