Implement the method countInitial which accepts as parameters an ArrayList of Strings and a letter, stored in a String. (Precondition: the String letter has only one character. You do not need to check for this.) The method should return the number of Strings in the input ArrayList that start with the given letter. Your implementation should ignore the case of the Strings in the ArrayList. Hint - the algorithm to implement this method is just a modified version of the linear search algorithm. Use the runner class to test your method but do not add a main method to your U7_L4_Activity_One.java file or your code will not be scored correctly.

Answers

Answer 1

Answer:

Answered below

Explanation:

//Program is implemented in Java

public int countInitials(ArrayList<string> words, char letter){

int count = 0;

int i;

for(i = 0; i < words.length; i++){

if ( words[i][0]) == letter){

count++

}

}

return count;

}

//Test class

Class Test{

public static void main (String args[]){

ArrayList<string> words = new ArrayList<string>()

words.add("boy");

words.add("bell");

words.add("cat");

char letter = 'y';

int numWords = countInitials ( words, letter);

System.out.print(numWords);

}

}


Related Questions

During TCP/IP communications between two network hosts, information is encapsulated on the sending host and decapsulated on the receiving host using the OSI model. Match the information format with the appropriate layer of the OSI model.

a. Packets
b. Segments
c. Bits
d. Frames

1. Session Layer
2. Transport Layer
3. Network Layer
4. Data Link Layer
5. Physical Layer

Answers

Answer:

a. Packets - Network layer

b. Segments - Transport layer

c. Bits - Physical layer

d. Frames - Data link layer

Explanation:

When TCP/IP protocols are used for communication between two network hosts, there is a process of coding and decoding also called encapsulation and decapsulation.

This ensures the information is not accessible by other parties except the two hosts involved.

Operating Systems Interconnected model (OSI) is used to standardise communication in a computing system.

There are 7 layers used in the OSI model:

1. Session Layer

2. Transport Layer

3. Network Layer

4. Data Link Layer

5. Physical Layer

6. Presentation layer

7. Application layer

The information formats given are matched as

a. Packets - Network layer

b. Segments - Transport layer

c. Bits - Physical layer

d. Frames - Data link layer

Sophisticated modeling software is helping international researchers

Answers

Answer:

A. increase the pace of research in finding and producing vaccines.

Explanation:

These are the options for the question;

A. increase the pace of research in finding and producing vaccines.

B. analyze computer systems to gather potential legal evidence.

C. market new types of products to a wider audience.

D. create more intricate screenplays and movie scripts.

Modeling software can be regarded as computer program developed in order to build simulations as well as other models. modelling software is device by international researchers to make research about different vaccines and other drugs and stimulants to combat different diseases. It helps the researcher to devoid of details that are not necessary and to deal with any complexity so that solution can be developed. It should be noted that Sophisticated modeling software is helping international researchers to increase the pace of research in finding and producing vaccines.

Given that the variable named Boy = "Joey" and the variable named Age = 6, create statements that will output the following message:

Congratulations, Joey! Today you are 6 years old.

First, write one statement that will use a variable named Message to store the message. (You will need to concatenate all of the strings and variables together into the one variable named Message. If you don't know what that means, read the section in Chapter 1 about concatenation.)
Then write a second statement that will simply output the Message variable.

Answers

Answer:

isn't it already showing it if not put text box

Explanation:

You are considering upgrading memory on a laptop. What are three attributes of currently installed memory that HWiNFO can give to help you with this decision?

Answers

Answer:

Some of the qualities of the installed memory which HWiNFO can reveal are:

Date of manufactureMemory type Speed of memory

Explanation:

HWiNFO is an open-source systems information app/tool which Windows users can utilize as they best wish. It helps to detect information about the make-up of computers especially hardware.

If you used HWiNFO to diagnose the memory, the following information will be called up:

the total size of the memory and its current performance settingsthe size of each module, its manufacturer, and model Date of manufactureMemory type Speed of memorysupported burst lengths and module timings, write recovery time etc.

Cheers

5. All sites are required to have the following reference materials available for use at VITA/TCE sites in paper or electronic format: Publication 17, Publication 4012, Volunteer Tax Alerts (VTA), and Quality Site Requirement Alerts (QSRA). AARP Foundation Tax Aide uses CyberTax Alerts in lieu of VTAs and QSRAs. What other publication must be available at each site and contains information about the new security requirements at sites

Answers

Answer:

Publication 5140.

Explanation:

The acronym VITA stands for Volunteer Income Tax Assistance and TCE stands for Tax Counseling for the Elderly. VITA/TCE is a certification gotten from the Internal Revenue Service in which the holders of such certification are trained on how to help people that have disabilities or that their incomes earners that are low. These volunteers help these set of people to prepare for their tax return.

In order to make the volunteers to be able to perform their work with high accuracy, the Department of Treasury, Internal Revenue Service gave out some aids for Quality Site. One of the aids which is the one contains information about the new security requirements at sites is given in the Publication 5140.

Help need right now pls
Read the following Python code:
yards - 26
hexadecimalYards = hex (yards)
print (hexadecimalYards)
Which of the following is the correct output? (5 points)
A. 0b1a

B. 0d1a

C. 0h1a

D. 0x1a

Answers

Answer:

d. 0x1a

Explanation:

let m be a positive integer with n bit binary representation an-1 an-2 ... a1a0 with an-1=1 what are the smallest and largest values that m could have

Answers

Answer:

Explanation:

From the given information:

[tex]a_{n-1} , a_{n-2}...a_o[/tex] in binary is:

[tex]a_{n-1}\times 2^{n-1} + a_{n-2}}\times 2^{n-2}+ ...+a_o[/tex]

So, the largest number posses all [tex]a_{n-1} , a_{n-2}...a_o[/tex]  nonzero, however, the smallest number has [tex]a_{n-2} , a_{n-3}...a_o[/tex] all zero.

The largest = 11111. . .1 in n times and the smallest = 1000. . .0 in n -1 times

i.e.

[tex](11111111...1)_2 = ( 1 \times 2^{n-1} + 1\times 2^{n-2} + ... + 1 )_{10}[/tex]

[tex]= \dfrac{1(2^n-1)}{2-1}[/tex]

[tex]\mathbf{=2^n -1}[/tex]

[tex](1000...0)_2 = (1 \times 2^{n-1} + 0 \times 2^{n-2} + 0 \times 2^{n-3} + ... + 0)_{10}[/tex]

[tex]\mathbf {= 2 ^{n-1}}[/tex]

Hence, the smallest value is [tex]\mathbf{2^{n-1}}[/tex] and the largest value is [tex]\mathbf{2^{n}-1}[/tex]

Approximately how many numeric IP addresses are possible with IPv4?

4 billon

Answers

Answer:

4,294,967,296 (~4.3B)

Explanation:

IPv4 uses 32-bits for representing addresses, thus you can have 2^32 total combinations.

Other Questions
What is the solution of the system? {5xy=21x+y=3 Enter your answer in the boxes. ( , ) What is the price of $45 art set with 7% tax in 2001 an outbreak of hoof-and-mouth disease in europe led to the burning of millions of cattle carcasses. discuss the demand and supply implication caused by the outbreak, for an in-depth analysis of the discussion topic you may use all of the resources available to you. what impact would you expect on the supply of cattle hides, hide prices, the supply of leather goods, and the price of leather goods how does fallacious reasoning ruin the validity of an argumentA) it uses emotions rather than logic to convince people of a claim B) it convinces people to accept evidence in support of a claimC) it persuades people to accept the authors claim without proofD) it tries to persuade by using reasoning that is not sound or logical Expanding an EmpireWarm-UpWhy might a country want to increase its power or expand its territory? Check all that apply.to bolster its defensesto restrict its military expensesto limit trade with other nationsto acquire new territory and resourcesto gain access to new economic marketsto spread its values to other parts of the world A flying squirrel's nest is 6 meters high in a tree. From its nest, the flying squirrel glides 8 meters to reach an acorn that is on the ground. How far is the acorn from the base of the tree? If necessary, round to the nearest tenth. is this a real person Corey need a 24 boards that are 47 1/2 inches long A. How many feet a boards should he buy? Explains.B. if you can only buy 8-fot boards, how many should he buy? explain *VIOLINIST* URGENT HELPFill in bubbles with note names (letters)YOU MUST INCLUDE FLATS AND SHARP SIGNS Discussion Prompt: A fair coin is tossed twice and the number of heads is recorded. Jose says the P(1 head) = 1/2, while Jeff students says P(1 head) = 1/3. Explain in detail why Jose is correct. which of the following is falseA.famous people have to work har to maintain there bodysB. looking like your favorite celbrity is a good fitness goal for you.C.Many celebritys struggle with eating disorders.D. tecnology can alter a persons apperence in magizines or on television Read these lines from "lf" by Rudyard Kipling. The first three lines are an example of If you can dream - and not make dreams your master; If you can think - and not make thoughts your aim; If you can meet with Triumph and Disaster And treat those two impostors just the same; O dialogue O repetition O stanzas. O onomatopeia which of the following choices is a possible length for DF? 17 39 19 Describe how a business such as a supermarket or a department store uses classification to make it easier for its customers to find a particular type of merchandise. During the early 1900s, Spokane emerged as a leader inshipping and trade.arts and culture.agriculture and industry.fishing and mining. How would you describe yourself in relation to geography? Why did the United States interfere in Iran in the 1950s? What was the result of their interference? what advocacy in your professional track have you supported? In what way did you supported? Did you use any digital tool to do so?Please tulongan ninyo ako please Write an algebraic expression to model the unknown number situation.the sum of a number and one-thirdA 1-column table with 5 rows. Column 1 is labeled Addition Words with entries add, increase by, more than, sum, total.Which statements are true? Select all that apply.You can replace "a number" with a variable to represent an unknown value.You can replace "sum" with an addition sign.You can replace "sum" with an multiplication sign.You can replace "one-third" with One-third.The correct algebraic expression is One-third n. A pencil pouch has 12 pencils and 30 led pencils, What is the ratio ofpencils to led pencils?