Lab 6: Loops and Conditionals in Java

In this lab, you will practice using conditional statements and looping constructs in Java.

Problem 1: ReadPrint

Implement a class named ReadPrint that does the following:

Note that I did not even mention that the class ReadPrint must be in a file named ReadPrint.java because it would be obvious by now. I won't mention that any more in the future.

Problem 2: SkipPrint

Implement a class named SkipPrint that does the following:

Problem 3: Using Conditionals with Strings

Create a Java class named StringSeparation that takes in a sentence as input from the user. The program should then go through the input and pull out the second word in the sentence and print that word. For this problem, assume each word has exactly one space between every other word and the user always enters at least 3 words.

For example if given:

        This example sentence is entered by the user
  

It would print:

        The second word is: example

Use the charAt(index) and substring() String methods to solve this problem.