QuestionQuestion

Using jGRASP, write a Java program named LastnameFirstname07.java, using your last name and your first name, that does the following:

-Uses a while loop to print the numbers from 3 - 19.
-Uses a do-while loop to print the numbers from 46 - 58.
-Uses a for loop to print the numbers from 87 - 95.
-Asks the user for 2 numbers.
-Uses a loop to print all numbers between the given numbers, inclusive.

Note: Consider that your user's second number can be lower! (see example below)
Note: Also consider that your user might give you two of the same number.

Your program MUST:
-Use a while, do-while, and for a loop. The fourth loop is your choice.
-Actively use in-line comments stating what each section of code does.
-Use try/catch, BUT only if necessary.

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;

/**
*
* @author
*/
public class {

    public static void main(String[] args) {
       System.out.println("I'm going to print out the "
                + "numbers 3-19 using a while loop:");
       int i = 8;
      
       // stop when i is greater than 19
       while (i <= 19) {
            System.out.print(i + " ");
            i++;
       }
       System.out.println("");

       System.out.println("I'm going to print out the numbers "
                + "46-58 using a do-while loop:");
       i = 46;
       do {
            System.out.print(i + " ");
            i++;
       } while (i <= 58); // stop when i > 58
      
      
       System.out.println("");

       System.out.println("I'm going to print out the numbers"
                + " 87-95 using a for loop:");...

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

$10.00
for this solution

or FREE if you
register a new account!

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

Find A Tutor

View available Computer Science - Other 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