Prompt the user for a string that contains two strings

Assignment Help JAVA Programming
Reference no: EM131585616

(1) Prompt the user for a string that contains two strings separated by a comma.
Examples of strings that can be accepted:Jill, Allen
Jill , Allen
Jill,Allen
Ex:
Enter input string: Jill, Allen

(2) Report an error if the input string does not contain a comma. Continue to prompt until a valid string is entered. Note: If the input contains a comma, then assume that the input also contains two strings.

Ex:
Enter input string: Jill Allen
Error: No comma in string
Enter input string: Jill, Allen

(3) Extract the two words from the input string and remove any spaces. Store the strings in two separate variables and output the strings.

Ex:
Enter input string: Jill, Allen
First word: Jill
Second word: Allen

(4) Using a loop, extend the program to handle multiple lines of input. Continue until the user enters q to quit.

Ex:
Enter input string: Jill, Allen
First word: Jill
Second word: Allen


Enter input string: Golden , Monkey
First word: Golden
Second word: Monkey


Enter input string: Washington,DC
First word: Washington
Second word: DC

Enter input string: q

Reference no: EM131585616

Questions Cloud

Find a minimum-weight spanning tree of the graph : Find a minimum-weight spanning tree of the graph given in Example. First use any method you like, then do it using Kruskal's algorithm.
Find a minimum weight matching : Now suppose that the information given in the previous problem is listed in preference order, i.e., the book the student desires most is listed first.
Conduct a search online for tutorials about normalization : Conduct some research online for tutorials on Relational Database design. Conduct a search online for tutorials about normalization.
Financial and strategic parameters : Analyze the Comcast's company's performance, both on financial and strategic parameters.
Prompt the user for a string that contains two strings : Prompt the user for a string that contains two strings separated by a comma - Store the strings in two separate variables and output the strings
How time stamps will play a role in backtracking in time : Describe how time stamps will play a role in backtracking in time until the point of entry for the worm is located watching the worm travel across the network.
Describe what behaviors seem related to retention : Describe what behaviors seem related to retention of undergraduates on campus.compare those two variables for the two groups.
Case related to the crossword puzzle : Consider the mini-sudoku puzzle of Figure 10.24, in which each row, column, and quadrant needs to contain the numbers 1, 2, 3, 4.
Explain what service would you recommend and why : Would this cloud structure work regardless of how many students enroll? Based on your table, what service would you recommend and why?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd