Create a class called ListOfThings, that has one ArrayList field called things, which holds a collection...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Create a class called ListOfThings, that has one ArrayList field called things, which holds a collection of Strings (each string is a name of an object in Upper case e.g. CAR or PLANT). Make sure you write a description of your new Class in the comments, with your name as author and give the version as the date you last worked on this exercise. Define a constructor that initialises the ArrayList. Note that you can also add any other initialisations that you feel are relevant. 4 Create methods to add elements, remove elements and get the number of elements in the collection. Add a test for all three of these methods to check whether the operation was successful and print a message letting the user know if it was or was not. Create a method called printThings. This method should loop through the collection and print out the elements (each String on a new line) as determined by the following rules: ● ● If the string contains any vowels (A, E, I, O and U), the method should print "The object '+ the value of the String + " contains vowels, and the vowels are:" + list of the vowels in the string. The string may have more than one vowels. For example, if the name is BIKE it would print: The object BIKE contains vowels, and the vowels are: I E If the string contains duplicate characters, the method should print "The object " + the value of the String + " has the following duplicate character(s):" + list of the duplicate characters in the string. The string may have one or more duplicate character. For example, if the object is RACETRACK, it would print: The object RACETRACK has the following duplicate character(s): R A C If the string contains any vowels (A, E, I, O and U), and it has duplicate characters, the method should print "The object " + the value of the String + " contains vowels and has duplicate characters". For example, if the object is PIZZA it would print: The name PIZZA contains vowels and has duplicate characters. If none of the above criteria is met, then the method should print the String element in lower case. For example, if the object is SKY, it would print: sky Once you have finished your project, open the terminal window in BlueJ and turn on record method calls. Create a new ListofThings object, and then add at least eleven (11) Strings using the add method you wrote. You must have: A String that contains vowels A String that has duplicate characters A String that contains vowels and has duplicate characters Demonstrate removing an element using the remove method you wrote, and then find the number of elements using the method you wrote that gets the number of elements. Finally, run your printNames method. Create a class called ListOfThings, that has one ArrayList field called things, which holds a collection of Strings (each string is a name of an object in Upper case e.g. CAR or PLANT). Make sure you write a description of your new Class in the comments, with your name as author and give the version as the date you last worked on this exercise. Define a constructor that initialises the ArrayList. Note that you can also add any other initialisations that you feel are relevant. 4 Create methods to add elements, remove elements and get the number of elements in the collection. Add a test for all three of these methods to check whether the operation was successful and print a message letting the user know if it was or was not. Create a method called printThings. This method should loop through the collection and print out the elements (each String on a new line) as determined by the following rules: ● ● If the string contains any vowels (A, E, I, O and U), the method should print "The object '+ the value of the String + " contains vowels, and the vowels are:" + list of the vowels in the string. The string may have more than one vowels. For example, if the name is BIKE it would print: The object BIKE contains vowels, and the vowels are: I E If the string contains duplicate characters, the method should print "The object " + the value of the String + " has the following duplicate character(s):" + list of the duplicate characters in the string. The string may have one or more duplicate character. For example, if the object is RACETRACK, it would print: The object RACETRACK has the following duplicate character(s): R A C If the string contains any vowels (A, E, I, O and U), and it has duplicate characters, the method should print "The object " + the value of the String + " contains vowels and has duplicate characters". For example, if the object is PIZZA it would print: The name PIZZA contains vowels and has duplicate characters. If none of the above criteria is met, then the method should print the String element in lower case. For example, if the object is SKY, it would print: sky Once you have finished your project, open the terminal window in BlueJ and turn on record method calls. Create a new ListofThings object, and then add at least eleven (11) Strings using the add method you wrote. You must have: A String that contains vowels A String that has duplicate characters A String that contains vowels and has duplicate characters Demonstrate removing an element using the remove method you wrote, and then find the number of elements using the method you wrote that gets the number of elements. Finally, run your printNames method. Create a class called ListOfThings, that has one ArrayList field called things, which holds a collection of Strings (each string is a name of an object in Upper case e.g. CAR or PLANT). Make sure you write a description of your new Class in the comments, with your name as author and give the version as the date you last worked on this exercise. Define a constructor that initialises the ArrayList. Note that you can also add any other initialisations that you feel are relevant. 4 Create methods to add elements, remove elements and get the number of elements in the collection. Add a test for all three of these methods to check whether the operation was successful and print a message letting the user know if it was or was not. Create a method called printThings. This method should loop through the collection and print out the elements (each String on a new line) as determined by the following rules: ● ● If the string contains any vowels (A, E, I, O and U), the method should print "The object '+ the value of the String + " contains vowels, and the vowels are:" + list of the vowels in the string. The string may have more than one vowels. For example, if the name is BIKE it would print: The object BIKE contains vowels, and the vowels are: I E If the string contains duplicate characters, the method should print "The object " + the value of the String + " has the following duplicate character(s):" + list of the duplicate characters in the string. The string may have one or more duplicate character. For example, if the object is RACETRACK, it would print: The object RACETRACK has the following duplicate character(s): R A C If the string contains any vowels (A, E, I, O and U), and it has duplicate characters, the method should print "The object " + the value of the String + " contains vowels and has duplicate characters". For example, if the object is PIZZA it would print: The name PIZZA contains vowels and has duplicate characters. If none of the above criteria is met, then the method should print the String element in lower case. For example, if the object is SKY, it would print: sky Once you have finished your project, open the terminal window in BlueJ and turn on record method calls. Create a new ListofThings object, and then add at least eleven (11) Strings using the add method you wrote. You must have: A String that contains vowels A String that has duplicate characters A String that contains vowels and has duplicate characters Demonstrate removing an element using the remove method you wrote, and then find the number of elements using the method you wrote that gets the number of elements. Finally, run your printNames method.
Expert Answer:
Answer rating: 100% (QA)
1 Create a class called ListOfThings Java public class ListOfThings 2 Add an ArrayList field called things Java public class ListOfThings private ArrayList things 3 Define a constructor that initializ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Pokmon GO continues to be one of the highest grossing mobilegames. In the game, you encounter wild pokemon, which you can attempt to catch. Each gamefor Pokemon uses slightly different rules for...
-
"If nominal GDP rises, velocity must rise." Is this statement true, false, or uncertain? Explain your answer.
-
In 2016, Bianca earned a salary of $164,000 from her employer. Determine the amount of FICA taxes and Medicare taxes withheld from her salary.
-
1. Tom was obviously overconfident in the final stages of the testing process, but was his behavior unethical? Why or why not? 2. Given Scotts concerns over R&Ds credibility, should he have taken...
-
Acne Medication and Gastrointestinal Injury Since 1999, Kamie Kendall had experienced ongoing abdominal pain, and she was eventually diagnosed with ulcerative colitis and irritable bowel syndrome...
-
Denny Asbestos Removal Company removes potentially toxic asbestos insulation and related products from buildings. The companys estimator has been involved in a long-simmering dispute with the on-site...
-
What is the central concept in urban economics that says people/businesses being physically next together increases overall productivity? Why does it increase productivity?
-
Paoli Consulting is a consulting firm owned and operated by Mary Paoli. The following end-of-period spreadsheet was prepared for the year ended March 31, 2019: During the year ended March 31, 2019,...
-
The S&P 500 index closes at 2000. European call and put options on the S&P 500 index with the exercise prices show below trade for the following prices: exercise price $1950 $1975 $2000 $2025...
-
A case study analysis requires you to investigate a business problem, examine solutions and propose a recommendation based on research.. Prepare a case study for BP Texas City.
-
As an HR manager, you have heard rumors about potential efforts to unionize your warehouse employees. Using online resources, prepare a short list of guidelines (at least three points) hto help...
-
Consider the following information: State Probability ABC Inc.'s Return Boom 0.25 15% Normal 0.50 8% Slowdown 0.15 4% Recession 0.10 -3% i. 11. iii. What is the expected return? What is the variance?...
-
A case study analysis requires you to investigate a business problem, examine solutions and propose a recommendation based on research. Prepare a case study for Angelo's Pizza.
-
One of the 5 major tax issues associated with mergers, acquisitions and divestitures is whether the acquirer uses cash from newly issued equity or cash from retained earnings to purchase the target...
-
Loba Law owns and operates her own business manufacturing baking sets, which she then sells to six merchandising firms. The list price of a baking set is $40, and the full manufacturing costs are...
-
Design and describe an application-level protocol to be used between an automatic teller machine and a bank's centralized computer. Your protocol should allow a user 's card and password to be...
-
In most modern programming languages, a variable or constant that is declared in a module is ___________ in that module. a. Global b. Invisible c. In scope d. Undefined
-
Design a flowchart or pseudocode for a program that accepts two numbers from a user and displays one of the following messages: First is larger , Second is larger , Numbers are equal .
-
Which of the following code segments correctly swaps the values of variables named x and y? a. x = y y = temp x = temp b. temp = x x = y y = temp c. x = y temp = x y = temp d. temp = x y = x x = temp
-
Why is it said that the PSNR principle has both a right and a duty side? Which one is most relevant with respect to international environmental law?
-
How many dimensions of the PSNR principle can you enumerate? To which one does UN Resolution 1803(1962) refer?
-
If there is a separate principle of precaution, do we need a principle of prevention?
Analyzing Statistics Through Critical Thinking And Values 1st Edition - ISBN: 0991634616 - Free Book
Study smarter with the SolutionInn App