0% found this document useful (0 votes)
32 views4 pages

OOP Concepts in IT Consulting Classes

The document outlines the creation of four main classes for an IT consulting application: Clients, Consultant, Services, and Projects, while explaining the OOP concepts of encapsulation, inheritance, abstraction, and polymorphism. It provides examples of class definitions and methods for handling client information and consultant details, including specialized consultants for Oracle HCM and OpenText. The document emphasizes the use of these concepts to manage sensitive data and customize service responses dynamically.

Uploaded by

4mt21is007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views4 pages

OOP Concepts in IT Consulting Classes

The document outlines the creation of four main classes for an IT consulting application: Clients, Consultant, Services, and Projects, while explaining the OOP concepts of encapsulation, inheritance, abstraction, and polymorphism. It provides examples of class definitions and methods for handling client information and consultant details, including specialized consultants for Oracle HCM and OpenText. The document emphasizes the use of these concepts to manage sensitive data and customize service responses dynamically.

Uploaded by

4mt21is007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

// creating four main classes

Clients – users who required a solution .


Consultant – solution provider
Services – IT consulting services
Projects – Managed IT projects for clients.

oops concept :
1. Encapsulation

situation or where we can use in our application :


Protecting sensitive client and employee data within Oracle HCM

class Client {

constructor(name, email, service) {


[Link] = name;
[Link] = email;
[Link] = service;
}

method to get information

getClientInfo() {
return ` Client: ${[Link]}, service: ${[Link]}`;
}

method update or set data

updatename (newname) {
[Link] = newname;
}

updateProject(newProject) {
[Link] = newservice;
}
}

// Creating an instance

const client1 = new Client("name ", "email", "type of service ");

2. Inheritence

Use Case: Creating a common Consultant class and extending it for different
specializations.

// can be used to store the consultant exprtise , exprience etc

main service for all


Parent Class → Consultant

every individual services as child classes :


a. OracleHCMConsultant
b. OpenTextConsultant

// Parent class: Consultant

class Consultant {
constructor(name, expertise, experience) {
[Link] = name;
[Link] = expertise;
[Link] = experience;
}

getDetails() {
return `${[Link]} is an expert in ${[Link]} with $
{[Link]} years of experience.`;
}
}
class OracleHCMConsultant extends Consultant {
constructor(name, experience) {
super(name, "Oracle HCM", experience);
[Link] = certification;
}

getDetails() {
return `${[Link]()} Certified as ${[Link]}.`;
}
}

const oracleConsultant = new OracleHCMConsultant("any name ", "type of service ",


experience required for thee client );

// Abstraction

// Abstract class: Consultant (Cannot be instantiated directly)


class Consultant {
constructor(name, expertise, experience) {
if ([Link] === Consultant) {
throw new Error("Cannot instantiate an abstract class!");
}
[Link] = name;
[Link] = expertise;
[Link] = experience;
}
// Abstract method (must be implemented by child classes)
getDetails() {
throw new Error("Method 'getDetails()' must be implemented.");
}
}

// Child class: Oracle HCM Consultant


class OracleHCMConsultant extends Consultant {
constructor(name, certification, experience) {
super(name, "Oracle HCM", experience);
[Link] = certification;
}

// Implementing the abstract method


getDetails() {
return `${[Link]} is an expert in ${[Link]} with $
{[Link]} years of experience. Certified as ${[Link]}.`;
}
}

// Creating instances
const oracleConsultant = new OracleHCMConsultant("Alice", "Oracle Certified HCM
Specialist", 7);
const openTextConsultant = new OpenTextConsultant("Bob", 15, 10);
const techLead = new TechnicalLead("Charlie", 25, 15);

polymorphism

Use Case: Handling different types of support requests dynamically.

Implementation: Using method overriding to customize responses. the function with


same name but different types or number of arguement

// Parent class: Consultant


class Consultant {
constructor(name, expertise) {
[Link] = name;
[Link] = expertise;
}

provideService() {
return `${[Link]} provides consulting services in ${[Link]}.`;
}
}

class OracleHCMConsultant extends Consultant {


constructor(name, certification) {
super(name, "Oracle HCM");
[Link] = certification;
}

provideService() {
return `${[Link]} specializes in ${[Link]}, holding a $
{[Link]} certification, helping companies manage HR solutions.`;
}
}

const oracleConsultant = new OracleHCMConsultant("Alice", "Oracle Certified HCM


Specialist");

You might also like