DESCRIPTION:
You will be given a 1-D array, called wordFun, of Strings. The array has an unknown number of cells filled with data. As before, the array will already be filled with strings, some of which contain the string "Angela".
You will create a method called countItUp which returns and integer array containing the number of times each of the letters in my name occur within the strings within this array.
For example, if the input array was
wordFun = {"A", "Angela", "B", "gill", "e", "e"}
Counts would be:
A: 2
n: 1
g: 2
e: 3
l: 3
a: 1
thus the method countItUp would return the integer array {2, 1, 2, 3 ,3, 1}.
INPUT:
All input has been handled for you:
METHOD PROCESSING:
Use loops, arrays, and print statements to complete a new method called countItUp . This method should do the following:
METHOD RETURN VALUE:
NOTE: Only complete the countItUp
method. Do not alter any other code.
Sample input/output:
| Method argument | Method Return Value |
|
{"A", "Angela", "B", "gill", "e", "e"} |
{ 2, 1, 2, 3, 3, 1} |
|
{"Angela", "Bill", "apple", "pear"} |
{ 1, 1, 1, 3, 4, 3} |
code:
import java.util.Scanner;
/**
* @author Angela Siegel
* @date 07/17/2020
*/
public class Question3 {
/**
* countItUp method
*/
/*=====================================
|| DO NOT ALTER CODE BELOW THIS LINE ||
=====================================*/
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String[] words = in.nextLine().split(" ");
char[] letters = {'A','n','g','e','l','a'};
int[] counts = countItUp(words);
for (int i=0; i<6; i++) {
System.out.println(letters[i] + ": " + counts[i]);
}
}
}
Please comment if you have any doubt
Code:
import java.util.Scanner;
/**
* @author Angela Siegel
* @date 07/17/2020
*/
public class Question3 {
/**
* countItUp method
*/
public static int[] countItUp(String wordFun[]){
//array will store the count of
letters
int arr[]=new int[6];
//iterate through the array
for(int
i=0;i<wordFun.length;i++){
//iterate
through the string
for(int
j=0;j<wordFun[i].length();j++){
//if the letter is found
//then corresponding place value will be
incremented
if(wordFun[i].charAt(j)=='A')
arr[0]+=1;
else if(wordFun[i].charAt(j)=='n')
arr[1]+=1;
else if(wordFun[i].charAt(j)=='g')
arr[2]+=1;
else if(wordFun[i].charAt(j)=='e')
arr[3]+=1;
else if(wordFun[i].charAt(j)=='l')
arr[4]+=1;
else if(wordFun[i].charAt(j)=='a')
arr[5]+=1;
}
}
//returning the array
return arr;
}
/*=====================================
|| DO NOT ALTER CODE BELOW THIS LINE ||
=====================================*/
public static void main(String[] args) {
Scanner in = new
Scanner(System.in);
String[] words =
in.nextLine().split(" ");
char[] letters =
{'A','n','g','e','l','a'};
int[] counts =
countItUp(words);
for (int i=0; i<6; i++) {
System.out.println(letters[i] + ": " + counts[i]);
}
}
}

![public static void main(String[] args) { Scanner in = new Scanner(System.in); String[] words = in.nextLine().split( ); 39 4](http://img.homeworklib.com/questions/e1562f10-08db-11eb-9c3b-bbcf68324165.png?x-oss-process=image/resize,w_560)
Output:

DESCRIPTION: You will be given a 1-D array, called wordFun, of Strings. The array has an...
DESCRIPTION: You will be given a 1-D array, called wordFun, of Strings. The array has an unknown number of cells filled with data. As before, the array will already be filled with strings, some of which contain the string "Angela". You will create a method called countItUp which returns and integer array containing the number of times each of the letters in my name occur within the strings within this array. For example, if the input array was wordFun =...
DESCRIPTION: You will be given a 2-D string array, called matrix. The array has an unknown number of cells filled with data. Your goal is to iterate through the 2-D array and keep a count of how many cells contain the string "Angela". INPUT: All input has been handled for you: A filled 2-D string array. PROCESSING: Determine the number of rows in the array matrix Determine the number of columns in the array matrix Use nested loops to iterate...
DESCRIPTION: The purpose of this question is offload processing from the main method to a static helper method. You will be given the main method. Do not alter this code. Your goal is to write a new method called oddOneOut, which will accept a String, and print it in out every other letter. For example, if the String was "abcdefghijk", the oddOneOut method will return "acegik" . METHOD INPUT: A string METHOD PROCESSING: Do not alter the main method. Complete the...
package week_3; /** Write a method called countUppercase that takes a String array argument. You can assume that every element in the array is a one-letter String, for example String[] test = { "a", "B", "c", "D", "e"}; This method will count the number of uppercase letters from the set A through Z in the array, and return that number. So for the example array above, your method will return 2. You will need to use some Java library methods....
/** Given a String and an array of two Strings, return a three String array containing the strings in alphabetical order. Note: Capital letters count sort3Strings("wallace", {"washington", "irving"}) -> {"irving", "wallace", "washington"} sort3Strings("wallace", {"washington", "Irving"}) -> {"Irving", "wallace", "washington"} sort3Strings("Washington", {"irving", wallace"}) -> {"Washington", "irving", "wallace"} sort3Strings("washington", {"washington", "Washington"}) -> {"Washington", "washington", "washington"} **/ public static String[] sort3Strings(String stringValue, String[] stringArray) { //your code here return new String[1]; }//end sort3Strings ...
JAVA PLEASE!
Write a method called displayPets that takes an array of strings as input. The method should display the contents of the pets array on one line. Each name should be separated by a space. Use an enhanced for loop to iterate the array. Make sure to declare modifier, parameters and return values. Given an array String[] pets = {"Lucky", "Slinger", "Beast", "Trumpet", "Lulu", "Shadow", "Daisy"} A sample run when calling displayPets(pets) from main() would look like: Pets names:...
Java, please. Work based on the code above.
DESCRIPTION: The purpose of this question is offload processing from the main method to a static helper method. You will be given the main method. Do not alter this code. Your goal is to write a new method called oddOneOut, which will accept a String, and print it in out every other letter. For example, if the String was "abcdefghijk", the oddOneOut method will return "acegik" METHOD INPUT: • A string METHOD...
Must be done in Java.
Provide the rest of the code with full comments and
explanation and with proper indentation.
Use simple methods for better
understanding.
Must compile.
CODE PROVIDED:
import java.util.ArrayList;
import java.util.Scanner;
public class Problem3 {
public static void main( String [] args )
{
Scanner in = new
Scanner( System.in );
//PLEASE START YOUR WORK
HERE
//**********************************************************
//**********************************************************
// PLEASE END YOUR WORK
HERE
System.out.print("END OF
OUTPUT");
}
}
20 points! PROBLEM 3: EXTENDED FAMILY Complete this...
In this same program I need to create a new method called “int findItem(String[] shoppingList, String item)” that takes an array of strings that is a shopping list and a string for an item name and searches through the “shoppingList” array for find if the “item” exists. If it does exist print a confirmation and return the item index. If the item does not exist in the array print a failure message and return -1. import java.util.Scanner; public class ShoppingList...
JAVA QUESTION I have an array String array [] = {"101", "010", 111"} I have an input of "000" that I want to compare to each value in the array and count how many times they Differ. So String input = "000" CODE A FUNCTION THAT ACCEPTS THE ARRAY AND THE INPUT VARIABLE AS PARAMETERS. IN THIS FUNCTION, CODE A FOR LOOP THAT COMPARES THE String input to each element of the array ,COUNTS how many time they differ for...