QuestionQuestion

Application shall run forever
The following options shall be available to the user
0 - exit
1 - use of for loop
2 - use of while loop
3 - use of do/while loop
Any other number is invalid (repeat asking the user for input)
Once the user enters a valid loop options (1-3)
Then the application shall ask for a start character Dec. #33-126 (see ASCII table)
Print all the characters from start to finish (last character shall always be Dec. #126).

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

import java.util.Scanner;

/*
* Loop Program
*/
public class LoopProgram {

// Main method for program execution
public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    // Run in a loop
    while (true) {
      // Display menu
      System.out.println("Menu:");
      System.out.println(" 0 - Exit");
      System.out.println(" 1 - Use of for loop");
      System.out.println(" 2 - Use of while loop");
      System.out.println(" 3 - Use of do/while loop");
      String input = s.nextLine();
      // Get input 0 - exit
      if (input.equals("0")) {
       return;
      // Get input 1 - for loop
      } else if (input.equals("1")) {
       System.out.print("Enter start character: ");
       char start = s.nextLine().charAt(0);
       for (int i = (int) start; i < 127; i++) {
          System.out.println...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

$40.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats