Would like some help on this. I will give thumbs up for answer that fulfills the requirements
Question:
Would like some help on this. I will give thumbs up for answer that fulfills the requirements below! Thanks Step 1: Make a class called Censorship. There should be the following in the class: public Censorship() // No input required for the constructor public boolean containsBadWord(String str) public boolean isBadWord(String str) public boolean addBadWord(String str) public void listBadWords() public String censorBadWords(String str) // censors words in a string public boolean removeBadWord(String str) // removes bad words from list Add an instance variable of a list and leave it as public. List
Step 3: Implement listBadWords() This method should behave in the following way: If you added three bad words in the order of 'apple', 'pear', and 'bAnAnA', your output should be: List of bad words: // you could also choose to capitalize all letters instead 1. apple 2. pear 3. banana In order to complete this, you will need to be able to iterate or go through the list. There are two main ways: 1. Access each element through an index. 2. Use an iterator. We will focus on accessing elements through their index for now. In a list, you can access the elements using the get method.
Step 4: Make a CensorshipTester class and write test cases. Generally, you should always have a test case that covers every kind of output possible. For example: For a boolean function, write at least two test cases. For a function that returns a number, write at least two test cases that should have greatly different return values. Later, you should even write test cases that try illegal operations. Step 5: Implement isBadWord. You will use String.equals to determine whether the input string is one of the list of bad words. This time, you will check the input string against every possible word in the list.
Step 6: Implement hasBadWord You will use String.contains to determine whether the input string has one of the list of bad words. This time, you will check the input string against every possible word in the list.
Step 7: Implement censorBadWords You will use String.replaceAll to replace all instances of bad words with asterisks.
The method should work in the following way. Given: listBadWords() List of bad words: 1. apple 2. pear 3. banana remove("pear") Removed pear remove("bAnAnA") Removed banana remove("pear") No pear in list
listBadWords() List of bad words: 1. apple You will need to use either remove(int index) Or remove(Object o) For now, use remove(int index) to become more familiar with loops.
(PLEASE MAKE SURE CENSORSHIP AND CENSORSHIPTESTER classes are both completed)
Auditing and Assurance services an integrated approach
ISBN: 978-0133125689
15th edition
Authors: Alvin a. arens, Randal j. elder, Mark s. Beasley