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

C.M.O.T. Dibbler is expanding his business do to the recent sales success of his

ID: 3687019 • Letter: C

Question

C.M.O.T. Dibbler is expanding his business do to the recent sales success of his infamous sausage in a bun and has expanded his business to two other cities on the Sto Plains. Declare and instantiate a multi-dimensional array that will help him keep track of sales for each of his three locations for every week of the year (of which there are 52) and every day of the week. You should choose a meaningful identifier for your array.



Suppose you have a String with the identifier book that contains every word in some book. Write some Java code that would allow you to store each word in an array for later processing. Also describe some pseudo-code for how you would count the number of occurrences for each word. Be precise.



Declare and instantiate an ArrayList object with the identifier paddock that will only accept Cow objects as elements. You should specify an initial capacity of 12 for this ArrayList.



Explanation / Answer

1.
   business are in 3 cities ,total of 52 weeks and each week has 7 days
  
   int sales[][][] = new int[3][52][7];
  
2.
   public static void main(String[] args) {
      
       String text = "fwqefwqf ef 3f 314"; // text of books
      
       // splitting by space and getting array of words
       String []words = text.split("\s+");
      
   }

   // to count occurence of each word:
       Use HashMap<String, Integer> to store word and its cout
      
       1. declare hashmap HashMap<String, Integer> map;
       2. for each word in words array
           2.1 if map.contains(word)
                   then do : increment count of this word
           2.2 else create new entry im map with word and set count=1
          
3.
   ArrayList<Cow> paddock = new ArrayList<Cow>(12);

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