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]
4 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]4 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 team of researchers wants to create a program to analyze the amount of pollution reported in roughly 3,000 counties across the
omeli [17]

The option that is most likely to be a challenge in creating the program is Different counties may organize data in different ways.

<h3>What is Pollution?</h3>

Pollution is known to be a kind of bringing in of harmful materials into an environment.

These harmful things are known as pollutants. Pollutants are known to be natural and artificial that is they are created by human activity, such as trash or runoff produced by factories, etc.

Learn more program from

brainly.com/question/1538272

7 0
2 years ago
Description
meriva
33.33 minutes of video

3 GB already used which means you have 5 GB left, 5GB is the same as 5000 MB

So 5000 MB divided by 150 MB is 33.33 minutes of video that can be stored on the iPhone
8 0
3 years ago
The algorithm for solving the problem of average of five (5) numbers​
PilotLPTM [1.2K]

Answer:

Explanation:

Denote the five numbers as a, b, c, d and e.

The average is:

(a + b + c + d +e) ÷ 5.

Easily:

Learn how to do input and output operations in your programming language of choice.

Learn what average is (see Arithmetic mean - Wikipedia)

Learn how to code arithmetic operations in your PL of choice.

Put all that together and code the program.

Oh, did you expect the code snippet? Sorry, I don’t do peoples’ homework for them on principle. Homework is for you to learn something. If you can’t be bothered, accept that you’ll fail your class. If you want to pass, LEARN.

3 0
3 years ago
Which action deletes a row in a worksheet?
joja [24]

Answer:

C

Explanation:

st ryvyezrbubt5x3z3vubyc32 uvtxexyvuc4z26bux3x

5 0
3 years ago
White a function the will accept three arguments, two numbers and an operation sign among "+", "-", "/", and "x". The function s
Setler79 [48]

Answer:

Here you go :)

Explanation:

Change this however you'd like:

def calc(n1, op, n2):

   if op.lower() == "x":

       return n1*n2

   elif op == "+":

       return n1+n2

   elif op == "-":

       return n1-n2

   elif op == "/":

       return n1/n2

   else:

       return "error"

num1 = float(input("Input first number: "))

oper = input("Input operator: ")

num2 = float(input("Input second number: "))

print(calc(num1, oper, num2))

4 0
3 years ago
Other questions:
  • If I deal seven cards from a standard deck of 52, what is the chance that I will get two triples (three of a kind) and one other
    11·2 answers
  • Retype the statements, correcting the syntax errors.
    9·1 answer
  • You have successfully compiled the file Hi.java, how do you run the corresponding program from the command line?
    7·1 answer
  • On many advanced routers and switches, you can implement QoS through bandwidth management, such as __________, where you control
    5·1 answer
  • Methods inherited from the base/super class can be overridden. This means changing their implementation; the original source cod
    5·1 answer
  • To use Click and type feature can be used to format and enter text graphic and other items
    6·1 answer
  • State reasons why new version of application packages are released often?​
    11·2 answers
  • Write the full form of E-mail?​
    6·2 answers
  • What kind of animation is used in the powerpuff girls show??
    9·1 answer
  • Configuring a firewall to ignore all incoming packets that request access to a specific port is known as ____.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!