65.0k views
1 vote
Write an Enlistee class that keeps data attributes for the following pieces of information: • Enlistee name • Enlistee number Next, write a class named Private that is a subclass of the Enlistee class. The Private class should keep data attributes for the following information: • Platoon number (an integer, such as 1, 2, or 3) • Years of service (also an integer)

User Tias
by
4.4k points

1 Answer

3 votes

Answer:

function Enlistee( name, number ){

constructor( ){

super( ) ;

this.name= name;

this.number= number;

this.Private= ( platoonNumber, yearOfService ) =>{

this.platoonNumber = platoonNumber;

this.yearOfService = yearOfService;

}

}

}

Step-by-step explanation:

In Javascript, OOP ( object-oriented programming) just like in other object oriented programming languages, is used to create instance of a class object, which is a blueprint for a data structure.

Above is a class object called Enlistee and subclass "Private" with holds data of comrades enlisting in the military.

User Misnyo
by
4.7k points