Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java questions How would I go upon doing these? This all goes under a class name

ID: 3846829 • Letter: J

Question

Java questions

How would I go upon doing these?

This all goes under a class named boggle.

ArrayList of class String // stores data from data file with dice data

String // set to the name of input file “BoggleData.txt”

ArrayList of class String // stores data from data file with dictionary data

String // set to the name of input file “Dictionary.txt”

Instantiate an instance of class ReadDataFile passing the file name variable for file BoggleData.txt as an argument

Call method populateData on the above object

Instantiate an instance of class ReadDataFile passing the file name variable for file Dictionary.txt as an argument

Call method populateData on the above object

Instantiate an instance of class Board passing as arguments method call getData on each of the two ReadDataFile object references from above

Call method populateDice on object reference of class Board

Output to the IDE output window the number of objects in the ArrayList of type String that stores the dictionary data

Create member variables of type:

ArrayList of class String // stores data from data file with dice data

String // set to the name of input file “BoggleData.txt”

ArrayList of class String // stores data from data file with dictionary data

String // set to the name of input file “Dictionary.txt”

Method main() should:

Instantiate an instance of class ReadDataFile passing the file name variable for file BoggleData.txt as an argument

Call method populateData on the above object

Instantiate an instance of class ReadDataFile passing the file name variable for file Dictionary.txt as an argument

Call method populateData on the above object

Instantiate an instance of class Board passing as arguments method call getData on each of the two ReadDataFile object references from above

Call method populateDice on object reference of class Board

Output to the IDE output window the number of objects in the ArrayList of type String that stores the dictionary data

Explanation / Answer

Hi friend, You have not posted ReadDataFile class, so i can not know the details of ReadDataFile class.

Also not posted Board class.

Also you have not posted implementation/details of populateDice method.

I have implemented as much as i can using your given information.

import java.io.File;

import java.io.FileNotFoundException;

import java.io.FileReader;

public class Boggle {

  

   // instance members

   java.util.ArrayList<String> diceData;

   String diceInputFile;

   java.util.ArrayList<String> dictionaryData;

   String dictionaryInputFile;

  

   public Boggle(){

       diceInputFile = "BoggleData.txt";

       dictionaryInputFile = "Dictionary.txt";

   }

   void getData(ReadDataFile r) {

      

   }

  

   public static void main(String[] args) throws FileNotFoundException {

      

       ReadDataFile fr = new ReadDataFile("BoggleData.txt");

      

       fr.populateData();

      

       ReadDataFile dr = new ReadDataFile("Dictionary.txt");

      

       dr.populateData();

      

       Boggle boggle = new Boggle();

      

       boggle.getData(fr);

      

       boggle.getData(dr);

      

       Board board = new Board();

       board.populateDice();

      

      

   }

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote