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

  Explain people-organizational and technological components

What is meant by information system? How does it work? Write down its people, organizational, and technological components?

  Computing characters are there in encyclopedia

The text of the Encyclopedia Britannica is about 44 million words. For a sample of about 2000 words, the average word length was 6.1 characters per word. Approximately how many characters are there in the encyclopedia?

  Explain elements of enterprise information security policy

Write and explain briefly the three kinds of information security policy as described by NIST SP 800-14. Write and explain briefly four elements that must be present in Enterprise Information Security Policy.

  Explaining relationship of strategic and tactical plans

Descriibe in scholarly detail relationship of strategic, tactical, and operational plans,

  Effective-protecting intellectual property in digital media

Which is more likely to be effective in protecting intellectual property in digital media such as CDs and DVDs: tougher copyright laws or new technologies incorporating.

  How silicon-based semiconductors revolutionized computing

New materials frequently lead to new technologies that change society. Describe how silicon-based semiconductors revolutionized computing.

  Circuit diagram of an adder that adds two 8-bit numbers

Draw the circuit diagram of an adder that adds two 8-bit numbers by cascading Adder modules that add two 2-bit numbers.

  Provide permission to get financial amounts

System to have employees register and provide permission to get financial amounts from dental insurance and retirement companies.

  Ways to avoid communication pitfalls

Based on the section on "Watch out for communication pitfalls" in the Bateman and Snell text, describe some ways that Lei could have avoided this situation.

  Explaining physical material on which computer keeps data

Storage is the physical material on which a computer keeps data, instructions, and information?

  Describe ease of finding information on internet

Explain main elements of assignment in the substantive way. Describe the ease of finding information on the Internet.

  Create two-page written analysis for problem statement

Create a two-page written analysis based on the following specification: Problem statement, Possible outcomes if no action taken (this one is mine and the only thing i have to do) Alternative actions.

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