Briefly explain the Polymorphism in object-oriented programming. Use the example of Software, LicensedSoftware and Freeware (assume another new child class) which created in part (b) and (c), and write a code fragment to demonstrate the concept of Polymorphism in software development.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

*need question D only*, got 2 attached picture, one is the question it self and another one is my and to refer so that could do the last question d

+
(a)
(b)
(c)
(d)
package com.mycompany
public interface Product Register Listner {
public void register(String s);
}
package com.mycompany
public abstract class Software implements Product Register Listner!
String name;
double version;
Software(String name,double version }{
super();
}
this.name=name;
this version=version;
abstract void about();
}
package com.mycompany
public final class LincedSoftware extends Software {
private double price;
Linced Software(String name,double version double price){
super(name version);
this.price=price;
}
void about() {
System.out.println("The Software "+name+ " registration detail has sent out ");
}
public void register(String s) {
System.out.print("your user "+s+" account ");
}
public static void main(String args[])
{
LincedSoftware l-new LincedSoftware("window", 7.1,5000);
I.about();
I.register("User@xxx.com");
}
Transcribed Image Text:+ (a) (b) (c) (d) package com.mycompany public interface Product Register Listner { public void register(String s); } package com.mycompany public abstract class Software implements Product Register Listner! String name; double version; Software(String name,double version }{ super(); } this.name=name; this version=version; abstract void about(); } package com.mycompany public final class LincedSoftware extends Software { private double price; Linced Software(String name,double version double price){ super(name version); this.price=price; } void about() { System.out.println("The Software "+name+ " registration detail has sent out "); } public void register(String s) { System.out.print("your user "+s+" account "); } public static void main(String args[]) { LincedSoftware l-new LincedSoftware("window", 7.1,5000); I.about(); I.register("User@xxx.com"); }
Question 4
(a) Define an interface called Product RegisterListener. This interface should
include a void type function called register that accepts a String parameter.
(b)
(c)
(d)
Create an abstract class called Software. Include a String attribute called name and a
double attribute called version. Ensure it can be accessed within the class hierarchy.
Include a constructor to initialize all the attributes. Create an abstract method named
about.
Create a child class called Licensed Software that inherits from the Software and
Product RegistertListener. The class should include a private member called
price as double type. Ensure that this class cannot be sub-classed. Include a constructor
to initialize the data members appropriately. Override the about method to print out all
the software details. Override the register method to pass the email address as the
parameter and it will print out the following sample output:
The software "name" registration details have been sent out
to your user@xxx.com account.
Briefly explain the Polymorphism in object-oriented programming. Use the example of
Software, LicensedSoftware and Freeware (assume another new child class)
which created in part (b) and (c), and write a code ragment to demonstrate the concept
of Polymorphism in software development.
Transcribed Image Text:Question 4 (a) Define an interface called Product RegisterListener. This interface should include a void type function called register that accepts a String parameter. (b) (c) (d) Create an abstract class called Software. Include a String attribute called name and a double attribute called version. Ensure it can be accessed within the class hierarchy. Include a constructor to initialize all the attributes. Create an abstract method named about. Create a child class called Licensed Software that inherits from the Software and Product RegistertListener. The class should include a private member called price as double type. Ensure that this class cannot be sub-classed. Include a constructor to initialize the data members appropriately. Override the about method to print out all the software details. Override the register method to pass the email address as the parameter and it will print out the following sample output: The software "name" registration details have been sent out to your user@xxx.com account. Briefly explain the Polymorphism in object-oriented programming. Use the example of Software, LicensedSoftware and Freeware (assume another new child class) which created in part (b) and (c), and write a code ragment to demonstrate the concept of Polymorphism in software development.
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY