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
TCP and the User Datagram Protocol (UDP) provide _________ between processes on any two of those hosts. A. address translation B
Fynjy0 [20]

TCP is known to be a type of a connection-oriented protocol, while UDP is a connectionless protocol. TCP and UDP provide data transport between hosts.

  • TCP and UDP are known for their speed, as TCP is slower and can retransmit lost data packets than UDP. UDP is said to be faster, simpler, and efficient protocol.

Data transport is simply known to be an the energy problem. It is the amount of energy needed to transport a bit from the closest neighbor.

Data Transport Service gives  a reliable connection for moving large amounts of data at very fast speeds.

Learn more from

brainly.com/question/17695822

6 0
3 years ago
How is it possible to find encyclopedias and reference texts on the internet
mariarad [96]

Answer:

just look up encyclopedias

Explanation:

3 1
3 years ago
Read 2 more answers
_____________________ denotes the use of human interactions to gain any kind of desired access. Most often, this term involves e
pishuonlain [190]

Answer:

Social engineering

Explanation:

<u>Social engineering</u> involves exploiting existing relationships and <u>manipulating people to reveal certain confidential information or to grant access to such information, systems, or networks</u>, usually for fraudulent reasons.

4 0
3 years ago
Consider the following high-level recursive procedure: long long int flong long int n, long long int k long long int b b k+2; if
Stolb23 [73]

Answer:

f(long long, long long):

push rbp

mov rbp, rsp

push rbx

sub rsp, 40

mov QWORD PTR [rbp-40], rdi

mov QWORD PTR [rbp-48], rsi

mov rax, QWORD PTR [rbp-48]

add rax, 2

mov QWORD PTR [rbp-24], rax

cmp QWORD PTR [rbp-40], 0

jne .L2

mov QWORD PTR [rbp-24], 8

jmp .L3

.L2:

mov rax, QWORD PTR [rbp-40]

lea rdx, [0+rax*4]

mov rax, QWORD PTR [rbp-24]

lea rbx, [rdx+rax]

mov rax, QWORD PTR [rbp-48]

lea rdx, [rax+1]

mov rax, QWORD PTR [rbp-40]

sub rax, 1

mov rsi, rdx

mov rdi, rax

call f(long long, long long)

add rax, rbx

mov QWORD PTR [rbp-24], rax

.L3:

mov rdx, QWORD PTR [rbp-24]

mov rax, QWORD PTR [rbp-48]

add rax, rdx

add rsp, 40

pop rbx

pop rbp

ret

Explanation:

8 0
3 years ago
What is the term for the era created by the digital revolution?
ollegr [7]
We are in the modern era and the information era
8 0
3 years ago
Other questions:
  • Software that was designed to serve the needs of a specific company or organization is called:
    5·1 answer
  • Clep allows students to do all of thw following except which?
    11·2 answers
  • PLEASE HELP!!!!! MUCH OBLIGED!!!!
    15·1 answer
  • Motorcycles have two or three wheels, a seat for the rider and at least a ____ horse-powered engine.
    15·1 answer
  • When you connect a device to your computer for the first time, Windows Media Player selects the ____ method that works best for
    15·2 answers
  • Please help!!!! will mark brainliest!!
    7·2 answers
  • Please help me I need a help
    13·1 answer
  • A summer camp offers a morning session and an afternoon session. The list morningList contains the names of all children attendi
    6·1 answer
  • The Internet is based on a U.S. government project called ________. Today, the Internet is a collection of networks, tied togeth
    5·1 answer
  • Q2: Mark True or False in the corresponding Answer sheet (0.5 point each)
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!