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
A top level class may have only the following accessmodifier.
GREYUIT [131]

Answer: Public

Explanation:

 A top level class can have a public, as top level cannot be private and protected because the modifier private is not allowed. As, top level is a class which is not a nested class. Interface of a access modifier is either public or no modifier. There are two types of access control modifier are top level - public and member level- private, protected.

3 0
3 years ago
In what country was the English royal family and nobility living before the Restoration?
krek1111 [17]

im not sure to be exact , but i think its england. i have done an assignment in the past and that was the awnser.....hope i help                      

4 0
3 years ago
What type of space is often the main focal point of the composition in graphic design
iogann1982 [59]

Answer: what are the choices?

Explanation:

3 0
3 years ago
Can somebody help me with this question?
Vaselesa [24]


Designers are also responsible for interactive designs where the content changes as it gets updated, as well as screen interfaces that help people navigate through a lot of information. Interaction design differentiates itself from other kinds of design by adding another consideration: responding to the actions of the viewer or user. Editorial design for web and mobile is the most tangible example, including websites and mobile apps for publication. Some digital design involves the presentation of rapidly changing streaming information, also known as data visualization, creating both interactive and non-interactive interfaces. Product design refers to the 

8 0
3 years ago
18. which of these components is responsible for providing instructions and processing for a computer? a. cpu b. ssd c. ram d. r
cricket20 [7]

The components that is responsible for providing instructions and processing for a computer is a. CPU.

<h3>What area of the computer executes commands?</h3>

This command center's central processing unit (CPU) is a sophisticated, large-scale collection of electrical circuitry that carries out pre-stored program instructions. A central processing unit is a must for all computers, big and small.

Note that the CPU, RAM, and ROM chips are all located on the motherboard. The "brain" of the computer is known as the Central Processing Unit (CPU). It carries out instructions (from software) and directs other parts.

Learn more about CPU from

brainly.com/question/26991245
#SPJ1

7 0
1 year ago
Other questions:
  • If you want to add a picture to your document, you can __________. (Select all that apply.)
    10·1 answer
  • Follow up, my brother is upset at me for stealing his robux, what should i do?
    11·2 answers
  • Although heart rate increases and decrease depending upon activity level on average a typical person heart rate is about _____ b
    10·1 answer
  • What are the three types of programming design?
    15·1 answer
  • Define a class named ComparableSquare that extends Square (defined above) and implements Comparable. Implement the compareTo met
    7·1 answer
  • A posting error is:
    8·1 answer
  • write a C program the prints out the size of variables with the following C data types- int, long, unsigned, long long, double,
    7·1 answer
  • True or false? Resistors regulate and limit electrical current. A. True B. False
    7·2 answers
  • Most airlines use very modern hardware and software.<br><br><br> True<br><br> False
    9·1 answer
  • What in the world is this for and how do you use it
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!