Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
3.9k views
in Computer by (49.9k points)
closed by

Link is an entity which can hold a maximum of 100 integers. Link enables the user to add elements from the rear end and remove integers from the front end of the entity. 

Define a class Link with the following details: 

Class name: Link 

Data Members/instance variables: 

Ink []: entity to hold the integer elements, 

max: stores the maximum capacity of the entity, 

begin: to point to the index of the front end. 

end: to point to the index of the rear end. 

Member functions:

Link(intmm): constructor to initialize max = mm. begin = 0. end = 0. 

void addlink (int v): to add an element from the rear index if possible otherwise display the message “OUT OF SIZE… ” 

int dellink(): to remove and return an element from the front index. 

if possible otherwise display the message “EMPTY …” and return – 99. 

void display(): displays the elements of the entity.

Specify the class Link giving details of the constructor (int), void addlink (int), int dellink() and void display ( ).

1 Answer

+1 vote
by (49.0k points)
selected by
 
Best answer

class Link 

int Ink [ ] = new int [100]; 

int begin, end. max; 

public Link (int mm) { max = mm; begin = end = 0; 

void addlink(int v) 

if (end==0) 

end = begin = 1; 

Ink [end] = v; 

else if (end == max) 

System.out.println("List is Full"); 

else Ink [++end] = v; 

}

int dellink () 

{ int a; 

if (begin == 0) 

{ System.out.println(" Empty..."); 

return - 99; } 

else if (begin == end) 

a = Ink [begin]; 

begin = end = 0; 

return a; 

else 

{

a = Ink [begin]; 

begin++; 

return (a); 

void display() 

int i; 

for(i = begin; i < = end; i++) 

System.out.println(lnk[i]); 

}

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...