Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Intro to programming concepts: JAVA 1 Code a do-while loop that keeps printing t

ID: 3811006 • Letter: I

Question

Intro to programming concepts: JAVA 1
Code a do-while loop that keeps printing the message “I have to mind my teacher!” as long as the student keeps misbehaving in class. Assume misbehaving and input (for the Scanner class) are already declared. The variable misbehaving has been initialized to ‘y’ and it’s the loop-control variable. Intro to programming concepts: JAVA 1
Code a do-while loop that keeps printing the message “I have to mind my teacher!” as long as the student keeps misbehaving in class. Assume misbehaving and input (for the Scanner class) are already declared. The variable misbehaving has been initialized to ‘y’ and it’s the loop-control variable. Intro to programming concepts: JAVA 1

Explanation / Answer

public class Sample1 {

   public static void main(String args[]){
      
   char misbehaving;
      
       misbehaving='y';
       do
       {
           System.out.println("I have to mind my teacher!");
       }
       while(misbehaving=='y');
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote