View the step-by-step solution to:

add a loop to the following code so that when you input over 100 eggs it reads "that's a lot of eggs!" // Import each required Java class...

add a loop to the following code so that when you input over 100 eggs it reads "that's a lot of eggs!"


// Import each required Java class

import java.io.IOException;

import java.util.Scanner;


/**

 *How Many Eggs you have

 *Brandon Rivers

 *Mar 30, 2018

 */


public class Eggs

{

public static void main(String[] args) throws IOException

{

//Variables

int x;

//Show while loop for eggs


Scanner input = new Scanner(System.in);

   System.out.println("How many eggs do you have"); 


while((x = input.nextInt() ) !=0) {


System.out.println("You Have: " + x + "_eggs");

System.out.println("How many eggs do you have");

}

System.out.println("You don't have anymore Eggs!!!");

}

}


 

Top Answer

Complete program: import java.io.IOException; import java.util.Scanner; public class Eggs { public static void main (... View the full answer

output1.JPG

Sign up to view the full answer

Other Answers

you need to add this code in your class // here the loop to check the input if it more than... View the full answer

import java.io.IOException; import java.util.Scanner; /**  *How Many Eggs you have  *Brandon Rivers  *Mar 30, 2018  */... View the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online