a. Mention the appropriate relationship between following classes: [0.5 Marks]
1. HOD–StaffMember
2. Car–Ferrari
3. Student-Address
4. BankAccount–FixedAccount
5. House-Building
6. Department-Teacher
7. Traffic–TrafficSign
b. Provide the UML diagram for the following program. [ 0.5 Marks]
class Parent {
public void getBike() { System.out.println("Suzuki Bike"); } }
class Child extends Parent {
public void getCar() { System.out.println("Swift car"); } }
class inheritance { public static void main(String args[]) {
Parent p = new Parent();
p.getBike();
Child c = new Child();
c.getBike(); c.getCar(); } }
a. relationship
1. HOD–StaffMember ------ Specialization and Inheritance( HOD is subType of a StaffMember)
2. Car–Ferrari -----------Generalization and Inheritance (Ferrari is a Type of Car)
3. Student-Address -------------- Composition (Student has an Address)
4. BankAccount–FixedAccount --------------Generalization and Inheritance(FixedAccount is a Type of BankAccount)
5. House-Building ------- Aggregation( A Building has many Houses)
6. Department-Teacher ---------- Multiplicity ( A Department has many Teachers)
7. Traffic–TrafficSign -----------Composition (Traffic consist of traffic signs)
b. UML
Do ask if any doubt. Please upvote.
a. Mention the appropriate relationship between following classes: [0.5 Marks] 1. HOD–StaffMember 2. Car–Ferrari 3. Student-Address...
Computer Programming II CS141(Java) Mention the appropriate relationship between following classes: HOD–StaffMember Car–Ferrari Student-Address BankAccount–FixedAccount House-Building Department-Teacher Traffic–TrafficSign Provide the UML diagram for the following program. class Parent { public void getBike() { System.out.println("Suzuki Bike"); } } class Child extends Parent { public void getCar() { System.out.println("Swift car"); } } class inheritance { public static void main(String args[]) { Parent p = new Parent(); p.getBike(); Child c = new Child(); c.getBike(); c.getCar(); } }
What is the output for the following program codes? a) [ 0.5 Mark ] class A { int i; } class B extends A { int j; void display() { super.i = j + 1; System.out.println(j + " " + i); }} class inheritance { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; obj.display(); }} OUTPUT: b) [ 0.5 Mark ] class Parent { public void getBike(){ System.out.println("Suzuki Bike"); }} class Child extends Parent {...