Even complicated and confusing topics will be easily developed and covered if you request our help writing an essay. Place an order today!

I can’t seem to figure out how to get my code to move to a New line… can you help

// import statements

import java.lang.*;

import java.util.*;

// Create a class named ParseStrings

public class ParseStrings

{

   // Create a main method

   public static void main(String[] args)

   {

       // Create a string named inputString to accept input from the user

       String inputString, firstWord, secondWord;

       int comma = 0, nextComma = 0;

       // Create an object for the scanner class

       Scanner read = new Scanner(System.in);

       // Create a boolean variable named flag

       boolean flag = true;

       // Create a do while loop to accept data

       // continuously if the user enters wrong input

       while (true)

       {

           do

           {

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

               // Accept data from the user

               inputString = read.nextLine();

               if (inputString.equals(“q”))

               {

                   System.exit(1);

               }

               // Get the index value of the comma

               comma = inputString.indexOf(“,”);

               nextComma = inputString.lastIndexOf(“,”);

               // Create a if statement to check the input string

               // contains more commas or not

               if (nextComma > comma)

               {

                   System.out.println(“Error: Too many comma in string”);

                   flag = true;

               }

               // Create an else if statement to check the input string

               // contains atleast one comma or not

               else if (comma <= 0)

               {

                   System.out.print(“Error: No comma in string”);

                   flag = true;

               }

               else

               {

                   // Split the string from the index of comma and

                   // assign the substrings in the data string array

                   String[]data = inputString.split(“,”);

                   // Remove all white spaces in the data string

                   firstWord = data[0].replaceAll(” “, “”);

                   secondWord = data[1].replaceAll(” “, “”);

                   // Display data

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

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

                   flag = false;

               }

           } while (flag);

       }

   }

}

testimonials icon
  Week 1 Discussion: Discuss the Importance of Urban and Regional Planning Initiate a discussion on your concepts...
testimonials icon
Media Violence and Aggressive behavior in Children             The media is composed of many aspects includi...
testimonials icon
INVENTION OF THE INTERNETINVENTION OF THE INTERNETFULL NAMEINSTITUTIONAL AFFILIATIONINVENTION OF THE INTERNETOn January 1st, 1983, ARPANET adopted TC...
testimonials icon
/*! elementor - v3.6.5 - 27-04-2022 */ .elementor-heading-title{padding:0;margin:0;line-height:1}.elementor-widget-heading .elementor-heading...
testimonials icon
Career and Technical EducationThis discussion is an opportunity for you to evaluate how the purposeful integration of techn...
testimonials icon
NURS 6550 – Conditions of the Eye, Ear, Nose, and Throat (EENT) Essay Assignment Papers...
testimonials icon
(1) Suppose that in an attempt to induce citizens to conserve energy, the government enacted regulations requiring that all...
testimonials icon
P14-5 P14-6 and P14-7 P14-5 (Comprehensive Bond Problem) In each of the following independent cases the company closes its 5 books on December...
testimonials icon
For two weeks during the semester you will be asked to watch a factually based short video about a specific conflict management issues. You are req...
testimonials icon
Needed by Friday April 12th 2013 at 12pm.-Toronto Canada time zone.-Part A and B completed....
testimonials icon
Electrical Conductivity Electrical conductivity (EC) of water is the measurement of the ability of water to conduct an electric current....

Other samples, services and questions:

Calculate Price

When you use PaperHelp, you save one valuable — TIME

You can spend it for more important things than paper writing.

Approx. price
$65
Order a paper. Study better. Sleep tight. Calculate Price!
Created with Sketch.
Calculate Price
Approx. price
$65