Implement the following method so that it counts the number of times the target
character appears in the given string and returns the...
Search Results
Searching for: String
Individual Exercises
The method below takes in a set of String names of students. Below, use this set names
to create a map (either HashMap or TreeMap is...
Complete the calculatePrice
function so that each item in the provided cart
added to the total price. Any item that is "milk"
costs $2.50...
Complete the following function. When given aString, return True if it ends in "ly". Return False otherwise.
Complete the following function. Given aString, return the first half of characters in that string (the string "woohoo" yields "woo")....
Complete the following function. Given aString, return a copy of aString where any character next to a star (*) and all stars themselves...
Given an outside string of length 4, such as "(())"
, and an inside string, return a new string where the inside is squeezed in the middle...
Complete the following linear search method. Find the string search
in the array words
. If the string is found, return the index for the...
Write a method replaceSpaceUnderscore
that replaces all spaces with _
(underscores) in the String sentence
.
Complete the method countTimesContains
that returns the number of times the array words
contains the word stored in searchW
. Remember to...
Complete the following linear search method. Find the string search
in the array words
. If the string is found, return the string found....
For this question assume the following code:
public class LinkedBag<T> implements BagInterface<T>{ private Node firstNode; ...
For the question below, assume the following implementation of LinkedStack:
public class LinkedStack<T> implements StackInterface...
Write a function called count
that receives (A) a string and (B) a character, and returns a count of how many times the character is...
Write a function called countVowels
that receives a string
and returns the count of how many vowels it has, including a
,e
,i
,o
, and u
and...
For this question, assume the following implementation of the class Person and the following UML diagram
Person Class Implementation
...
The following method should return a string representation of the array in the parameter called numbers
. However, currently it returns a...
This Person
class stores a String name
and an int id
. However the toString()
method is not working correctly. The toString()
method...
The following Dog
class stores a String name
and an integer numSpots
that represents how many spots the dog has on its fur. It also...
What is wrong with this code?
String x; if (x.length() > 0) System.out.println("Hello "+x);
Your task: Construct a Python program that prints strings "Hello", "Parsons", and "Problems" on their own lines. You can get feedback on...