Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Computer program 420-P26-GG Programming Object I date: Wednesday, May 19th before 11:55 pm - no delay allowed Learning objec�ves • Apply the basic concepts of object-oriented programming to concrete...

1 answer below »
Computer program
420-P26-GG Programming Object I


date: Wednesday, May 19th before 11:55 pm - no delay allowed
Learning objec�ves
• Apply the basic concepts of object-oriented programming to concrete problems • Apply the
concept of encapsula�on
• Apply the overall concept of classes
• Apply good excep�on handling
• Use Java u�li�es
• Implement interfaces
• Use file read / write
• Use java.nio.file classes
Direct access to the defini�on of a word from the dic�onary on a file
text type
Note: This is an educa�onal project, to put certain concepts into prac�ce and keep everything
fairly simple. Respect what is asked here to earn points, even if you think doing otherwise
would be be�er. In a professional implementa�on, we probably wouldn't do things this way
As input, we have a text file " defini�ons.txt " whose one-line format is:
word: defini�on
For example:
Java: very nice language object programming
The aim of this exercise is to consult the dic�onary. To make it easier to find words in
the dic�onary, we are going to create a direct access file " defini�ons.txt.sbc " from
the "file defini�ons.txt " . The “file defini�ons.txt.sbc ”only contains the defini�ons
(no end of line, etc.). We are also going to create an index table whose content of an
entry is:
word displacement length
where:
Project XXXXXXXXXXP26-GG Page 1 of 5
Project 3
to be submi�ed before Wednesday,
May 19, 11:55 p.m. No delay
accepted Delivery
• word is the search word
• displacement is the byte where the defini�on of the word in the direct access
file “ defini�ons.txt.sbc ”
• length is the number of bytes in the defini�on.
For example:
Java XXXXXXXXXX
Means that the defini�on of the word " Java " is at byte XXXXXXXXXXwith a length of XXXXXXXXXXbytes
in the file " defini�ons.txt.sbc "
To perform this job you must use at least the following classes (all instance variables
are private, there is noclass public variables)in a set of classes ( "package") project3:
____________________________________________________________________
theclass Entree that contains:
• theprivate instance word variables, displacement and length
• A constructor which ini�alizes the instance variables using values received as
arguments
• Amethod toString XXXXXXXXXXwhich allows to display an object of type Input
• A String readDefini�on (SeekableByteChannel sbc) method which returns the
defini�on of the cu
ent entry (you must posi�on yourself in the direct access
file).
• Amethod getMot XXXXXXXXXXwhich returns the word of the cu
ent entry. Add the other "
ge�ers ", there should be no " se�ers ".
____________________________________________________________________
In ansub- package index_v1 (therefore project3.index_v1 ), theclass Index which
contains:
• A private instance variable tableIndex of type HasMap declared as follows:
private HashMap tableIndex = new HashMap ();
word object the L'Entree is used as a key in the HashMap.
• A constructor which only displays: " ====== index with HashMap ========="
• Anmethod addEntry that adds e to tableIndex. You should put the word used as
the key in uppercase in the index, but not modify the word read in the file or
at the console in the object e
Project XXXXXXXXXXP26-GG Page 2 of 5
• Anmethod EntersearchEntry (String word) which returns the entry
co
esponding to the word word if it exists in the table and returns null if no
entry contains the word word. The
eakage does not ma�er.
• Do not use
Answered Same Day May 19, 2021

Solution

Rushendra answered on May 19 2021
153 Votes
projet3-Aide-exemples/.classpath
    
    
    
projet3-Aide-exemples/.project
     projet3
    
    
    
    
        
             org.eclipse.jdt.core.javabuilde
            
            
        
    
    
         org.eclipse.jdt.core.javanature
    
projet3-Aide-exemples/.settings/org.eclipse.jdt.core.prefseclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=e
o
org.eclipse.jdt.core.compiler.problem.enumIdentifier=e
o
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
projet3-Aide-exemples
in/BB_utils.classpublic final synchronized class BB_utils {
public void BB_utils();
public static java.nio.ByteBuffer str_to_
(String, java.nio.charset.Charset);
public static String
_to_str(java.nio.ByteBuffer, java.nio.charset.Charset);
}
projet3-Aide-exemples
in/DemoIterateur$Iterateur.classpublic synchronized class DemoIterateur$Iterateur implements java.util.Iterator {
private int iterateur;
void DemoIterateur$Iterateur(DemoIterateur);
public boolean hasNext();
public String next();
}
projet3-Aide-exemples
in/DemoIterateur.classpublic synchronized class DemoIterateur implements Iterable {
private String[] tab;
private int dernierIndex;
public void DemoIterateur(int);
public void ajouter(String);
public boolean rechercherEntree(String);
public String toString();
public java.util.Iterator iterator();
public static void main(String[]);
}
projet3-Aide-exemples
in/DemoSBC.classpublic synchronized class DemoSBC {
public void DemoSBC();
public static void main(String[]) throws java.io.IOException;
}
projet3-Aide-exemples
in/project3/Dictionary.classpackage project3;
public synchronized class Dictionary {
private java.nio.channels.SeekableByteChannel sbc;
private index_v1.Index index;
public void Dictionary(String) throws java.io.IOException;
public String findDefinition(String);
public static void main(String[]) throws java.io.IOException;
private void addMot(String, String) throws java.io.IOException;
public void displayWords();
}
projet3-Aide-exemples
in/project3/index_v1/Enter.classpackage project3.index_v1;
public synchronized class Enter {
public void Enter();
}
projet3-Aide-exemples
in/project3/index_v1/Entree.classpackage project3.index_v1;
public synchronized class Entree {
private String text;
private int displacement;
private int len;
public void Entree(String, int, int);
public String getMot();
public int getDisplacement();
public int getLen();
public String readDefinition(java.nio.channels.SeekableByteChannel);
public String toString();
}
projet3-Aide-exemples
in/project3/index_v1/Index.classpackage project3.index_v1;
public synchronized class Index implements Iterable {
private java.util.HashMap tableIndex;
public void Index();
public Entree EntersearchEntry(String);
public void addEntry(Entree);
public java.util.Iterator iterator();
}
projet3-Aide-exemples
in/project3/index_v1/IterateurIndex.classpackage project3.index_v1;
public synchronized class IterateurIndex implements java.util.Iterator {
public void IterateurIndex();
public boolean hasNext();
public Enter next();
}
projet3-Aide-exemples
in/project3/package-info.classpackage project3;
abstract interface package-info {
}
projet3-Aide-exemples/definitions.txtJava: very nice language object programming
C++: very nice language for gamming
projet3-Aide-exemples/definitionstxt.sbcJava 118 37
C++ 118 30
python 113...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here