Design the static method below to count

Assignment Help Basic Computer Science
Reference no: EM13163315

Design the static method below to count and return the frequency of each digit in the array of strings.

 

public static int [ ] countFreq (String [ ] strings);

 

in order to find the frequency of characters in an alphabet, we do this; i want to know how to count the frequency of the digits using that static method. The program should be really simple.

//example: x = "abcabcABDEFabc0123A"

public class Q4

{

public static int [ ] count (String x)

{

int [ ] counters = new int [52];

for (int i = 0; i < 52; i++)

counters[i] = 0;

 

int len = x.length ( );

 

for (int i = 0; i < len; i++)

{

char c = x.charAt(i);

if ((c >= 'A') && (c <= 'Z'))

counters[c - 65]++;

else if ((c >= 'a') && (c <= 'z'))

counters[c - 71]++;

}

 

return counters;

 

}

}

 

 

 

Reference no: EM13163315

Questions Cloud

How many moles of excess sulfuric acid are left over : 500.0 g of ammonia react with 51.0 moles of sulfuric acid to produce ammonium sulfate. How many moles of excess sulfuric acid are left over after the reaction is complete?
A graph is two-connected iff : A graph is two-connected iff, removal of any single vertex and the edges adjacent to that vertex, leaves the graph connected. How can we tell if a graph is two-connected? Explain your algorithm in English
Which reduces the solubility of calcium fluoride : Which of the following reduces the solubility of calcium fluoride?
How much heat in kilojoules is required to warm : How much heat in kilojoules is required to warm 10.0 of ice, initially at -10.0, to steam at 125. The heat capacity of ice is 2.09 and that of steam is 1.84 .
Design the static method below to count : Design the static method below to count and return the frequency of each digit in the array of strings.
Java program that allows the user to enter a letter : Write a java program that allows the user to enter a letter (as a code) and a real number (as the radius of a circle). If the letter is 'A' your program must calculate the area of the circle. If the letter is 'C' your program must calculate the ci..
What mass of oxygen gas is required in order to release : What mass of oxygen gas is required in order to release 6670 kJ of heat to the surroundings by the following reaction
Calculate the concentration of all species : Sodium azide (NaN3) is sometimes added to water to kill bacteria. Calculate the concentration of all species in a 0.010 M solution of NaN3. The Ka value for hydrazoic acid (HN3) is 1.9 * 10-5.
Compute the ph during the titration : Calculate the pH during the titration of 50.00 ml of 0.0500 M NaOH with 0.1000 M CH3CO2H after the addition of the following volumes

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Determine probability of obtaining exactly k heads of coin

Counting heads. Given integers n and k, along with p1; : : : ; pn 2 [0; 1], you want to determine the probability of obtaining exactly k heads when n biased coins are tossed independently at random.

  Approach to organizing and funding it organization

What would be the best approach to organizing and funding their IT organization? Describe at least one alternative approach. Provide justification for why your proposed approach is the best one.

  Find companies that specialize in computer forensics

What needs clarified? it's plainly stated use google to find 3 companies that specialize in computer forensics of those 3 companies write 2 or 3 paragraphs comparing what each company does.

  Address three components represented in cell

Assume that a security model is needed for protection of information in your class. Write a brief statement on how you would address the three components represented in that cell.

  Cryptography for standardized regulated and mandated

Whose interests are most significant when finding extent to which cryptography must be standardized, regulated, and mandated?

  Importance of top management commitment

Discuss the importance of top management commitment and the development of standards for successful project management. Provide examples to illustrate the importance of these items.

  You have 10 stacks of coins

You have 10 stacks of coins, each consisting of 10 quarters. One entire stack is counterfeit, but you do not know which one. You do know the weight of a genuine quarter and you are also told that each counterfeit quarter weights one gram more than it..

  Experts suggest regarding search for information on internet

Which of the following do experts recommend regarding the search for information on the Internet? Avoid Boolean operators since new technology has made them obsolete.

  Add the form which includes richtextbox control

Add the form which includes RichTextBox control and several predefined template letters. This part of program would be used to write letters to your customers.

  Use of visitor pattern to supply additional functionality

Rather than use the Visitor pattern to supply additional functionality. Give the details and compare the advantages and disadvantages of this approach when compared to the Visitor pattern.

  Designing a 4-to-16 decoder using not gates

Draw 4-to-16 decoder by using components. You must not use any extra components.

  Explain chain of custody is critical factor for cases

Think of numerous cases where evidence could potentially be tampered with a cell phone or thumb drive. What can go wrong?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd