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
DIA [1.3K]
3 years ago
7

(1) prompt the user for a string that contains two strings separated by a comma. (1 pt) examples of strings that can be accepted

: jill, allen jill , allen jill,allen ex: enter input string: jill, allen
Computers and Technology
1 answer:
GalinKa [24]3 years ago
5 0

package parsestrings;

import java.util.Scanner;

public class ParseStrings {

public static void main(String[] args) {

Scanner scnr = new Scanner(System.in); // Input stream for standard input

Scanner inSS = null; // Input string stream

String lineString = ""; // Holds line of text

String firstWord = ""; // First name

String secondWord = ""; // Last name

boolean inputDone = false; // Flag to indicate next iteration

// Prompt user for input

System.out.println("Enter input string: ");

// Grab data as long as "Exit" is not entered

while (!inputDone) {

// Entire line into lineString

lineString = scnr.nextLine()

// Create new input string stream

inSS = new Scanner(lineString);

// Now process the line

firstWord = inSS.next();

// Output parsed values

if (firstWord.equals("q")) {

System.out.println("Exiting.");

inputDone = true;

if (firstWord.matches("[a-zA-Z]+,[a-zA-Z]+")) {

System.out.print("Input not two comma separated words");

}

} else {

secondWord = inSS.next();

System.out.println("First word: " + firstWord);

System.out.println("Second word: " + secondWord);

System.out.println();

}

}

return;

}

}

You might be interested in
a central issue in the microsoft antitrust lawsuit involved microsoft's integration of its internet browser into its windows ope
Tomtit [17]

A central issue in the Microsoft antitrust lawsuit involved Microsoft's integration of its internet browser into its windows operating system, to be sold as one unit is a practice that is known as: C. tying.

<h3>What is an operating system?</h3>

In Computer technology, an operating system (OS) can be defined as a system software that's usually pre-installed on a computing device by the manufacturers, in order to manage random access memory (RAM), software programs, computer hardware and all user processes.

Microsoft was involved in an antitrust lawsuit with respect to tying the integration of its internet (web) browser into its windows operating system (OS) such as Windows 7, 8, 10, etc., in order to sell them to end users as a single unit.

Read more on operating system here: brainly.com/question/22811693

#SPJ1

8 0
9 months ago
What is an Algorithm? (might not be in the chapter text). Give an example.
Rashid [163]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

An algorithm is the list of a finite set of instructions and rules that a computer needs to do to complete a task in order to solve a problem.

In short, an algorithm is a series of instructions that are implemented step by step to solve a problem. For example, you could consider a pizza recipe an algorithm for making a pizza in an everyday life routine. But when you are talking about using algorithms in computation and in mathematics. It means that solving a problem using a series of steps step by step.

For example, your everyday tasks aligned on a google calendar and remind you about your tasks using the alarm, etc- how to implement this using set of instructions and rules- is an algorithm.

Solving a quadratic equation is another example of an algorithm.

Binary search, array sorting are an example of an algorithm in computation. Because these algorithms based on the execution of step-by-step instruction to solve a problem such as sorting a list of numbers etc.  

6 0
2 years ago
What is the function of the command prompt?
yan [13]
The answer is B cause you use it to make commands
6 0
2 years ago
Which one of the following oscilloscope controls is used to move the trace up and down the screen vertically
kakasveta [241]
B. is the answer to this question
3 0
2 years ago
Programs that do the same thing every time they run are called...
Misha Larkins [42]

Answer:

predictable

Explanation:

because it repeat itself all time

6 0
2 years ago
Other questions:
  • Which step can most directly help your team follow up on decisions made during Web development meetings?This task contains the r
    6·1 answer
  • True/False: When you make a function call, the order of the arguments you send does not matter as long as the number of argument
    15·1 answer
  • Gabriel needs to create a formula that does not change when it is copied to cell b2. which formula should he create?
    14·1 answer
  • When planning a backup strategy, ideally one needs to prioritize important data and only back up what is absolutely necessary fo
    15·1 answer
  • A writing team wants to present the six-month sales figures for its company's 14 sales representatives in a report. Because mana
    11·1 answer
  • What will be the values of ans, x, and y after the following statements are executed? int ans = 35, x = 50, y =50; if ( x &gt;=
    7·2 answers
  • Question 3 of 10
    7·1 answer
  • Discuss TWO changes in ICMP that took place with the development of IPV6 and indicate why those changes were made.
    7·1 answer
  • 15. Virus cannot infect files that are saved in i. USB ii. CD-ROMs iii. Memory card iv. All of them​
    14·2 answers
  • Choose the response that best completes the following statement.
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!