1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Zarrin [17]
3 years ago
15

Complete the getNumOfCharacters() method, which returns the number of characters in the user's string. We encourage you to use a

for loop in this function. (3) In main(), call the getNumOfCharacters() method and then output the returned result. (1 pt) (4) Implement the outputWithoutWhitespace() method, which outputs the string's characters except for whitespace (spaces, tabs). Note: A tab is '\t'. Call the outputWithoutWhitespace() method in main().
Computers and Technology
1 answer:
photoshop1234 [79]3 years ago
5 0

Answer:

The Java code is given below with appropriate comments

Explanation:

//Program

//Import the necessary libraries

import java.util.Scanner;

//Define the class

public class CountStringCharacters

{

//Start the main method

public static void main(String[] args)

{

//Prompt the user to enter the input line

Scanner scan = new Scanner(System.in);

System.out.println("Enter a sentence or phrase: ");

String s = scan.nextLine();

 

//Take the number of characters and keep the count

int numOfCharacters = getNumOfCharacters(s);

System.out.println("You entered: "+s);

System.out.println("Number of characters: "+numOfCharacters);

 

//Call the method outputWithoutWhitespace

outputWithoutWhitespace(s);

}

//The method getNumOfCharacters

public static int getNumOfCharacters(String s)

{

int numOfCharCount = 0;

for(int i=0; i<s.length();i++)

{

numOfCharCount++;

}

return numOfCharCount;

}

//Definition of the method outputWithoutspace

public static void outputWithoutWhitespace(String s)

{

String str = "";

for(int i=0; i<s.length();i++)

{

char ch = s.charAt(i);

if(ch != ' ' && ch != '\t')

str = str + ch;

}

System.out.println("String with no whitespace: "+str);

}

}

You might be interested in
If you copy and paste from someone else's document (such as a website, a friend's paper, an instructor's solutions manual, etc.)
zzz [600]

Answer:

Deliberate

Explanation:

Plagiarizing means when some one copy the content of any topic from the sources i.e website, solutions manual, friend manual. And if some one check the solutions and find it that it was copied from somewhere the same we termed as plagiarizing.

In the given situation, if someone copying the content from someone else document so it would be called as deliberate plagiarizing

And if someone did not have any idea about it so we called accidental plagiarizing

8 0
3 years ago
The isometric projection camera technique provides an illusion of perspective by using things like parallax scrolling to create
Oksi-84 [34.3K]

Answer:

False.  

Explanation:

In this question some information is missing the question does not mention which type of question is this. This question is a true/false type question.

isometric projection camera is an engineer or the technical drawing in which we represented the 3D(three dimensional) objects in the 2D(Two dimensional) objects. This camera representing the object in a visual manner. isometric projection is also known as Isometric drawing, In the isometric projection camera, all the angles are equal. It does not provide an illusion perspective by using parallax scrolling to create the illusion of 3D in a 2D game.

3 0
2 years ago
The ? contains software routines that developers use to create a consistent computer environment
Luba_88 [7]

The toolbox contains software routines that developers use to create a consistent computer environment.

3 0
2 years ago
Read 2 more answers
45 points pls help
Artemon [7]

Answer:

Repetition.

Explanation:

hope it helps u

can u mark me as brainliest

8 0
2 years ago
Read 2 more answers
What effect does screen resolution have on how graphics are displayed?
posledela
The clearer the resolution screen is it is better seen through the graphics. Say you have a bad computer screen, well your graphics are going to be bad. The better and higher quality it is will be the better you can see your images.
7 0
3 years ago
Other questions:
  • Text, numbers,graphics, sounds entered into a computer's memory during input operations are referred to as
    11·1 answer
  • Corey is an architect. What software does he most likely use to design houses? graphic software scheduling software CAD software
    10·2 answers
  • What is the Matlab command to create a vector of the even whole numbers between 29 and 73?
    11·1 answer
  • You view a portion of a document on the screen through a
    14·1 answer
  • All of the Internet in your country disappears. What happens next?
    13·1 answer
  • Where do animators work?
    8·1 answer
  • Multiple Choice
    8·1 answer
  • 3.6 Code Practice Edhesive. (PYTHON LANGUAGE)
    13·1 answer
  • Procedural programs specify instructions that a processor must execute to perform computations. These programs sometimes consist
    11·1 answer
  • When passing a list of parameters to a stored procedure by name, you can omit optional parameters by:
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!