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
o-na [289]
4 years ago
5

(2) Complete the get_num_of_characters() function, which returns the number of characters in the user's string. We encourage you

to use a for loop in this function. (2 pts) Extend the program by calling the get_num_of_characters() function and then output the returned result. (3) Extend the program further by implementing the string_without_whitespace() function. string_without_whitespace() returns the string's characters except for whitespace (spaces, tabs). Note: A tab is '\t'. (2 pt) Ex: Enter a sentence or phrase: The only thing we have to fear is fear itself. You entered: The only thing we have to fear is fear itself. Number of characters: 46 String with no whitespace: Theonlythingwehavetofearisfearitself. After you have completed and tested your lab, submit the code of the functions only to Zybook for autograding.
Computers and Technology
1 answer:
dybincka [34]4 years ago
8 0

Answer:

Code details below

Explanation:

// Scanner is a class in the java.util package used to get the entry of primitive types like int, double etc. and also String.

import java.util.Scanner;

// The program must be able to open any text file specified by the user, and analyze the frequency of verbal ticks in the text.  

public class TextAnalyzer {

// public : it is a access specifier that means it will be accessed by publically. static : it is access modifier that means when the java program is load then it will create the space in memory automatically. void : it is a return type i.e it does not return any value. main() : it is a method or a function name.  

 

public static void main(String[] args) {

// the program will find the length of a string without using any loops and you may assume that the length of entered string is always less than any given number

      Scanner scan = new Scanner(System.in);

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

      String s = scan.nextLine();

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

      int numOfCharacters = getNumOfCharacters(s);

      System.out.println("");

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

      outputWithoutWhitespace(s);

  }

  public static int getNumOfCharacters(final String s){

      int numOfCharCount = 0;

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

              numOfCharCount++;

      }

      return numOfCharCount;

  }

   

// Using this function, we replace all whitespace with no space(“”)

  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
In photoshop what should you consider when determining a projects purpose and objectives?
Darina [25.2K]

Answer:

Identify the purpose, audience, and audience needs for preparing image,Identify three phases that might appear in a project plan. When planning your design project you might include on an outline the goals.

4 0
3 years ago
Whats the correct answer
dem82 [27]
Line 2 or line 4 sorry if I’m wrong
7 0
3 years ago
Read 2 more answers
List and describe the three types of cloud models described by Microsoft.
anygoal [31]

There are three main service models of cloud computing – Infrastructure as a Service (IaaS), Platform as a Service (PaaS) and Software as a Service (SaaS). There are clear differences between the three and what they can offer a business in terms of storage and resource pooling, but they can also interact with each other to form one comprehensive model of cloud computing.

aaS (Infrastructure as Service)

This is the most common service model of cloud computing as it offers the fundamental infrastructure of virtual servers, network, operating systems and data storage drives. It allows for the flexibility, reliability and scalability that many businesses seek with the cloud, and removes the need for hardware in the office. This makes it ideal for small and medium sized organisations looking for a cost-effective IT solution to support business growth. IaaS is a fully outsourced pay-for-use service and is available as a public, private or hybrid infrastructure.

PaaS (Platform-as-a-Service)

This is where cloud computing providers deploy the infrastructure and software framework, but businesses can develop and run their own applications. Web applications can be created quickly and easily via PaaS, and the service is flexible and robust enough to support them. PaaS solutions are scalable and ideal for business environments where multiple developers are working on a single project. It is also handy for situations where an existing data source (such as CRM tool) needs to be leveraged.

SaaS (Software as a Service)

This cloud computing solution involves the deployment of software over the internet to variousbusinesses who pay via subscription or a pay-per-use model. It is a valuable tool for CRM and for applications that need a lot of web or mobile access – such as mobile sales management software. SaaS is managed from a central location so businesses don’t have to worry about maintaining it themselves, and is ideal for short-term projects.

3 0
3 years ago
Enumeration can be used to discover all but which of the following types of information?
Ostrovityanka [42]

Answer:A)Smart-card PINs

Explanation: A pin is the defines as the personal identification number that is allotted to the smart card uniquely that is no other smart can have same number.This number is only known by the smart card holder only.

This number is important because it works for the unlocking of the data that is securely stored and by entering the pin ,it can be decoded.Thus, the other given options are incorrect because they don't use enumeration to hide the data .Thus the correct option is option (A)

3 0
3 years ago
Alicia is typing a research paper. She is having difficulty remembering how to use the thesaurus and how to center the title. Sh
pantera1 [17]

Answer:

C. Use the help feature

Explanation:

The help feature in the MS word is the quickest access to getting real time assistance when working on a project.

7 0
4 years ago
Read 2 more answers
Other questions:
  • What is something you can do to stay connected to the relationships in your life while we spend this time at home?
    13·1 answer
  • Match the items.
    15·1 answer
  • Write a program that sorts a vector of names alphabetically using the selection sort and then searches the vector for a specific
    7·1 answer
  • _____ remove the part of an image starting from an edge​
    13·1 answer
  • True or False. A compact disc (CD) stores music in a coded pattern of tiny pits 10−7m deep. The pits are arranged in a track tha
    9·1 answer
  • The Receiver recognizes the sounds the Sender is making and transforms them into words and ideas in his own mind. What is this
    5·1 answer
  • What is computer. Write full form of mips​
    15·1 answer
  • Which data type is also called a binary object?
    9·2 answers
  • Also have a good day people !!
    5·2 answers
  • 2+2? D: I don't knoww​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!