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
Illusion [34]
3 years ago
11

Write a program with a function that accepts a string as an argument and returns a copy of the string with the first character o

f each sentence capitalized. The program should let the user enter a string and then pass it to the function, printing out the modified string.
Computers and Technology
1 answer:
soldi70 [24.7K]3 years ago
3 0

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

 System.out.println("Enter String");

 Scanner sc1=new Scanner(System.in);

 String st1=sc1.nextLine();

 convertfirstchartoupper(st1);

 //System.out.println(st1);

 

}

private static void convertfirstchartoupper(String st1){

     

      char[] arr = st1.toCharArray();

      int k =0;

      arr[0]=Character.toUpperCase(arr[0]);

      while(k<arr.length)

      {

         

         if(Character.isWhitespace(arr[k]))

         {

             

             arr[k+1]=Character.toUpperCase(arr[k+1]);

             

         }

         

         

        k++;

      }

      k=0;

       while(k<arr.length)

      {

         

        System.out.print(arr[k]);

         

        k++;

      }

  }

}

Explanation:

In the above java program, we change a string into an array of characters and then check for whitespace. the letter next to while space is the first letter of the new word, and hence we capitalize that letter. And this is what is required. However, we can split the sentence into a string of words as well, and then capitalize the first letter of each word.

You might be interested in
Which of the following is a typical concern for developers while using prototypes?
MaRussiya [10]

Answer: B. developing a uniform funding solution for the system

Explanation: Prototyping has several benefits: the software designer and implementer can get valuable feedback from the users early in the project. The client and the contractor can compare if the software made matches the software specification, according to which the software program is built. It also allows the software engineer some insight into the accuracy of initial project estimates and whether the deadlines and milestones proposed can be successfully met.

7 0
3 years ago
Read 2 more answers
Which type of element is , and what is the meaning of that element?
IrinaK [193]

Answer:

1. Semantic

2. modifies

Explanation:

Semantic HTML is understood by the traditional browser, and semantic tags are the one that ensures not just presentation, but also adds the meaning to the webpage. And hence, img here is both semantic as well as presentational. Hence, the first option is semantic. And the IMG modifies the meaning of the web page. The description is done by the text. And hence the second option is modified.

.

6 0
2 years ago
A food web is shown below. In this food web, energy is transferred directly from the to the
Irina18 [472]

That answer would be the producer

8 0
3 years ago
Speech on inventors and inventions
vlada-n [284]
Interntors present an interesting kind of people who think in peculiar ways sometimes. This ability allows them to view certain situations in ways in which other people cannot. Because of this, they can think of new ways of how such situations can be tackled. This is how inventions are born. A person with an inventive mind sees a new situation where he thinks of a new solution how he could improve this situation with his invention.

This process is continued continuously with new generations of inventors seeing and coming back to old situations over and over again, inventing new things along the way. 
4 0
3 years ago
Which of the following is the system of rules and structure governing
Whitepunk [10]

The system of rules and structure which governs language is generally referred to as: C. grammar.

<h3>What is language?</h3>

A language simply refers to a structured system of communication through which living organisms, especially humans share information among themselves, especially through the use of spoken words and sounds.

In English language, grammar is the system of rules and structure which governs the use and composition of language.

Read more on language here: brainly.com/question/781903

#SPJ1

8 0
1 year ago
Other questions:
  • The ________ is(are) used to display information on the computer's screen.
    13·1 answer
  • What is the different between image processing and machine vision? Please explain with an example.
    11·1 answer
  • What type of social engineering attack uses email to direct you to their their website where they claim you need to update/valid
    6·2 answers
  • Write a program that ask the user to enter air water or Steele and the distance that a sound wave will travel in the medium the
    6·1 answer
  • when two pieces of cui or other unclassified information are posted online together or attached together in an email and result
    5·1 answer
  • Cloud kicks recently completed the implementation of sales cloud. Cloud kicks has trained the users to use the mobile app to acc
    12·1 answer
  • A _____ is a unique name that identifies an Internet site. URL Browser AOL IA
    13·1 answer
  • When developing e-business systems, an in-house solution usually requires a ____ for a company that must adapt quickly in a dyna
    11·1 answer
  • 1. Write a program to input four numbers and store them in variables.
    6·1 answer
  • Complete the sentence based on the given information.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!