SlideShare ist ein Scribd-Unternehmen logo
1 von 2
Given the following interface for a list, comment on it from the perspective of an ADT. Consider
what is in there and what is missing, what is right and what is wrong.
Solution
Note Points of Interface:
Interface provides the declaration of abstract methods that needs to be implemented in the class
by which the interface is implementing.
Interface does not have a construcor.It contains the abstract method declaration and static
constants.
---------------------------------------------------------------------------------------------------------------------
---------------------
//Comments are provide which is valid and invalid methods
public interface ArrayList
{
//It is not valid since the class implementing the interface will have to implement only methods
//not class constructor
//Invalid declaration
// public ArrayList(void) { List = 0 };
//constructor - initializes list to be empty
//Invalid abstract method since the return type of the method Insert is missing
public Insert(itemtype item, int index);
//verifies index & inserts item at position index in list
//valid abstract method
public int Search (itemtype item);
//searches list & returns position of item. Returns -1 if not found
//valid abstract method
public int CountItem ( itemtype Item);
//invalid abstract method  ,methods should be public since
//the methods need to implemented in the class
//validates that index is position within list
private boolean VerifyIndex (int index);
}
---------------------------------------------------------------------
Correct interface declaration
public interface ArrayList
{
public void Insert(itemtype item, int index);
public int Search (itemtype item);
public int CountItem ( itemtype Item);
public boolean VerifyIndex (int index);
}

Weitere ähnliche Inhalte

Ähnlich wie Commenting on an interface for a list ADT

NACCL-Requirements-Specification-Template
NACCL-Requirements-Specification-TemplateNACCL-Requirements-Specification-Template
NACCL-Requirements-Specification-TemplateJason Weber
 
Use Case Diagram
Use Case DiagramUse Case Diagram
Use Case DiagramAshesh R
 
Java Chapter 04 - Writing Classes: part 4
Java Chapter 04 - Writing Classes: part 4Java Chapter 04 - Writing Classes: part 4
Java Chapter 04 - Writing Classes: part 4DanWooster1
 
SE2018_Lec 16_ Architectural Design
SE2018_Lec 16_ Architectural DesignSE2018_Lec 16_ Architectural Design
SE2018_Lec 16_ Architectural DesignAmr E. Mohamed
 
Software Requirements in Software Engineering SE5
Software Requirements in Software Engineering SE5Software Requirements in Software Engineering SE5
Software Requirements in Software Engineering SE5koolkampus
 
12.2 Abstract class and Interface.ppt
12.2 Abstract class and Interface.ppt12.2 Abstract class and Interface.ppt
12.2 Abstract class and Interface.pptVISHNUSHANKARSINGH3
 
CSCI-383 Lecture 3-4: Abstraction
CSCI-383 Lecture 3-4: AbstractionCSCI-383 Lecture 3-4: Abstraction
CSCI-383 Lecture 3-4: AbstractionJI Ruan
 
12c SQL Plan Directives
12c SQL Plan Directives12c SQL Plan Directives
12c SQL Plan DirectivesFranck Pachot
 
IBM Informix Database SQL Set operators and ANSI Hash Join
IBM Informix Database SQL Set operators and ANSI Hash JoinIBM Informix Database SQL Set operators and ANSI Hash Join
IBM Informix Database SQL Set operators and ANSI Hash JoinAjay Gupte
 
SE - Software Requirements
SE - Software RequirementsSE - Software Requirements
SE - Software RequirementsJomel Penalba
 
A novel methodology for test scenario generation based on control flow analys...
A novel methodology for test scenario generation based on control flow analys...A novel methodology for test scenario generation based on control flow analys...
A novel methodology for test scenario generation based on control flow analys...eSAT Publishing House
 

Ähnlich wie Commenting on an interface for a list ADT (20)

C# 3.0 Course
C# 3.0 CourseC# 3.0 Course
C# 3.0 Course
 
Automated Examination system
Automated Examination systemAutomated Examination system
Automated Examination system
 
NACCL-Requirements-Specification-Template
NACCL-Requirements-Specification-TemplateNACCL-Requirements-Specification-Template
NACCL-Requirements-Specification-Template
 
Use Case Diagram
Use Case DiagramUse Case Diagram
Use Case Diagram
 
Java Chapter 04 - Writing Classes: part 4
Java Chapter 04 - Writing Classes: part 4Java Chapter 04 - Writing Classes: part 4
Java Chapter 04 - Writing Classes: part 4
 
IETM Software: Guidelines to OEMs
IETM Software: Guidelines to OEMsIETM Software: Guidelines to OEMs
IETM Software: Guidelines to OEMs
 
Srs template
Srs templateSrs template
Srs template
 
SE2018_Lec 16_ Architectural Design
SE2018_Lec 16_ Architectural DesignSE2018_Lec 16_ Architectural Design
SE2018_Lec 16_ Architectural Design
 
Software Requirements in Software Engineering SE5
Software Requirements in Software Engineering SE5Software Requirements in Software Engineering SE5
Software Requirements in Software Engineering SE5
 
Srs
SrsSrs
Srs
 
12.2 Abstract class and Interface.ppt
12.2 Abstract class and Interface.ppt12.2 Abstract class and Interface.ppt
12.2 Abstract class and Interface.ppt
 
CSCI-383 Lecture 3-4: Abstraction
CSCI-383 Lecture 3-4: AbstractionCSCI-383 Lecture 3-4: Abstraction
CSCI-383 Lecture 3-4: Abstraction
 
Guidelines to OEMs IETM.pdf
Guidelines to OEMs IETM.pdfGuidelines to OEMs IETM.pdf
Guidelines to OEMs IETM.pdf
 
Methods.ppt
Methods.pptMethods.ppt
Methods.ppt
 
Component diagram
Component diagramComponent diagram
Component diagram
 
Day01 01 software requirement concepts
Day01 01 software requirement conceptsDay01 01 software requirement concepts
Day01 01 software requirement concepts
 
12c SQL Plan Directives
12c SQL Plan Directives12c SQL Plan Directives
12c SQL Plan Directives
 
IBM Informix Database SQL Set operators and ANSI Hash Join
IBM Informix Database SQL Set operators and ANSI Hash JoinIBM Informix Database SQL Set operators and ANSI Hash Join
IBM Informix Database SQL Set operators and ANSI Hash Join
 
SE - Software Requirements
SE - Software RequirementsSE - Software Requirements
SE - Software Requirements
 
A novel methodology for test scenario generation based on control flow analys...
A novel methodology for test scenario generation based on control flow analys...A novel methodology for test scenario generation based on control flow analys...
A novel methodology for test scenario generation based on control flow analys...
 

Mehr von delicecogupdyke

You have been learning about Urie Bronfenbrenner this week- Let's mak.docx
You have been learning about Urie Bronfenbrenner this week-  Let's mak.docxYou have been learning about Urie Bronfenbrenner this week-  Let's mak.docx
You have been learning about Urie Bronfenbrenner this week- Let's mak.docxdelicecogupdyke
 
You encounter a flat green organism growing on a rock with no obvious.docx
You encounter a flat green organism growing on a rock with no obvious.docxYou encounter a flat green organism growing on a rock with no obvious.docx
You encounter a flat green organism growing on a rock with no obvious.docxdelicecogupdyke
 
You are the PR specialist for St- John's Ambulance- The organization w.docx
You are the PR specialist for St- John's Ambulance- The organization w.docxYou are the PR specialist for St- John's Ambulance- The organization w.docx
You are the PR specialist for St- John's Ambulance- The organization w.docxdelicecogupdyke
 
You are the CFO of a large academic medical center and your organizati (1).docx
You are the CFO of a large academic medical center and your organizati (1).docxYou are the CFO of a large academic medical center and your organizati (1).docx
You are the CFO of a large academic medical center and your organizati (1).docxdelicecogupdyke
 
You are on a field trip with your bio class- Your water sample from a.docx
You are on a field trip with your bio class- Your water sample from a.docxYou are on a field trip with your bio class- Your water sample from a.docx
You are on a field trip with your bio class- Your water sample from a.docxdelicecogupdyke
 
You are fortunate to travel to a tropical forest- You find an insect o.docx
You are fortunate to travel to a tropical forest- You find an insect o.docxYou are fortunate to travel to a tropical forest- You find an insect o.docx
You are fortunate to travel to a tropical forest- You find an insect o.docxdelicecogupdyke
 
You are a Government employee working in the Human Resources departmen.docx
You are a Government employee working in the Human Resources departmen.docxYou are a Government employee working in the Human Resources departmen.docx
You are a Government employee working in the Human Resources departmen.docxdelicecogupdyke
 
You are a genetic cownselar- A single mother cnmes to vou- where both.docx
You are a genetic cownselar- A single mother cnmes to vou- where both.docxYou are a genetic cownselar- A single mother cnmes to vou- where both.docx
You are a genetic cownselar- A single mother cnmes to vou- where both.docxdelicecogupdyke
 
Write the following report that can be a powerpoint presentation-The g.docx
Write the following report that can be a powerpoint presentation-The g.docxWrite the following report that can be a powerpoint presentation-The g.docx
Write the following report that can be a powerpoint presentation-The g.docxdelicecogupdyke
 
Write two functions using the Front and Back Linear Search algorithms-.docx
Write two functions using the Front and Back Linear Search algorithms-.docxWrite two functions using the Front and Back Linear Search algorithms-.docx
Write two functions using the Front and Back Linear Search algorithms-.docxdelicecogupdyke
 
xpected to grow geometrically- (Assume that interactions ith other spe.docx
xpected to grow geometrically- (Assume that interactions ith other spe.docxxpected to grow geometrically- (Assume that interactions ith other spe.docx
xpected to grow geometrically- (Assume that interactions ith other spe.docxdelicecogupdyke
 
Write the pseudocode for Python for the following- from Celsius to Fah.docx
Write the pseudocode for Python for the following- from Celsius to Fah.docxWrite the pseudocode for Python for the following- from Celsius to Fah.docx
Write the pseudocode for Python for the following- from Celsius to Fah.docxdelicecogupdyke
 
Write the definition of the linkedListKeepLast function- (Please write.docx
Write the definition of the linkedListKeepLast function- (Please write.docxWrite the definition of the linkedListKeepLast function- (Please write.docx
Write the definition of the linkedListKeepLast function- (Please write.docxdelicecogupdyke
 
Write SQL commands that convert the Database schema to Tables with the.docx
Write SQL commands that convert the Database schema to Tables with the.docxWrite SQL commands that convert the Database schema to Tables with the.docx
Write SQL commands that convert the Database schema to Tables with the.docxdelicecogupdyke
 
write the adjusting entries for following Given Data-.docx
write the adjusting entries for following    Given Data-.docxwrite the adjusting entries for following    Given Data-.docx
write the adjusting entries for following Given Data-.docxdelicecogupdyke
 
Write python code to collect 1000 posts from Twitter- or Facebook- or.docx
Write python code to collect 1000 posts from Twitter- or Facebook- or.docxWrite python code to collect 1000 posts from Twitter- or Facebook- or.docx
Write python code to collect 1000 posts from Twitter- or Facebook- or.docxdelicecogupdyke
 
write one to two paragraphs on the significance about Jati Explain how.docx
write one to two paragraphs on the significance about Jati Explain how.docxwrite one to two paragraphs on the significance about Jati Explain how.docx
write one to two paragraphs on the significance about Jati Explain how.docxdelicecogupdyke
 
Write in C++ Calculate the mean of a vector of floating point numbers.docx
Write in C++ Calculate the mean of a vector of floating point numbers.docxWrite in C++ Calculate the mean of a vector of floating point numbers.docx
Write in C++ Calculate the mean of a vector of floating point numbers.docxdelicecogupdyke
 
Write down the code that will count the number of clicks for a LIKE bu.docx
Write down the code that will count the number of clicks for a LIKE bu.docxWrite down the code that will count the number of clicks for a LIKE bu.docx
Write down the code that will count the number of clicks for a LIKE bu.docxdelicecogupdyke
 
Write declarations for variables p1 and p2 whose values will be addres.docx
Write declarations for variables p1 and p2 whose values will be addres.docxWrite declarations for variables p1 and p2 whose values will be addres.docx
Write declarations for variables p1 and p2 whose values will be addres.docxdelicecogupdyke
 

Mehr von delicecogupdyke (20)

You have been learning about Urie Bronfenbrenner this week- Let's mak.docx
You have been learning about Urie Bronfenbrenner this week-  Let's mak.docxYou have been learning about Urie Bronfenbrenner this week-  Let's mak.docx
You have been learning about Urie Bronfenbrenner this week- Let's mak.docx
 
You encounter a flat green organism growing on a rock with no obvious.docx
You encounter a flat green organism growing on a rock with no obvious.docxYou encounter a flat green organism growing on a rock with no obvious.docx
You encounter a flat green organism growing on a rock with no obvious.docx
 
You are the PR specialist for St- John's Ambulance- The organization w.docx
You are the PR specialist for St- John's Ambulance- The organization w.docxYou are the PR specialist for St- John's Ambulance- The organization w.docx
You are the PR specialist for St- John's Ambulance- The organization w.docx
 
You are the CFO of a large academic medical center and your organizati (1).docx
You are the CFO of a large academic medical center and your organizati (1).docxYou are the CFO of a large academic medical center and your organizati (1).docx
You are the CFO of a large academic medical center and your organizati (1).docx
 
You are on a field trip with your bio class- Your water sample from a.docx
You are on a field trip with your bio class- Your water sample from a.docxYou are on a field trip with your bio class- Your water sample from a.docx
You are on a field trip with your bio class- Your water sample from a.docx
 
You are fortunate to travel to a tropical forest- You find an insect o.docx
You are fortunate to travel to a tropical forest- You find an insect o.docxYou are fortunate to travel to a tropical forest- You find an insect o.docx
You are fortunate to travel to a tropical forest- You find an insect o.docx
 
You are a Government employee working in the Human Resources departmen.docx
You are a Government employee working in the Human Resources departmen.docxYou are a Government employee working in the Human Resources departmen.docx
You are a Government employee working in the Human Resources departmen.docx
 
You are a genetic cownselar- A single mother cnmes to vou- where both.docx
You are a genetic cownselar- A single mother cnmes to vou- where both.docxYou are a genetic cownselar- A single mother cnmes to vou- where both.docx
You are a genetic cownselar- A single mother cnmes to vou- where both.docx
 
Write the following report that can be a powerpoint presentation-The g.docx
Write the following report that can be a powerpoint presentation-The g.docxWrite the following report that can be a powerpoint presentation-The g.docx
Write the following report that can be a powerpoint presentation-The g.docx
 
Write two functions using the Front and Back Linear Search algorithms-.docx
Write two functions using the Front and Back Linear Search algorithms-.docxWrite two functions using the Front and Back Linear Search algorithms-.docx
Write two functions using the Front and Back Linear Search algorithms-.docx
 
xpected to grow geometrically- (Assume that interactions ith other spe.docx
xpected to grow geometrically- (Assume that interactions ith other spe.docxxpected to grow geometrically- (Assume that interactions ith other spe.docx
xpected to grow geometrically- (Assume that interactions ith other spe.docx
 
Write the pseudocode for Python for the following- from Celsius to Fah.docx
Write the pseudocode for Python for the following- from Celsius to Fah.docxWrite the pseudocode for Python for the following- from Celsius to Fah.docx
Write the pseudocode for Python for the following- from Celsius to Fah.docx
 
Write the definition of the linkedListKeepLast function- (Please write.docx
Write the definition of the linkedListKeepLast function- (Please write.docxWrite the definition of the linkedListKeepLast function- (Please write.docx
Write the definition of the linkedListKeepLast function- (Please write.docx
 
Write SQL commands that convert the Database schema to Tables with the.docx
Write SQL commands that convert the Database schema to Tables with the.docxWrite SQL commands that convert the Database schema to Tables with the.docx
Write SQL commands that convert the Database schema to Tables with the.docx
 
write the adjusting entries for following Given Data-.docx
write the adjusting entries for following    Given Data-.docxwrite the adjusting entries for following    Given Data-.docx
write the adjusting entries for following Given Data-.docx
 
Write python code to collect 1000 posts from Twitter- or Facebook- or.docx
Write python code to collect 1000 posts from Twitter- or Facebook- or.docxWrite python code to collect 1000 posts from Twitter- or Facebook- or.docx
Write python code to collect 1000 posts from Twitter- or Facebook- or.docx
 
write one to two paragraphs on the significance about Jati Explain how.docx
write one to two paragraphs on the significance about Jati Explain how.docxwrite one to two paragraphs on the significance about Jati Explain how.docx
write one to two paragraphs on the significance about Jati Explain how.docx
 
Write in C++ Calculate the mean of a vector of floating point numbers.docx
Write in C++ Calculate the mean of a vector of floating point numbers.docxWrite in C++ Calculate the mean of a vector of floating point numbers.docx
Write in C++ Calculate the mean of a vector of floating point numbers.docx
 
Write down the code that will count the number of clicks for a LIKE bu.docx
Write down the code that will count the number of clicks for a LIKE bu.docxWrite down the code that will count the number of clicks for a LIKE bu.docx
Write down the code that will count the number of clicks for a LIKE bu.docx
 
Write declarations for variables p1 and p2 whose values will be addres.docx
Write declarations for variables p1 and p2 whose values will be addres.docxWrite declarations for variables p1 and p2 whose values will be addres.docx
Write declarations for variables p1 and p2 whose values will be addres.docx
 

Kürzlich hochgeladen

mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 

Kürzlich hochgeladen (20)

mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 

Commenting on an interface for a list ADT

  • 1. Given the following interface for a list, comment on it from the perspective of an ADT. Consider what is in there and what is missing, what is right and what is wrong. Solution Note Points of Interface: Interface provides the declaration of abstract methods that needs to be implemented in the class by which the interface is implementing. Interface does not have a construcor.It contains the abstract method declaration and static constants. --------------------------------------------------------------------------------------------------------------------- --------------------- //Comments are provide which is valid and invalid methods public interface ArrayList { //It is not valid since the class implementing the interface will have to implement only methods //not class constructor //Invalid declaration // public ArrayList(void) { List = 0 }; //constructor - initializes list to be empty //Invalid abstract method since the return type of the method Insert is missing public Insert(itemtype item, int index); //verifies index & inserts item at position index in list //valid abstract method public int Search (itemtype item); //searches list & returns position of item. Returns -1 if not found //valid abstract method public int CountItem ( itemtype Item); //invalid abstract method  ,methods should be public since //the methods need to implemented in the class
  • 2. //validates that index is position within list private boolean VerifyIndex (int index); } --------------------------------------------------------------------- Correct interface declaration public interface ArrayList { public void Insert(itemtype item, int index); public int Search (itemtype item); public int CountItem ( itemtype Item); public boolean VerifyIndex (int index); }