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
gregori [183]
2 years ago
12

This exercise asks you to write a program that tests some of the built-in subroutines for working with Strings. The program shou

ld ask the user to enter their first name and their last name, separated by a space. Read the user's response using TextIO.getln(). Break the input string up into two strings, one containing the first name and one containing the last name. You can do that by using the indexOf() subroutine to find the position of the space, and then using substring() to extract each of the two names. Also output the number of characters in each name, and output the user's initials. (The initials are the first letter of the first name together with the first letter of the last name.) A sample run of the program should look something like this:
Please enter your first name and last name, separated by a space.
? Mary Smith
Your first name is Mary, which has 4 characters
Your last name is Smith, which has 5 characters
Your initials are MS
Computers and Technology
1 answer:
klasskru [66]2 years ago
5 0

Answer:

Java.

Explanation:

// Get user input

System.out.print("Please enter your first name and last name separated by a space: ");

userInput = TextIO.getln();

// Find index of space character

int spaceIndex = userInput.indexOf(' ');

// Extract first and last name using space character index

// I have used length() method to get length of string userInput.

String firstName = userInput.substring(0, spaceIndex-1);

String lastName = userInput.substring(spaceIndex+1, userInput.length()-1);

// Print the required statements

System.out.print("Your first Name is %s, which has %d characters%n", firstName, firstName.length());

System.out.print("Your last Name is %s, which has %d characters%n", lastName, lastName.length());

// I have used space character Index to get the Initial of last name

System.out.print("Your initials are %s%s", firstName.substring(0,0), lastName.substring(spaceIndex+1, spaceIndex+1));

You might be interested in
Plz..... Add the following Binary numbers 1. 111000 + 1100 + 111111​
Korvikt [17]

Answer:

11000011

Explanation:

This is because of the rules of bas 2

3 0
2 years ago
Which task is not possible with VLOOKUP?
Flauer [41]

Answer:c

Explanation:

4 0
3 years ago
Read 2 more answers
A factory producing cables for personal computers finds that its current average
puteri [66]
This is normal as personal computers, unless designed to, don't usually put out a ton of power it's mostly just what your battery need and a bit more that's it
8 0
3 years ago
A computer hard disk starts from rest, then speeds up with an angular acceleration of 190 rad/s2 until it reaches its final angu
Nataly_w [17]
The first thing we are going to do is find the equation of motion:
 ωf = ωi + αt
 θ = ωi*t + 1/2αt^2
 Where:
 ωf = final angular velocity
 ωi = initial angular velocity
 α = Angular acceleration
 θ = Revolutions.
 t = time.
 We have then:
 ωf = (7200) * ((2 * pi) / 60) = 753.60 rad / s
 ωi = 0
 α = 190 rad / s2
 Clearing t:
 753.60 = 0 + 190*t
 t = 753.60 / 190
 t = 3.97 s
 Then, replacing the time:
 θ1 = 0 + (1/2) * (190) * (3.97) ^ 2
 θ1 = 1494.51 rad
 For (10-3.97) s:
 θ2 = ωf * t
 θ2 = (753.60 rad / s) * (10-3.97) s
 θ2 = 4544,208 rad
 Number of final revolutions:
 θ1 + θ2 = (1494.51 rad + 4544.208 rad) * (180 / π)
 θ1 + θ2 = 961.57 rev
 Answer:
 the disk has made 961.57 rev 10.0 s after it starts up
3 0
2 years ago
Read 2 more answers
Your older brother Max tells you about his secret plan to hack into his college’s computer network and change all of his grades.
viktelen [127]

Answer:

Tell him he could get kicked out of school and it can possibly show up on his record and lessen his chances of finding a job since no one will trust him. He should just focus and get his grades up instead of risking everything and "taking the easy way out".

Explanation:

6 0
1 year ago
Other questions:
  • To use an imported image, simply drag it from the desktop onto the stage. true or false?
    14·1 answer
  • How many bit does four gigabyte has
    8·2 answers
  • To create a new query in Design view, click CREATE on the ribbon to display the CREATE tab and then click the ____ button to cre
    9·1 answer
  • Front and rear camber and toe settings are being adjusted during a four-wheel alignment. The correct order for performing these
    13·1 answer
  • From the Software Engineering Code of Ethics, which clauses relate to intellectual property (check all that apply)
    15·1 answer
  • How does violating the SOLID principles make code hard to test?
    5·1 answer
  • We define the following terms:
    11·1 answer
  • Ethical design refers to...
    13·1 answer
  • Several NEC® sections contain the requirement to size conductors and overcurrent devices at 100 percent of the noncontinuous loa
    15·1 answer
  • True or False: The major advantage of Arrays over ArrayLists in Java is the fact that while ArrayLists are fixed in size, an Arr
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!