Returns the number of times that a digit appears in text

Assignment Help Computer Engineering
Reference no: EM132197998

Question :

Write the countDigits method that returns the number of times that a digit appears in text, which is a String that may be empty or may contain words and digits. For example:

countDigits("I told him 100 times to stop") returns 3 because the string "100" contains three digits and appears in text. Note,

• Your method returns 0 if presented with the empty string;

• You may use only the String methods used in class: charAt( int ), indexOf( char) and/or length();

• Your method can use at most one Java iteration statement (either a for, a while

or a do-while statement); and

• Your method may go through the text only once.

static int countDigits( String text ) { String digits = "0123456789"; int count = 0;

Reference no: EM132197998

Questions Cloud

Calculate company X shares using cash flow valuation method : Weighted average cost of capital - 10% and Long-term FCF growth rate - 3%. According to the discounted cash flow valuation method, Company X shares are
Describe the three-step iteration process : Discuss/describe the Three-Step Iteration process and how the process may apply to your team's innovation concept generation process that may include.
Write a constructor for a deck class that create pinochle : Write a constructor (you choose the signature) for a Deck class that creates a 48 card Pinochle deck.
What advise will you give to your roommate : Your roommate and you have automobile insurance policies with identical coverage written by the same insur- ance company. You both drive the same year.
Returns the number of times that a digit appears in text : Write the countDigits method that returns the number of times that a digit appears in text, which is a String that may be empty or may contain words.
Illustrate the effect of a decrease in the quantity : Illustrate the effect of a 10% decrease in the quantity demanded by China for milk powder. Show how this will affect world prices, New Zealand exports.
Write a program for a university registration system : Your program will select the actual class size randomly. The size is selected randomly and must be between half of the maximum and the maximum inclusive.
Write a decision statement to check that the value : Write a decision statement to check that the value of an integer variable "x" is between 45 and 75. If it is, display YES, otherwise display NO.
Make a two dimensional graph of the electric field lines : Write a computer program using Matlab to make a two dimensional graph of the electric field lines and the equipotential surfaces due to a particular set.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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