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

Preamble: keep a detailed time log of all your activities completed for this exe

ID: 3834944 • Letter: P

Question

Preamble: keep a detailed time log of all your activities completed for this exercise number 4. For each of the following; the requirements engineering (i.e. reading this question etc.), design (including all documentation and submitting on D2L), implementation, testing, record the start time and end tune of each activity session (i.e. every time you sit down to work on this exercise, with or without using a computer, and do it scrupulously as if you were being paid for each minute of your time). Do not submit this raw log but rather produce a Gantt chart similar to Fig. 8.4, page 204, illustrating the order of all activities (they may overlap). Finally, produce the tally of the total time spent on each activity, from requirements to testing) and then give the total time spent on this entire exercise. Summarize all of this on a pie chart like in Figure 1.3 page 15. It may look very different than Figure 1.3, and if it does, state what the main the differences are. Implement and test two versions of the class PairStore that would allow to store an unlimited number of pairs of strings. Assume each stored pair consists of two non null strings: the first string and the second string. One of the versions you implement should use arrays to store the strings. Apart from the two constructors: PairStore () - construct default pair storage object PairStore (int capacity) construct a pair storage object with the preset initial capacity the class should also implement the following four methods void clear ()-removes all stored pairs int size () - returns the number of pairs stored in this object Boolean put (String s1, String s2) - Assume neither s1 nor s2 is a null string. (Unconditionally) add a new pair to the set of stored objects, return true if successful. String get (String s1, String s2) - Assume that exactly one of the parameters, either s1 or s2, is a null string. If s1 is a null string then search for s2, remove the pair with matching s2 and return the matching s1, return null string if not found. If s2 is a null string then search for s1, remove the pair with matching is and return the matching s2, return null string if not found. Write one driver program and link it to each version of the PairStore class separately to run the tests. (Note that the driver program should be identical for both tests.) For this question submit: source code for the driver program and tor the two versions of PairStore results of a few test runs and the charts and the documentation requested m the preamble at the beginning of this question.

Explanation / Answer

/**

*
* @author paramesh
*/
import java.util.*;
public class PlayStore {
int capacity;
ArrayList<String> first;
ArrayList<String> last;
  
//constructor
public PlayStore(int capacity) {
this.capacity = capacity;
first = new ArrayList<>();
last = new ArrayList<>();
}

public PlayStore() {
this.capacity = 0;
first = new ArrayList<>();
last = new ArrayList<>();
}
  
public boolean put(String s1, String s2){
if(first.size() < capacity){
first.add(s1);
last.add(s2);
return true;
}
System.out.println("Not enough space..");
return false;
}
public String get(String s1, String s2) {
if(s1 == null || s1 == ""){
//search for s2
if(s2 == null || s2 == ""){
return null;
}
else{
//searching for s2
for(int i=0;i<last.size();i++) {
if(last.get(i).equals(s2)){
String temp = last.get(i);
//removing that pair
last.remove(i);
first.remove(i);
return temp;
}
}
}
}
else{
//searching for s1
for(int i=0;i<first.size();i++) {
if(first.get(i).equals(s2)){
String temp = first.get(i);
return temp;
}
}
}
return null;
}
//main
public static void main(String args[]) {
// creating object
PlayStore obj = new PlayStore(5);
// storing strings
obj.put("john", "paul");
obj.put("richard", "dennie");
//getting string
System.out.println("checking string with john: "+obj.get("john", "paul"));
}
}

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