Computer Programming II CS141(Java)
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.
1 is-a
2 instance
3 aggregation
4 is-a
5 composition ; considering a building that has many houses
6 composition
7 association
Parent getBike Inhenitence main() Child getCar0)
Computer Programming II CS141(Java) Mention the appropriate relationship between following classes: HOD–StaffMember Car–Ferrari Student-Address BankAccount–FixedAccount House-Building...
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();...
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 {...
I need help writing my main method**** Computer Science 111 Introduction to Algorithms and Programming: Java Programming Project #4 – Classes and Objects (20 Points) You will create 3 new classes for this project, two will be chosen from the list below and one will be an entirely new class you invent.Here is the list: Shirt Shoe Wine Book Song Bicycle VideoGame Plant Car FootBall Boat Computer WebSite Movie Beer Pants TVShow MotorCycle Design First Create three (3) UML diagrams...
Java Programming
.zip or .jar with 4 files: Shape.java, Square.java,
TSquare.java, Triangle.java
In this homework, you will build the below hierarchy:
Overview:
You will implement the supplier code: Shape, Square, TSquare,
and Triangle, which will be used by the Homework7Main program. This
program will use the DrawingPanel to draw these objects onto a
canvas.
Specification:
You will take advantage of inheritance with using a super class,
Shape.java. (below) Shape is an abstract class, which means it can
be extended, but...