Create a source file named wordblender.cpp that implements the class in wordblen
ID: 3718941 • Letter: C
Question
Create a source file named wordblender.cpp that implements the class in wordblender.h in order to pass the tests in main.cpp.
Download all the files here: http://andrewwinslow.com/3333/hwBLND/
1 Introduction A blend word is a word made by combining other words; e.g. turboast (turbo + boast), witchins (witch+ chins), and helloaf (hello + loaf). In this assignment, you'll construct such blend words consisting of words that overlap by exactly two characters Blend words can also be made three or more words, e.g. gumbotchamp (gumbo botchchamp), hois- takebabyss (hoist + stake kebab abyss), and eleventiceliactualpacayugazebonsaikido (eleven + entice + celiac actual alpaca +cayuga + gazebo + bonsai + aikido) 2 Instructions The following files have been given to you 1. A C++ header file (wordblender.h) declaring the WordBlender class 2. A C++ source file (main.cpp) containing a main function with tests 3. A text file (eleven-words.txt) containing 11 words 4. A text file (five-letter-words.txt) containing 1155 five-letter words 5. A text file (six-letter-words.txt) containing 1201 six-letter words Download the files at http://andrewwinslow.com/3333/hwBLND/. Create a new C++ source file named wordblender.cpp that implements the class declared in wordblender.h, so that wordblender.cpp and the provided files compile into a program that runs with no failed tests. Submit the source file word- blender.cpp 3 Submission and Gradirn Submit the aforementioned source file(s) via Blackboard as attached file(s). In the case of multiple submis- sions, the last submission before the deadline is graded For grading, each submission is compiled with the provided files and run. Submissions that do not run to completion (i.e. fail to print "Assignment complete.") receive no credit. Submissions that take an unreasonable amount of time (e.g. more than a minute or so) to run and do not meet the asymptotic efficiency requirements receive no credit. All other submissions receive full credit. See the course late work policy for information about receiving partial credit for late submissionsExplanation / Answer
import java.util.*;
public category ArrayListExample i am attending to add String
*elements therefore I created it of string kind */
ArrayList<String> obj = new ArrayList<String>();
/*This is however components ought to be value-added to the array list*/
obj.add("Ajeet");
obj.add("Harry");
obj.add("Chaitanya");
obj.add("Steve");
obj.add("Anuj");
/* Displaying array list components */
System.out.println("Currently the array list has following elements:"+obj);
/*Add part at the given index*/
obj.add(0, "Rahul");
obj.add(1, "Justin");
/*Remove components from array list like this*/
obj.remove("Chaitanya");
obj.remove("Harry");
System.out.println("Current array list is:"+obj);
/*Remove part from the given index*/
obj.remove(1);
System.out.println("Current array list is:"+obj);
}
}
Output:
Currently the array list has following elements:[Ajeet, Harry, Chaitanya, Steve, Anuj]
Current array list is:[Rahul, Justin, Ajeet, Steve, Anuj]
Current array list is:[Rahul, Ajeet, Steve, Anuj]
Methods of ArrayList category
In the on top of example we've got used ways like add and take away. but there square measure range of ways accessible which may be used directly exploitation object of ArrayList category. Let’s discuss few of the necessary ways.
1) add( Object o): This methodology adds Associate in Nursing object o to the arraylist.
obj.add("hello");
This statement would add a string how-do-you-do within the arraylist ultimately position.
2) add(int index, Object o): It adds the item o to the array list at the given index.
obj.add(2, "bye");
It will add the string bye to the 2d index (3rd position because the array list starts with index 0) of array list.
3) remove(Object o): Removes the item o from the ArrayList.
import java.util.*;
public category ArrayListExample i am attending to add String
*elements therefore I created it of string kind */
ArrayList<String> obj = new ArrayList<String>();
/*This is however components ought to be value-added to the array list*/
obj.add("Ajeet");
obj.add("Harry");
obj.add("Chaitanya");
obj.add("Steve");
obj.add("Anuj");
/* Displaying array list components */
System.out.println("Currently the array list has following elements:"+obj);
/*Add part at the given index*/
obj.add(0, "Rahul");
obj.add(1, "Justin");
/*Remove components from array list like this*/
obj.remove("Chaitanya");
obj.remove("Harry");
System.out.println("Current array list is:"+obj);
/*Remove part from the given index*/
obj.remove(1);
System.out.println("Current array list is:"+obj);
}
}
Output:
Currently the array list has following elements:[Ajeet, Harry, Chaitanya, Steve, Anuj]
Current array list is:[Rahul, Justin, Ajeet, Steve, Anuj]
Current array list is:[Rahul, Ajeet, Steve, Anuj]
Methods of ArrayList category
In the on top of example we've got used ways like add and take away. but there square measure range of ways accessible which may be used directly exploitation object of ArrayList category. Let’s discuss few of the necessary ways.
1) add( Object o): This methodology adds Associate in Nursing object o to the arraylist.
obj.add("hello");
This statement would add a string how-do-you-do within the arraylist ultimately position.
2) add(int index, Object o): It adds the item o to the array list at the given index.
obj.add(2, "bye");
It will add the string bye to the 2d index (3rd position because the array list starts with index 0) of array list.
3) remove(Object o): Removes the item o from the ArrayList.
import java.util.*;
public category ArrayListExample i am attending to add String
*elements therefore I created it of string kind */
ArrayList<String> obj = new ArrayList<String>();
/*This is however components ought to be value-added to the array list*/
obj.add("Ajeet");
obj.add("Harry");
obj.add("Chaitanya");
obj.add("Steve");
obj.add("Anuj");
/* Displaying array list components */
System.out.println("Currently the array list has following elements:"+obj);
/*Add part at the given index*/
obj.add(0, "Rahul");
obj.add(1, "Justin");
/*Remove components from array list like this*/
obj.remove("Chaitanya");
obj.remove("Harry");
System.out.println("Current array list is:"+obj);
/*Remove part from the given index*/
obj.remove(1);
System.out.println("Current array list is:"+obj);
}
}
Output:
Currently the array list has following elements:[Ajeet, Harry, Chaitanya, Steve, Anuj]
Current array list is:[Rahul, Justin, Ajeet, Steve, Anuj]
Current array list is:[Rahul, Ajeet, Steve, Anuj]
Methods of ArrayList category
In the on top of example we've got used ways like add and take away. but there square measure range of ways accessible which may be used directly exploitation object of ArrayList category. Let’s discuss few of the necessary ways.
1) add( Object o): This methodology adds Associate in Nursing object o to the arraylist.
obj.add("hello");
This statement would add a string how-do-you-do within the arraylist ultimately position.
2) add(int index, Object o): It adds the item o to the array list at the given index.
obj.add(2, "bye");
It will add the string bye to the 2d index (3rd position because the array list starts with index 0) of array list.
3) remove(Object o): Removes the item o from the ArrayList.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.