as part of a system for aiding student library research, a program is being deve
ID: 3717448 • Letter: A
Question
as part of a system for aiding student library research, a program is being developed to maintain a bibliography as a student prepares a term paper. You are designed a “Bibliography” class. In essence, a “Bibliography” is a container of “References” (books, papers, etc.).Assume that someone else has the responsibility of designing the reference class. The most essential operations on a Bibliography are to add Reference objects identified by a title (a string), to fetch a Reference previously associated with a title, and to access all references in the bibliography.
Junior program or has propose the following interface for this class.
public class Bibliography { Bibliography(){...} voice put(String title, a Reference h){...} //A data structure will be chosen later };
Modify this proposal to bring in line with appropriate Java style for robust and reusable ADT’s. as part of a system for aiding student library research, a program is being developed to maintain a bibliography as a student prepares a term paper. You are designed a “Bibliography” class. In essence, a “Bibliography” is a container of “References” (books, papers, etc.).
Assume that someone else has the responsibility of designing the reference class. The most essential operations on a Bibliography are to add Reference objects identified by a title (a string), to fetch a Reference previously associated with a title, and to access all references in the bibliography.
Junior program or has propose the following interface for this class.
public class Bibliography { Bibliography(){...} voice put(String title, a Reference h){...} //A data structure will be chosen later };
Modify this proposal to bring in line with appropriate Java style for robust and reusable ADT’s. as part of a system for aiding student library research, a program is being developed to maintain a bibliography as a student prepares a term paper. You are designed a “Bibliography” class. In essence, a “Bibliography” is a container of “References” (books, papers, etc.).
Assume that someone else has the responsibility of designing the reference class. The most essential operations on a Bibliography are to add Reference objects identified by a title (a string), to fetch a Reference previously associated with a title, and to access all references in the bibliography.
Junior program or has propose the following interface for this class.
public class Bibliography { Bibliography(){...} voice put(String title, a Reference h){...} //A data structure will be chosen later };
Modify this proposal to bring in line with appropriate Java style for robust and reusable ADT’s.
Explanation / Answer
// Bibliography class to store references
public class Bibliography{
// data members
private String title; // title
private ArrayList<Reference> references; // list of Reference
// constructor to create a Bibliography object with given title
public Bibliography(String title)
{
this.title = title;
references = new ArrayList<Reference>(); // create an empty list of references
}
// method to add reference
public void addReference(Reference reference)
{
references.add(reference);
}
// method to getTitle
public void getTitle()
{
return title;
}
// method to get list of references
public ArrayList<Reference> getReferences()
{
return references;
}
}
//end of Bibliography class
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.